@@ -16,7 +16,6 @@ use rustc_span::Span;
1616
1717struct InteriorVisitor < ' a , ' tcx > {
1818 fcx : & ' a FnCtxt < ' a , ' tcx > ,
19- closure_def_id : DefId ,
2019 types : FxHashMap < ty:: GeneratorInteriorTypeCause < ' tcx > , usize > ,
2120 region_scope_tree : & ' tcx region:: ScopeTree ,
2221 expr_count : usize ,
@@ -31,7 +30,6 @@ impl<'a, 'tcx> InteriorVisitor<'a, 'tcx> {
3130 scope : Option < region:: Scope > ,
3231 expr : Option < & ' tcx Expr < ' tcx > > ,
3332 source_span : Span ,
34- is_upvar : bool ,
3533 ) {
3634 use rustc_span:: DUMMY_SP ;
3735
@@ -119,20 +117,6 @@ impl<'a, 'tcx> InteriorVisitor<'a, 'tcx> {
119117 unresolved_type, unresolved_type_span
120118 ) ;
121119 self . prev_unresolved_span = unresolved_type_span;
122- } else {
123- if is_upvar {
124- let entries = self . types . len ( ) ;
125- let scope_span = scope. map ( |s| s. span ( self . fcx . tcx , self . region_scope_tree ) ) ;
126- self . types
127- . entry ( ty:: GeneratorInteriorTypeCause {
128- span : source_span,
129- ty : & ty,
130- scope_span,
131- yield_span : None ,
132- expr : expr. map ( |e| e. hir_id ) ,
133- } )
134- . or_insert ( entries) ;
135- }
136120 }
137121 }
138122 }
@@ -147,11 +131,8 @@ pub fn resolve_interior<'a, 'tcx>(
147131) {
148132 let body = fcx. tcx . hir ( ) . body ( body_id) ;
149133
150- let closure_def_id = fcx. tcx . hir ( ) . body_owner_def_id ( body_id) . to_def_id ( ) ;
151-
152134 let mut visitor = InteriorVisitor {
153135 fcx,
154- closure_def_id,
155136 types : FxHashMap :: default ( ) ,
156137 region_scope_tree : fcx. tcx . region_scope_tree ( def_id) ,
157138 expr_count : 0 ,
@@ -243,7 +224,7 @@ impl<'a, 'tcx> Visitor<'tcx> for InteriorVisitor<'a, 'tcx> {
243224 if let PatKind :: Binding ( ..) = pat. kind {
244225 let scope = self . region_scope_tree . var_scope ( pat. hir_id . local_id ) ;
245226 let ty = self . fcx . tables . borrow ( ) . pat_ty ( pat) ;
246- self . record ( ty, Some ( scope) , None , pat. span , false ) ;
227+ self . record ( ty, Some ( scope) , None , pat. span ) ;
247228 }
248229 }
249230
@@ -284,7 +265,7 @@ impl<'a, 'tcx> Visitor<'tcx> for InteriorVisitor<'a, 'tcx> {
284265 // If there are adjustments, then record the final type --
285266 // this is the actual value that is being produced.
286267 if let Some ( adjusted_ty) = self . fcx . tables . borrow ( ) . expr_ty_adjusted_opt ( expr) {
287- self . record ( adjusted_ty, scope, Some ( expr) , expr. span , false ) ;
268+ self . record ( adjusted_ty, scope, Some ( expr) , expr. span ) ;
288269 }
289270
290271 // Also record the unadjusted type (which is the only type if
@@ -312,17 +293,9 @@ impl<'a, 'tcx> Visitor<'tcx> for InteriorVisitor<'a, 'tcx> {
312293 // The type table might not have information for this expression
313294 // if it is in a malformed scope. (#66387)
314295 if let Some ( ty) = self . fcx . tables . borrow ( ) . expr_ty_opt ( expr) {
315- self . record ( ty, scope, Some ( expr) , expr. span , false ) ;
296+ self . record ( ty, scope, Some ( expr) , expr. span ) ;
316297 } else {
317298 self . fcx . tcx . sess . delay_span_bug ( expr. span , "no type for node" ) ;
318299 }
319-
320- if let Some ( upvars) = self . fcx . tcx . upvars ( self . closure_def_id ) {
321- for ( upvar_id, upvar) in upvars. iter ( ) {
322- let upvar_ty = self . fcx . tables . borrow ( ) . node_type ( * upvar_id) ;
323- debug ! ( "type of upvar: {:?}" , upvar_ty) ;
324- self . record ( upvar_ty, scope, Some ( expr) , upvar. span , true ) ;
325- }
326- }
327300 }
328301}
0 commit comments