@@ -266,10 +266,12 @@ impl<'hir> LoweringContext<'_, 'hir> {
266
266
let body_id =
267
267
this. lower_maybe_async_body ( span, & decl, asyncness, body. as_deref ( ) ) ;
268
268
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
+ } ) ;
273
275
let sig = hir:: FnSig {
274
276
decl,
275
277
header : this. lower_fn_header ( header) ,
@@ -382,8 +384,9 @@ impl<'hir> LoweringContext<'_, 'hir> {
382
384
// method, it will not be considered an in-band
383
385
// lifetime to be added, but rather a reference to a
384
386
// parent lifetime.
387
+ let itctx = ImplTraitContext :: Universal ( self . current_hir_id_owner ) ;
385
388
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| {
387
390
let trait_ref = trait_ref. as_ref ( ) . map ( |trait_ref| {
388
391
this. lower_trait_ref (
389
392
trait_ref,
@@ -647,8 +650,9 @@ impl<'hir> LoweringContext<'_, 'hir> {
647
650
kind : match i. kind {
648
651
ForeignItemKind :: Fn ( box Fn { ref sig, ref generics, .. } ) => {
649
652
let fdec = & sig. decl ;
653
+ let itctx = ImplTraitContext :: Universal ( self . current_hir_id_owner ) ;
650
654
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| {
652
656
(
653
657
// Disallow `impl Trait` in foreign items.
654
658
this. lower_fn_decl ( fdec, None , FnDeclKind :: ExternFn , None ) ,
@@ -1227,7 +1231,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
1227
1231
is_async : Option < NodeId > ,
1228
1232
) -> ( & ' hir hir:: Generics < ' hir > , hir:: FnSig < ' hir > ) {
1229
1233
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| {
1231
1236
this. lower_fn_decl ( & sig. decl , Some ( id) , kind, is_async)
1232
1237
} ) ;
1233
1238
( generics, hir:: FnSig { header, decl, span : self . lower_span ( sig. span ) } )
0 commit comments