@@ -266,10 +266,12 @@ impl<'hir> LoweringContext<'_, 'hir> {
266266 let body_id =
267267 this. lower_maybe_async_body ( span, & decl, asyncness, body. as_deref ( ) ) ;
268268
269- let ( generics, decl) = this. add_implicit_generics ( generics, id, |this| {
270- let ret_id = asyncness. opt_return_id ( ) ;
271- this. lower_fn_decl ( & decl, Some ( id) , FnDeclKind :: Fn , ret_id)
272- } ) ;
269+ let itctx = ImplTraitContext :: Universal ( this. current_hir_id_owner ) ;
270+ let ( generics, decl) =
271+ this. add_implicit_generics ( generics, id, itctx, |this| {
272+ let ret_id = asyncness. opt_return_id ( ) ;
273+ this. lower_fn_decl ( & decl, Some ( id) , FnDeclKind :: Fn , ret_id)
274+ } ) ;
273275 let sig = hir:: FnSig {
274276 decl,
275277 header : this. lower_fn_header ( header) ,
@@ -382,8 +384,9 @@ impl<'hir> LoweringContext<'_, 'hir> {
382384 // method, it will not be considered an in-band
383385 // lifetime to be added, but rather a reference to a
384386 // parent lifetime.
387+ let itctx = ImplTraitContext :: Universal ( self . current_hir_id_owner ) ;
385388 let ( generics, ( trait_ref, lowered_ty) ) =
386- self . add_implicit_generics ( ast_generics, id, |this| {
389+ self . add_implicit_generics ( ast_generics, id, itctx , |this| {
387390 let trait_ref = trait_ref. as_ref ( ) . map ( |trait_ref| {
388391 this. lower_trait_ref (
389392 trait_ref,
@@ -647,8 +650,9 @@ impl<'hir> LoweringContext<'_, 'hir> {
647650 kind : match i. kind {
648651 ForeignItemKind :: Fn ( box Fn { ref sig, ref generics, .. } ) => {
649652 let fdec = & sig. decl ;
653+ let itctx = ImplTraitContext :: Universal ( self . current_hir_id_owner ) ;
650654 let ( generics, ( fn_dec, fn_args) ) =
651- self . add_implicit_generics ( generics, i. id , |this| {
655+ self . add_implicit_generics ( generics, i. id , itctx , |this| {
652656 (
653657 // Disallow `impl Trait` in foreign items.
654658 this. lower_fn_decl ( fdec, None , FnDeclKind :: ExternFn , None ) ,
@@ -1227,7 +1231,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
12271231 is_async : Option < NodeId > ,
12281232 ) -> ( & ' hir hir:: Generics < ' hir > , hir:: FnSig < ' hir > ) {
12291233 let header = self . lower_fn_header ( sig. header ) ;
1230- let ( generics, decl) = self . add_implicit_generics ( generics, id, |this| {
1234+ let itctx = ImplTraitContext :: Universal ( self . current_hir_id_owner ) ;
1235+ let ( generics, decl) = self . add_implicit_generics ( generics, id, itctx, |this| {
12311236 this. lower_fn_decl ( & sig. decl , Some ( id) , kind, is_async)
12321237 } ) ;
12331238 ( generics, hir:: FnSig { header, decl, span : self . lower_span ( sig. span ) } )
0 commit comments