@@ -3115,25 +3115,25 @@ fn bind_generator_hidden_types_above<'tcx>(
3115
3115
. generator_hidden_types ( def_id)
3116
3116
// Deduplicate tys to avoid repeated work.
3117
3117
. filter ( |bty| seen_tys. insert ( * bty) )
3118
- . map ( |bty| {
3119
- let mut ty = bty. instantiate ( tcx, args) ;
3120
-
3118
+ . map ( |mut bty| {
3121
3119
// Only remap erased regions if we use them.
3122
3120
if considering_regions {
3123
- ty = tcx. fold_regions ( ty, |r, current_depth| match r. kind ( ) {
3124
- ty:: ReErased => {
3125
- let br = ty:: BoundRegion {
3126
- var : ty:: BoundVar :: from_u32 ( counter) ,
3127
- kind : ty:: BrAnon ( None ) ,
3128
- } ;
3129
- counter += 1 ;
3130
- ty:: Region :: new_late_bound ( tcx, current_depth, br)
3131
- }
3132
- r => bug ! ( "unexpected region: {r:?}" ) ,
3121
+ bty = bty. map_bound ( |ty| {
3122
+ tcx. fold_regions ( ty, |r, current_depth| match r. kind ( ) {
3123
+ ty:: ReErased => {
3124
+ let br = ty:: BoundRegion {
3125
+ var : ty:: BoundVar :: from_u32 ( counter) ,
3126
+ kind : ty:: BrAnon ( None ) ,
3127
+ } ;
3128
+ counter += 1 ;
3129
+ ty:: Region :: new_late_bound ( tcx, current_depth, br)
3130
+ }
3131
+ r => bug ! ( "unexpected region: {r:?}" ) ,
3132
+ } )
3133
3133
} )
3134
3134
}
3135
3135
3136
- ty
3136
+ bty . instantiate ( tcx , args )
3137
3137
} )
3138
3138
. collect ( ) ;
3139
3139
if considering_regions {
0 commit comments