@@ -991,7 +991,6 @@ fn check_associated_item(
991991 match item. kind {
992992 ty:: AssocKind :: Const => {
993993 let ty = tcx. type_of ( item. def_id ) ;
994- let ty = wfcx. normalize ( span, Some ( WellFormedLoc :: Ty ( item_id) ) , ty) ;
995994 wfcx. register_wf_obligation ( span, loc, ty. into ( ) ) ;
996995 }
997996 ty:: AssocKind :: Fn => {
@@ -1012,7 +1011,6 @@ fn check_associated_item(
10121011 }
10131012 if item. defaultness ( tcx) . has_value ( ) {
10141013 let ty = tcx. type_of ( item. def_id ) ;
1015- let ty = wfcx. normalize ( span, Some ( WellFormedLoc :: Ty ( item_id) ) , ty) ;
10161014 wfcx. register_wf_obligation ( span, loc, ty. into ( ) ) ;
10171015 }
10181016 }
@@ -1188,6 +1186,8 @@ fn check_item_type(tcx: TyCtxt<'_>, item_id: LocalDefId, ty_span: Span, allow_fo
11881186
11891187 enter_wf_checking_ctxt ( tcx, ty_span, item_id, |wfcx| {
11901188 let ty = tcx. type_of ( item_id) ;
1189+ wfcx. register_wf_obligation ( ty_span, Some ( WellFormedLoc :: Ty ( item_id) ) , ty. into ( ) ) ;
1190+
11911191 let item_ty = wfcx. normalize ( ty_span, Some ( WellFormedLoc :: Ty ( item_id) ) , ty) ;
11921192
11931193 let mut forbid_unsized = true ;
@@ -1197,8 +1197,6 @@ fn check_item_type(tcx: TyCtxt<'_>, item_id: LocalDefId, ty_span: Span, allow_fo
11971197 forbid_unsized = false ;
11981198 }
11991199 }
1200-
1201- wfcx. register_wf_obligation ( ty_span, Some ( WellFormedLoc :: Ty ( item_id) ) , item_ty. into ( ) ) ;
12021200 if forbid_unsized {
12031201 wfcx. register_bound (
12041202 traits:: ObligationCause :: new ( ty_span, wfcx. body_id , traits:: WellFormed ( None ) ) ,
@@ -1262,7 +1260,6 @@ fn check_impl<'tcx>(
12621260 }
12631261 None => {
12641262 let self_ty = tcx. type_of ( item. def_id ) ;
1265- let self_ty = wfcx. normalize ( item. span , None , self_ty) ;
12661263 wfcx. register_wf_obligation (
12671264 ast_self_ty. span ,
12681265 Some ( WellFormedLoc :: Ty ( item. hir_id ( ) . expect_owner ( ) ) ) ,
@@ -1475,35 +1472,6 @@ fn check_fn_or_method<'tcx>(
14751472 let tcx = wfcx. tcx ( ) ;
14761473 let sig = tcx. liberate_late_bound_regions ( def_id. to_def_id ( ) , sig) ;
14771474
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-
15071475 for ( i, ( & input_ty, ty) ) in iter:: zip ( sig. inputs ( ) , hir_decl. inputs ) . enumerate ( ) {
15081476 wfcx. register_wf_obligation (
15091477 ty. span ,
@@ -1886,7 +1854,6 @@ impl<'a, 'tcx> WfCheckingCtxt<'a, 'tcx> {
18861854 . map ( |field| {
18871855 let def_id = self . tcx ( ) . hir ( ) . local_def_id ( field. hir_id ) ;
18881856 let field_ty = self . tcx ( ) . type_of ( def_id) ;
1889- let field_ty = self . normalize ( field. ty . span , None , field_ty) ;
18901857 debug ! ( "non_enum_variant: type of field {:?} is {:?}" , field, field_ty) ;
18911858 AdtField { ty : field_ty, span : field. ty . span , def_id }
18921859 } )
0 commit comments