@@ -288,7 +288,6 @@ pub(super) fn check_item<'tcx>(
288288 res
289289 }
290290 hir:: ItemKind :: Fn { sig, .. } => check_item_fn ( tcx, def_id, sig. decl ) ,
291- hir:: ItemKind :: Const ( _, _, ty, _) => check_const_item ( tcx, def_id, ty. span ) ,
292291 hir:: ItemKind :: Struct ( ..) => check_type_defn ( tcx, item, false ) ,
293292 hir:: ItemKind :: Union ( ..) => check_type_defn ( tcx, item, true ) ,
294293 hir:: ItemKind :: Enum ( ..) => check_type_defn ( tcx, item, true ) ,
@@ -1183,7 +1182,8 @@ pub(super) fn check_static_item(
11831182) -> Result < ( ) , ErrorGuaranteed > {
11841183 enter_wf_checking_ctxt ( tcx, item_id, |wfcx| {
11851184 let ty = tcx. type_of ( item_id) . instantiate_identity ( ) ;
1186- let item_ty = wfcx. deeply_normalize ( DUMMY_SP , Some ( WellFormedLoc :: Ty ( item_id) ) , ty) ;
1185+ let span = tcx. ty_span ( item_id) ;
1186+ let item_ty = wfcx. deeply_normalize ( span, Some ( WellFormedLoc :: Ty ( item_id) ) , ty) ;
11871187
11881188 let is_foreign_item = tcx. is_foreign_item ( item_id) ;
11891189
@@ -1192,7 +1192,7 @@ pub(super) fn check_static_item(
11921192 !matches ! ( tail. kind( ) , ty:: Foreign ( _) )
11931193 } ;
11941194
1195- wfcx. register_wf_obligation ( DUMMY_SP , Some ( WellFormedLoc :: Ty ( item_id) ) , item_ty. into ( ) ) ;
1195+ wfcx. register_wf_obligation ( span , Some ( WellFormedLoc :: Ty ( item_id) ) , item_ty. into ( ) ) ;
11961196 if forbid_unsized {
11971197 let span = tcx. def_span ( item_id) ;
11981198 wfcx. register_bound (
@@ -1214,7 +1214,6 @@ pub(super) fn check_static_item(
12141214 && !tcx. is_thread_local_static ( item_id. to_def_id ( ) ) ;
12151215
12161216 if should_check_for_sync {
1217- let span = tcx. def_span ( item_id) ;
12181217 wfcx. register_bound (
12191218 traits:: ObligationCause :: new (
12201219 span,
@@ -1230,13 +1229,10 @@ pub(super) fn check_static_item(
12301229 } )
12311230}
12321231
1233- fn check_const_item (
1234- tcx : TyCtxt < ' _ > ,
1235- def_id : LocalDefId ,
1236- ty_span : Span ,
1237- ) -> Result < ( ) , ErrorGuaranteed > {
1232+ pub ( crate ) fn check_const_item ( tcx : TyCtxt < ' _ > , def_id : LocalDefId ) -> Result < ( ) , ErrorGuaranteed > {
12381233 enter_wf_checking_ctxt ( tcx, def_id, |wfcx| {
12391234 let ty = tcx. type_of ( def_id) . instantiate_identity ( ) ;
1235+ let ty_span = tcx. ty_span ( def_id) ;
12401236 let ty = wfcx. deeply_normalize ( ty_span, Some ( WellFormedLoc :: Ty ( def_id) ) , ty) ;
12411237
12421238 wfcx. register_wf_obligation ( ty_span, Some ( WellFormedLoc :: Ty ( def_id) ) , ty. into ( ) ) ;
@@ -1503,7 +1499,7 @@ pub(super) fn check_where_clauses<'tcx>(wfcx: &WfCheckingCtxt<'_, 'tcx>, def_id:
15031499 let cause = traits:: ObligationCause :: new (
15041500 sp,
15051501 wfcx. body_def_id ,
1506- ObligationCauseCode :: WhereClause ( def_id. to_def_id ( ) , DUMMY_SP ) ,
1502+ ObligationCauseCode :: WhereClause ( def_id. to_def_id ( ) , sp ) ,
15071503 ) ;
15081504 Obligation :: new ( tcx, cause, wfcx. param_env , pred)
15091505 } ) ;
0 commit comments