@@ -290,7 +290,6 @@ pub(super) fn check_item<'tcx>(
290290 res
291291 }
292292 hir:: ItemKind :: Fn { sig, .. } => check_item_fn ( tcx, def_id, sig. decl ) ,
293- hir:: ItemKind :: Const ( _, _, ty, _) => check_const_item ( tcx, def_id, ty. span ) ,
294293 hir:: ItemKind :: Struct ( ..) => check_type_defn ( tcx, item, false ) ,
295294 hir:: ItemKind :: Union ( ..) => check_type_defn ( tcx, item, true ) ,
296295 hir:: ItemKind :: Enum ( ..) => check_type_defn ( tcx, item, true ) ,
@@ -1185,7 +1184,8 @@ pub(super) fn check_static_item(
11851184) -> Result < ( ) , ErrorGuaranteed > {
11861185 enter_wf_checking_ctxt ( tcx, item_id, |wfcx| {
11871186 let ty = tcx. type_of ( item_id) . instantiate_identity ( ) ;
1188- let item_ty = wfcx. deeply_normalize ( DUMMY_SP , Some ( WellFormedLoc :: Ty ( item_id) ) , ty) ;
1187+ let span = tcx. ty_span ( item_id) ;
1188+ let item_ty = wfcx. deeply_normalize ( span, Some ( WellFormedLoc :: Ty ( item_id) ) , ty) ;
11891189
11901190 let is_foreign_item = tcx. is_foreign_item ( item_id) ;
11911191
@@ -1194,7 +1194,7 @@ pub(super) fn check_static_item(
11941194 !matches ! ( tail. kind( ) , ty:: Foreign ( _) )
11951195 } ;
11961196
1197- wfcx. register_wf_obligation ( DUMMY_SP , Some ( WellFormedLoc :: Ty ( item_id) ) , item_ty. into ( ) ) ;
1197+ wfcx. register_wf_obligation ( span , Some ( WellFormedLoc :: Ty ( item_id) ) , item_ty. into ( ) ) ;
11981198 if forbid_unsized {
11991199 let span = tcx. def_span ( item_id) ;
12001200 wfcx. register_bound (
@@ -1216,7 +1216,6 @@ pub(super) fn check_static_item(
12161216 && !tcx. is_thread_local_static ( item_id. to_def_id ( ) ) ;
12171217
12181218 if should_check_for_sync {
1219- let span = tcx. def_span ( item_id) ;
12201219 wfcx. register_bound (
12211220 traits:: ObligationCause :: new (
12221221 span,
@@ -1232,13 +1231,10 @@ pub(super) fn check_static_item(
12321231 } )
12331232}
12341233
1235- fn check_const_item (
1236- tcx : TyCtxt < ' _ > ,
1237- def_id : LocalDefId ,
1238- ty_span : Span ,
1239- ) -> Result < ( ) , ErrorGuaranteed > {
1234+ pub ( crate ) fn check_const_item ( tcx : TyCtxt < ' _ > , def_id : LocalDefId ) -> Result < ( ) , ErrorGuaranteed > {
12401235 enter_wf_checking_ctxt ( tcx, def_id, |wfcx| {
12411236 let ty = tcx. type_of ( def_id) . instantiate_identity ( ) ;
1237+ let ty_span = tcx. ty_span ( def_id) ;
12421238 let ty = wfcx. deeply_normalize ( ty_span, Some ( WellFormedLoc :: Ty ( def_id) ) , ty) ;
12431239
12441240 wfcx. register_wf_obligation ( ty_span, Some ( WellFormedLoc :: Ty ( def_id) ) , ty. into ( ) ) ;
@@ -1505,7 +1501,7 @@ pub(super) fn check_where_clauses<'tcx>(wfcx: &WfCheckingCtxt<'_, 'tcx>, def_id:
15051501 let cause = traits:: ObligationCause :: new (
15061502 sp,
15071503 wfcx. body_def_id ,
1508- ObligationCauseCode :: WhereClause ( def_id. to_def_id ( ) , DUMMY_SP ) ,
1504+ ObligationCauseCode :: WhereClause ( def_id. to_def_id ( ) , sp ) ,
15091505 ) ;
15101506 Obligation :: new ( tcx, cause, wfcx. param_env , pred)
15111507 } ) ;
0 commit comments