@@ -123,13 +123,6 @@ pub fn resolve_interior<'a, 'tcx>(
123
123
// Sort types by insertion order
124
124
types. sort_by_key ( |t| t. 1 ) ;
125
125
126
- // Store the generator types and spans into the tables for this generator.
127
- let interior_types = types. iter ( ) . cloned ( ) . map ( |t| t. 0 ) . collect :: < Vec < _ > > ( ) ;
128
- visitor. fcx . inh . tables . borrow_mut ( ) . generator_interior_types = interior_types;
129
-
130
- // Extract type components
131
- let type_list = fcx. tcx . mk_type_list ( types. into_iter ( ) . map ( |t| ( t. 0 ) . ty ) ) ;
132
-
133
126
// The types in the generator interior contain lifetimes local to the generator itself,
134
127
// which should not be exposed outside of the generator. Therefore, we replace these
135
128
// lifetimes with existentially-bound lifetimes, which reflect the exact value of the
@@ -139,18 +132,25 @@ pub fn resolve_interior<'a, 'tcx>(
139
132
// if a Sync generator contains an &'α T, we need to check whether &'α T: Sync),
140
133
// so knowledge of the exact relationships between them isn't particularly important.
141
134
142
- debug ! ( "types in generator {:?}, span = {:?}" , type_list , body. value. span) ;
135
+ debug ! ( "types in generator {:?}, span = {:?}" , types , body. value. span) ;
143
136
144
137
// Replace all regions inside the generator interior with late bound regions
145
138
// Note that each region slot in the types gets a new fresh late bound region,
146
139
// which means that none of the regions inside relate to any other, even if
147
140
// typeck had previously found constraints that would cause them to be related.
148
141
let mut counter = 0 ;
149
- let type_list = fcx. tcx . fold_regions ( & type_list , & mut false , |_, current_depth| {
142
+ let types = fcx. tcx . fold_regions ( & types , & mut false , |_, current_depth| {
150
143
counter += 1 ;
151
144
fcx. tcx . mk_region ( ty:: ReLateBound ( current_depth, ty:: BrAnon ( counter) ) )
152
145
} ) ;
153
146
147
+ // Store the generator types and spans into the tables for this generator.
148
+ let interior_types = types. iter ( ) . map ( |t| t. 0 . clone ( ) ) . collect :: < Vec < _ > > ( ) ;
149
+ visitor. fcx . inh . tables . borrow_mut ( ) . generator_interior_types = interior_types;
150
+
151
+ // Extract type components
152
+ let type_list = fcx. tcx . mk_type_list ( types. into_iter ( ) . map ( |t| ( t. 0 ) . ty ) ) ;
153
+
154
154
let witness = fcx. tcx . mk_generator_witness ( ty:: Binder :: bind ( type_list) ) ;
155
155
156
156
debug ! ( "types in generator after region replacement {:?}, span = {:?}" ,
0 commit comments