@@ -1352,18 +1352,18 @@ impl<'a> LoweringContext<'a> {
1352
1352
}
1353
1353
1354
1354
fn visit_ty ( & mut self , t : & ' v hir:: Ty ) {
1355
- // Don't collect elided lifetimes used inside of `fn()` syntax
1355
+ // Don't collect elided lifetimes used inside of `fn()` syntax
1356
1356
if let hir:: Ty_ :: TyBareFn ( _) = t. node {
1357
- let old_collect_elided_lifetimes = self . collect_elided_lifetimes ;
1358
- self . collect_elided_lifetimes = false ;
1357
+ let old_collect_elided_lifetimes = self . collect_elided_lifetimes ;
1358
+ self . collect_elided_lifetimes = false ;
1359
1359
1360
- // Record the "stack height" of `for<'a>` lifetime bindings
1361
- // to be able to later fully undo their introduction.
1362
- let old_len = self . currently_bound_lifetimes . len ( ) ;
1363
- hir:: intravisit:: walk_ty ( self , t) ;
1364
- self . currently_bound_lifetimes . truncate ( old_len) ;
1360
+ // Record the "stack height" of `for<'a>` lifetime bindings
1361
+ // to be able to later fully undo their introduction.
1362
+ let old_len = self . currently_bound_lifetimes . len ( ) ;
1363
+ hir:: intravisit:: walk_ty ( self , t) ;
1364
+ self . currently_bound_lifetimes . truncate ( old_len) ;
1365
1365
1366
- self . collect_elided_lifetimes = old_collect_elided_lifetimes;
1366
+ self . collect_elided_lifetimes = old_collect_elided_lifetimes;
1367
1367
} else {
1368
1368
hir:: intravisit:: walk_ty ( self , t)
1369
1369
}
@@ -2579,17 +2579,12 @@ impl<'a> LoweringContext<'a> {
2579
2579
}
2580
2580
} ) ;
2581
2581
2582
- let asyncness = match header. asyncness {
2583
- IsAsync :: Async { return_impl_trait_id, .. } => Some ( return_impl_trait_id) ,
2584
- IsAsync :: NotAsync => None ,
2585
- } ;
2586
-
2587
2582
let ( generics, fn_decl) = this. add_in_band_defs (
2588
2583
generics,
2589
2584
fn_def_id,
2590
2585
AnonymousLifetimeMode :: PassThrough ,
2591
2586
|this| this. lower_fn_decl (
2592
- decl, Some ( fn_def_id) , true , asyncness)
2587
+ decl, Some ( fn_def_id) , true , header . asyncness . opt_return_id ( ) )
2593
2588
) ;
2594
2589
2595
2590
hir:: ItemFn (
@@ -3016,11 +3011,6 @@ impl<'a> LoweringContext<'a> {
3016
3011
} ) ;
3017
3012
let impl_trait_return_allow = !self . is_in_trait_impl ;
3018
3013
3019
- let asyncness = match sig. header . asyncness {
3020
- IsAsync :: Async { return_impl_trait_id, .. } => Some ( return_impl_trait_id) ,
3021
- IsAsync :: NotAsync => None ,
3022
- } ;
3023
-
3024
3014
self . add_in_band_defs (
3025
3015
& i. generics ,
3026
3016
impl_item_def_id,
@@ -3031,7 +3021,7 @@ impl<'a> LoweringContext<'a> {
3031
3021
sig,
3032
3022
impl_item_def_id,
3033
3023
impl_trait_return_allow,
3034
- asyncness,
3024
+ sig . header . asyncness . opt_return_id ( ) ,
3035
3025
) ,
3036
3026
body_id,
3037
3027
)
@@ -3136,8 +3126,8 @@ impl<'a> LoweringContext<'a> {
3136
3126
ItemKind :: MacroDef ( ..) => SmallVector :: new ( ) ,
3137
3127
ItemKind :: Fn ( ref decl, ref header, ..) => {
3138
3128
let mut ids = SmallVector :: one ( hir:: ItemId { id : i. id } ) ;
3139
- if let IsAsync :: Async { return_impl_trait_id , .. } = header. asyncness {
3140
- ids. push ( hir:: ItemId { id : return_impl_trait_id } ) ;
3129
+ if let Some ( id ) = header. asyncness . opt_return_id ( ) {
3130
+ ids. push ( hir:: ItemId { id } ) ;
3141
3131
}
3142
3132
self . lower_impl_trait_ids ( decl, & mut ids) ;
3143
3133
ids
@@ -3146,8 +3136,8 @@ impl<'a> LoweringContext<'a> {
3146
3136
let mut ids = SmallVector :: one ( hir:: ItemId { id : i. id } ) ;
3147
3137
for item in items {
3148
3138
if let ImplItemKind :: Method ( ref sig, _) = item. node {
3149
- if let IsAsync :: Async { return_impl_trait_id , .. } = sig. header . asyncness {
3150
- ids. push ( hir:: ItemId { id : return_impl_trait_id } ) ;
3139
+ if let Some ( id ) = sig. header . asyncness . opt_return_id ( ) {
3140
+ ids. push ( hir:: ItemId { id } ) ;
3151
3141
}
3152
3142
self . lower_impl_trait_ids ( & sig. decl , & mut ids) ;
3153
3143
}
0 commit comments