@@ -43,6 +43,7 @@ pub fn resolve_type_vars_in_expr(fcx: &FnCtxt, e: &hir::Expr) {
43
43
wbcx. visit_upvar_borrow_map ( ) ;
44
44
wbcx. visit_closures ( ) ;
45
45
wbcx. visit_liberated_fn_sigs ( ) ;
46
+ wbcx. visit_fru_field_types ( ) ;
46
47
}
47
48
48
49
pub fn resolve_type_vars_in_fn ( fcx : & FnCtxt ,
@@ -64,6 +65,7 @@ pub fn resolve_type_vars_in_fn(fcx: &FnCtxt,
64
65
wbcx. visit_upvar_borrow_map ( ) ;
65
66
wbcx. visit_closures ( ) ;
66
67
wbcx. visit_liberated_fn_sigs ( ) ;
68
+ wbcx. visit_fru_field_types ( ) ;
67
69
}
68
70
69
71
///////////////////////////////////////////////////////////////////////////
@@ -371,6 +373,13 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> {
371
373
}
372
374
}
373
375
376
+ fn visit_fru_field_types ( & self ) {
377
+ for ( & node_id, ftys) in self . fcx . inh . tables . borrow ( ) . fru_field_types . iter ( ) {
378
+ let ftys = self . resolve ( ftys, ResolvingFieldTypes ( node_id) ) ;
379
+ self . tcx ( ) . tables . borrow_mut ( ) . fru_field_types . insert ( node_id, ftys) ;
380
+ }
381
+ }
382
+
374
383
fn resolve < T : TypeFoldable < ' tcx > > ( & self , t : & T , reason : ResolveReason ) -> T {
375
384
t. fold_with ( & mut Resolver :: new ( self . fcx , reason) )
376
385
}
@@ -387,6 +396,7 @@ enum ResolveReason {
387
396
ResolvingUpvar ( ty:: UpvarId ) ,
388
397
ResolvingClosure ( DefId ) ,
389
398
ResolvingFnSig ( ast:: NodeId ) ,
399
+ ResolvingFieldTypes ( ast:: NodeId )
390
400
}
391
401
392
402
impl ResolveReason {
@@ -401,6 +411,9 @@ impl ResolveReason {
401
411
ResolvingFnSig ( id) => {
402
412
tcx. map . span ( id)
403
413
}
414
+ ResolvingFieldTypes ( id) => {
415
+ tcx. map . span ( id)
416
+ }
404
417
ResolvingClosure ( did) => {
405
418
if let Some ( node_id) = tcx. map . as_local_node_id ( did) {
406
419
tcx. expr_span ( node_id)
@@ -478,14 +491,14 @@ impl<'cx, 'tcx> Resolver<'cx, 'tcx> {
478
491
"cannot determine a type for this closure" )
479
492
}
480
493
481
- ResolvingFnSig ( id) => {
494
+ ResolvingFnSig ( id) | ResolvingFieldTypes ( id ) => {
482
495
// any failures here should also fail when
483
496
// resolving the patterns, closure types, or
484
497
// something else.
485
498
let span = self . reason . span ( self . tcx ) ;
486
499
self . tcx . sess . delay_span_bug (
487
500
span,
488
- & format ! ( "cannot resolve some aspect of fn sig for {:?}" , id) ) ;
501
+ & format ! ( "cannot resolve some aspect of data for {:?}" , id) ) ;
489
502
}
490
503
}
491
504
}
0 commit comments