@@ -123,13 +123,6 @@ pub fn resolve_interior<'a, 'tcx>(
123123 // Sort types by insertion order
124124 types. sort_by_key ( |t| t. 1 ) ;
125125
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-
133126 // The types in the generator interior contain lifetimes local to the generator itself,
134127 // which should not be exposed outside of the generator. Therefore, we replace these
135128 // lifetimes with existentially-bound lifetimes, which reflect the exact value of the
@@ -139,18 +132,29 @@ pub fn resolve_interior<'a, 'tcx>(
139132 // if a Sync generator contains an &'α T, we need to check whether &'α T: Sync),
140133 // so knowledge of the exact relationships between them isn't particularly important.
141134
142- debug ! ( "types in generator {:?}, span = {:?}" , type_list, body. value. span) ;
135+ debug ! (
136+ "types in generator {:?}, span = {:?}" ,
137+ types. iter( ) . map( |t| ( t. 0 ) . ty) . collect:: <Vec <_>>( ) ,
138+ body. value. span,
139+ ) ;
143140
144141 // Replace all regions inside the generator interior with late bound regions
145142 // Note that each region slot in the types gets a new fresh late bound region,
146143 // which means that none of the regions inside relate to any other, even if
147144 // typeck had previously found constraints that would cause them to be related.
148145 let mut counter = 0 ;
149- let type_list = fcx. tcx . fold_regions ( & type_list , & mut false , |_, current_depth| {
146+ let types = fcx. tcx . fold_regions ( & types , & mut false , |_, current_depth| {
150147 counter += 1 ;
151148 fcx. tcx . mk_region ( ty:: ReLateBound ( current_depth, ty:: BrAnon ( counter) ) )
152149 } ) ;
153150
151+ // Store the generator types and spans into the tables for this generator.
152+ let interior_types = types. iter ( ) . map ( |t| t. 0 . clone ( ) ) . collect :: < Vec < _ > > ( ) ;
153+ visitor. fcx . inh . tables . borrow_mut ( ) . generator_interior_types = interior_types;
154+
155+ // Extract type components
156+ let type_list = fcx. tcx . mk_type_list ( types. into_iter ( ) . map ( |t| ( t. 0 ) . ty ) ) ;
157+
154158 let witness = fcx. tcx . mk_generator_witness ( ty:: Binder :: bind ( type_list) ) ;
155159
156160 debug ! ( "types in generator after region replacement {:?}, span = {:?}" ,
0 commit comments