Skip to content

Commit b3ec77f

Browse files
committed
Avoid some eager uses of HIR spans
1 parent f4a1302 commit b3ec77f

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

compiler/rustc_hir_analysis/src/check/wfcheck.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -974,7 +974,7 @@ pub(crate) fn check_associated_item(
974974
let sig = tcx.fn_sig(item.def_id).instantiate_identity();
975975
let hir_sig =
976976
tcx.hir_node_by_def_id(item_id).fn_sig().expect("bad signature for method");
977-
check_fn_or_method(wfcx, sig, hir_sig.decl, item.def_id.expect_local());
977+
check_fn_or_method(wfcx, sig, hir_sig.decl, item_id);
978978
check_method_receiver(wfcx, hir_sig, item, self_ty)
979979
}
980980
ty::AssocKind::Type { .. } => {
@@ -1647,17 +1647,18 @@ fn check_method_receiver<'tcx>(
16471647
}
16481648

16491649
let span = fn_sig.decl.inputs[0].span;
1650+
let loc = Some(WellFormedLoc::Param { function: method.def_id.expect_local(), param_idx: 0 });
16501651

16511652
let sig = tcx.fn_sig(method.def_id).instantiate_identity();
16521653
let sig = tcx.liberate_late_bound_regions(method.def_id, sig);
1653-
let sig = wfcx.normalize(span, None, sig);
1654+
let sig = wfcx.normalize(DUMMY_SP, loc, sig);
16541655

16551656
debug!("check_method_receiver: sig={:?}", sig);
16561657

1657-
let self_ty = wfcx.normalize(span, None, self_ty);
1658+
let self_ty = wfcx.normalize(DUMMY_SP, loc, self_ty);
16581659

16591660
let receiver_ty = sig.inputs()[0];
1660-
let receiver_ty = wfcx.normalize(span, None, receiver_ty);
1661+
let receiver_ty = wfcx.normalize(DUMMY_SP, loc, receiver_ty);
16611662

16621663
// If the receiver already has errors reported, consider it valid to avoid
16631664
// unnecessary errors (#58712).

0 commit comments

Comments
 (0)