@@ -127,12 +127,12 @@ impl<'hir> DelegationGenericArgsIterator<'hir> {
127127 hir:: GenericParamKind :: Type { .. } => hir:: GenericArg :: Type ( ctx. arena . alloc ( hir:: Ty {
128128 hir_id,
129129 span : p. span ,
130- kind : hir:: TyKind :: Path ( Self :: create_generic_arg_path ( ctx , & p) ) ,
130+ kind : hir:: TyKind :: Path ( ctx . create_generic_arg_path ( & p) ) ,
131131 } ) ) ,
132132 hir:: GenericParamKind :: Const { .. } => {
133133 hir:: GenericArg :: Const ( ctx. arena . alloc ( hir:: ConstArg {
134134 hir_id,
135- kind : hir:: ConstArgKind :: Path ( Self :: create_generic_arg_path ( ctx , & p) ) ,
135+ kind : hir:: ConstArgKind :: Path ( ctx . create_generic_arg_path ( & p) ) ,
136136 span : p. span ,
137137 } ) )
138138 }
@@ -150,35 +150,6 @@ impl<'hir> DelegationGenericArgsIterator<'hir> {
150150
151151 args
152152 }
153-
154- pub ( super ) fn create_generic_arg_path (
155- ctx : & mut LoweringContext < ' _ , ' hir > ,
156- p : & hir:: GenericParam < ' hir > ,
157- ) -> hir:: QPath < ' hir > {
158- let res = Res :: Def (
159- match p. kind {
160- hir:: GenericParamKind :: Lifetime { .. } => DefKind :: LifetimeParam ,
161- hir:: GenericParamKind :: Type { .. } => DefKind :: TyParam ,
162- hir:: GenericParamKind :: Const { .. } => DefKind :: ConstParam ,
163- } ,
164- p. def_id . to_def_id ( ) ,
165- ) ;
166-
167- hir:: QPath :: Resolved (
168- None ,
169- ctx. arena . alloc ( hir:: Path {
170- segments : ctx. arena . alloc_slice ( & [ hir:: PathSegment {
171- args : None ,
172- hir_id : ctx. next_id ( ) ,
173- ident : p. name . ident ( ) ,
174- infer_args : false ,
175- res,
176- } ] ) ,
177- res,
178- span : p. span ,
179- } ) ,
180- )
181- }
182153}
183154
184155impl < ' hir > HirOrTyGenerics < ' hir > {
@@ -596,4 +567,33 @@ impl<'hir> LoweringContext<'_, 'hir> {
596567 ) ) ,
597568 }
598569 }
570+
571+ pub ( super ) fn create_generic_arg_path (
572+ & mut self ,
573+ p : & hir:: GenericParam < ' hir > ,
574+ ) -> hir:: QPath < ' hir > {
575+ let res = Res :: Def (
576+ match p. kind {
577+ hir:: GenericParamKind :: Lifetime { .. } => DefKind :: LifetimeParam ,
578+ hir:: GenericParamKind :: Type { .. } => DefKind :: TyParam ,
579+ hir:: GenericParamKind :: Const { .. } => DefKind :: ConstParam ,
580+ } ,
581+ p. def_id . to_def_id ( ) ,
582+ ) ;
583+
584+ hir:: QPath :: Resolved (
585+ None ,
586+ self . arena . alloc ( hir:: Path {
587+ segments : self . arena . alloc_slice ( & [ hir:: PathSegment {
588+ args : None ,
589+ hir_id : self . next_id ( ) ,
590+ ident : p. name . ident ( ) ,
591+ infer_args : false ,
592+ res,
593+ } ] ) ,
594+ res,
595+ span : p. span ,
596+ } ) ,
597+ )
598+ }
599599}
0 commit comments