@@ -991,7 +991,6 @@ fn check_associated_item(
991
991
match item. kind {
992
992
ty:: AssocKind :: Const => {
993
993
let ty = tcx. type_of ( item. def_id ) ;
994
- let ty = wfcx. normalize ( span, Some ( WellFormedLoc :: Ty ( item_id) ) , ty) ;
995
994
wfcx. register_wf_obligation ( span, loc, ty. into ( ) ) ;
996
995
}
997
996
ty:: AssocKind :: Fn => {
@@ -1012,7 +1011,6 @@ fn check_associated_item(
1012
1011
}
1013
1012
if item. defaultness ( tcx) . has_value ( ) {
1014
1013
let ty = tcx. type_of ( item. def_id ) ;
1015
- let ty = wfcx. normalize ( span, Some ( WellFormedLoc :: Ty ( item_id) ) , ty) ;
1016
1014
wfcx. register_wf_obligation ( span, loc, ty. into ( ) ) ;
1017
1015
}
1018
1016
}
@@ -1188,6 +1186,8 @@ fn check_item_type(tcx: TyCtxt<'_>, item_id: LocalDefId, ty_span: Span, allow_fo
1188
1186
1189
1187
enter_wf_checking_ctxt ( tcx, ty_span, item_id, |wfcx| {
1190
1188
let ty = tcx. type_of ( item_id) ;
1189
+ wfcx. register_wf_obligation ( ty_span, Some ( WellFormedLoc :: Ty ( item_id) ) , ty. into ( ) ) ;
1190
+
1191
1191
let item_ty = wfcx. normalize ( ty_span, Some ( WellFormedLoc :: Ty ( item_id) ) , ty) ;
1192
1192
1193
1193
let mut forbid_unsized = true ;
@@ -1197,8 +1197,6 @@ fn check_item_type(tcx: TyCtxt<'_>, item_id: LocalDefId, ty_span: Span, allow_fo
1197
1197
forbid_unsized = false ;
1198
1198
}
1199
1199
}
1200
-
1201
- wfcx. register_wf_obligation ( ty_span, Some ( WellFormedLoc :: Ty ( item_id) ) , item_ty. into ( ) ) ;
1202
1200
if forbid_unsized {
1203
1201
wfcx. register_bound (
1204
1202
traits:: ObligationCause :: new ( ty_span, wfcx. body_id , traits:: WellFormed ( None ) ) ,
@@ -1262,7 +1260,6 @@ fn check_impl<'tcx>(
1262
1260
}
1263
1261
None => {
1264
1262
let self_ty = tcx. type_of ( item. def_id ) ;
1265
- let self_ty = wfcx. normalize ( item. span , None , self_ty) ;
1266
1263
wfcx. register_wf_obligation (
1267
1264
ast_self_ty. span ,
1268
1265
Some ( WellFormedLoc :: Ty ( item. hir_id ( ) . expect_owner ( ) ) ) ,
@@ -1475,35 +1472,6 @@ fn check_fn_or_method<'tcx>(
1475
1472
let tcx = wfcx. tcx ( ) ;
1476
1473
let sig = tcx. liberate_late_bound_regions ( def_id. to_def_id ( ) , sig) ;
1477
1474
1478
- // Normalize the input and output types one at a time, using a different
1479
- // `WellFormedLoc` for each. We cannot call `normalize_associated_types`
1480
- // on the entire `FnSig`, since this would use the same `WellFormedLoc`
1481
- // for each type, preventing the HIR wf check from generating
1482
- // a nice error message.
1483
- let ty:: FnSig { mut inputs_and_output, c_variadic, unsafety, abi } = sig;
1484
- inputs_and_output = tcx. mk_type_list ( inputs_and_output. iter ( ) . enumerate ( ) . map ( |( i, ty) | {
1485
- wfcx. normalize (
1486
- span,
1487
- Some ( WellFormedLoc :: Param {
1488
- function : def_id,
1489
- // Note that the `param_idx` of the output type is
1490
- // one greater than the index of the last input type.
1491
- param_idx : i. try_into ( ) . unwrap ( ) ,
1492
- } ) ,
1493
- ty,
1494
- )
1495
- } ) ) ;
1496
- // Manually call `normalize_associated_types_in` on the other types
1497
- // in `FnSig`. This ensures that if the types of these fields
1498
- // ever change to include projections, we will start normalizing
1499
- // them automatically.
1500
- let sig = ty:: FnSig {
1501
- inputs_and_output,
1502
- c_variadic : wfcx. normalize ( span, None , c_variadic) ,
1503
- unsafety : wfcx. normalize ( span, None , unsafety) ,
1504
- abi : wfcx. normalize ( span, None , abi) ,
1505
- } ;
1506
-
1507
1475
for ( i, ( & input_ty, ty) ) in iter:: zip ( sig. inputs ( ) , hir_decl. inputs ) . enumerate ( ) {
1508
1476
wfcx. register_wf_obligation (
1509
1477
ty. span ,
@@ -1886,7 +1854,6 @@ impl<'a, 'tcx> WfCheckingCtxt<'a, 'tcx> {
1886
1854
. map ( |field| {
1887
1855
let def_id = self . tcx ( ) . hir ( ) . local_def_id ( field. hir_id ) ;
1888
1856
let field_ty = self . tcx ( ) . type_of ( def_id) ;
1889
- let field_ty = self . normalize ( field. ty . span , None , field_ty) ;
1890
1857
debug ! ( "non_enum_variant: type of field {:?} is {:?}" , field, field_ty) ;
1891
1858
AdtField { ty : field_ty, span : field. ty . span , def_id }
1892
1859
} )
0 commit comments