@@ -290,7 +290,6 @@ pub(super) fn check_item<'tcx>(
290
290
res
291
291
}
292
292
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 ) ,
294
293
hir:: ItemKind :: Struct ( ..) => check_type_defn ( tcx, item, false ) ,
295
294
hir:: ItemKind :: Union ( ..) => check_type_defn ( tcx, item, true ) ,
296
295
hir:: ItemKind :: Enum ( ..) => check_type_defn ( tcx, item, true ) ,
@@ -1185,7 +1184,8 @@ pub(super) fn check_static_item(
1185
1184
) -> Result < ( ) , ErrorGuaranteed > {
1186
1185
enter_wf_checking_ctxt ( tcx, item_id, |wfcx| {
1187
1186
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) ;
1189
1189
1190
1190
let is_foreign_item = tcx. is_foreign_item ( item_id) ;
1191
1191
@@ -1194,7 +1194,7 @@ pub(super) fn check_static_item(
1194
1194
!matches ! ( tail. kind( ) , ty:: Foreign ( _) )
1195
1195
} ;
1196
1196
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 ( ) ) ;
1198
1198
if forbid_unsized {
1199
1199
let span = tcx. def_span ( item_id) ;
1200
1200
wfcx. register_bound (
@@ -1216,7 +1216,6 @@ pub(super) fn check_static_item(
1216
1216
&& !tcx. is_thread_local_static ( item_id. to_def_id ( ) ) ;
1217
1217
1218
1218
if should_check_for_sync {
1219
- let span = tcx. def_span ( item_id) ;
1220
1219
wfcx. register_bound (
1221
1220
traits:: ObligationCause :: new (
1222
1221
span,
@@ -1232,13 +1231,10 @@ pub(super) fn check_static_item(
1232
1231
} )
1233
1232
}
1234
1233
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 > {
1240
1235
enter_wf_checking_ctxt ( tcx, def_id, |wfcx| {
1241
1236
let ty = tcx. type_of ( def_id) . instantiate_identity ( ) ;
1237
+ let ty_span = tcx. ty_span ( def_id) ;
1242
1238
let ty = wfcx. deeply_normalize ( ty_span, Some ( WellFormedLoc :: Ty ( def_id) ) , ty) ;
1243
1239
1244
1240
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:
1505
1501
let cause = traits:: ObligationCause :: new (
1506
1502
sp,
1507
1503
wfcx. body_def_id ,
1508
- ObligationCauseCode :: WhereClause ( def_id. to_def_id ( ) , DUMMY_SP ) ,
1504
+ ObligationCauseCode :: WhereClause ( def_id. to_def_id ( ) , sp ) ,
1509
1505
) ;
1510
1506
Obligation :: new ( tcx, cause, wfcx. param_env , pred)
1511
1507
} ) ;
0 commit comments