@@ -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,25 @@ 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 ! ( "types in generator {:?}, span = {:?}" , types , body. value. span) ;
143136
144137 // Replace all regions inside the generator interior with late bound regions
145138 // Note that each region slot in the types gets a new fresh late bound region,
146139 // which means that none of the regions inside relate to any other, even if
147140 // typeck had previously found constraints that would cause them to be related.
148141 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| {
150143 counter += 1 ;
151144 fcx. tcx . mk_region ( ty:: ReLateBound ( current_depth, ty:: BrAnon ( counter) ) )
152145 } ) ;
153146
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+
154154 let witness = fcx. tcx . mk_generator_witness ( ty:: Binder :: bind ( type_list) ) ;
155155
156156 debug ! ( "types in generator after region replacement {:?}, span = {:?}" ,
0 commit comments