@@ -1711,7 +1711,6 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
1711
1711
self . add_obligations_for_parameters ( cause, & bounds) ;
1712
1712
1713
1713
let ty_substituted = self . instantiate_type_scheme ( path. span , substs, & ty) ;
1714
- self . write_ty ( node_id, ty_substituted) ;
1715
1714
self . write_substs ( node_id, ty:: ItemSubsts {
1716
1715
substs : substs
1717
1716
} ) ;
@@ -3190,12 +3189,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
3190
3189
}
3191
3190
3192
3191
fn check_struct_fields_on_error ( & self ,
3193
- id : ast:: NodeId ,
3194
3192
fields : & ' gcx [ hir:: Field ] ,
3195
- base_expr : & ' gcx Option < P < hir:: Expr > > ) -> Ty < ' tcx > {
3196
- // Make sure to still write the types
3197
- // otherwise we might ICE
3198
- let ty = self . write_error ( id) ;
3193
+ base_expr : & ' gcx Option < P < hir:: Expr > > ) {
3199
3194
for field in fields {
3200
3195
self . check_expr ( & field. expr ) ;
3201
3196
}
@@ -3205,7 +3200,6 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
3205
3200
} ,
3206
3201
None => { }
3207
3202
}
3208
- ty
3209
3203
}
3210
3204
3211
3205
pub fn check_struct_path ( & self ,
@@ -3262,7 +3256,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
3262
3256
expr. span ) {
3263
3257
variant_ty
3264
3258
} else {
3265
- return self . check_struct_fields_on_error ( expr. id , fields, base_expr) ;
3259
+ self . check_struct_fields_on_error ( fields, base_expr) ;
3260
+ return self . tcx ( ) . types . err ;
3266
3261
} ;
3267
3262
3268
3263
self . check_expr_struct_fields ( expr_t, path. span , variant, fields,
@@ -3286,6 +3281,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
3286
3281
}
3287
3282
}
3288
3283
}
3284
+ self . require_type_is_sized ( expr_t, expr. span , traits:: StructInitializerSized ) ;
3289
3285
expr_t
3290
3286
}
3291
3287
@@ -3690,9 +3686,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
3690
3686
}
3691
3687
hir:: ExprStruct ( ref path, ref fields, ref base_expr) => {
3692
3688
let ty = self . check_expr_struct ( expr, path, fields, base_expr) ;
3693
-
3694
- self . require_type_is_sized ( ty, expr. span , traits:: StructInitializerSized ) ;
3695
- ty
3689
+ self . write_ty ( id, ty)
3696
3690
}
3697
3691
hir:: ExprField ( ref base, ref field) => {
3698
3692
let ty = self . check_field ( expr, lvalue_pref, & base, field) ;
0 commit comments