Skip to content

Commit 65aac24

Browse files
committed
Avoid some eager uses of HIR spans
1 parent 5ddae35 commit 65aac24

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
@@ -978,7 +978,7 @@ pub(crate) fn check_associated_item(
978978
let sig = tcx.fn_sig(item.def_id).instantiate_identity();
979979
let hir_sig =
980980
tcx.hir_node_by_def_id(item_id).fn_sig().expect("bad signature for method");
981-
check_fn_or_method(wfcx, sig, hir_sig.decl, item.def_id.expect_local());
981+
check_fn_or_method(wfcx, sig, hir_sig.decl, item_id);
982982
check_method_receiver(wfcx, hir_sig, item, self_ty)
983983
}
984984
ty::AssocKind::Type { .. } => {
@@ -1655,17 +1655,18 @@ fn check_method_receiver<'tcx>(
16551655
}
16561656

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

16591660
let sig = tcx.fn_sig(method.def_id).instantiate_identity();
16601661
let sig = tcx.liberate_late_bound_regions(method.def_id, sig);
1661-
let sig = wfcx.normalize(span, None, sig);
1662+
let sig = wfcx.normalize(DUMMY_SP, loc, sig);
16621663

16631664
debug!("check_method_receiver: sig={:?}", sig);
16641665

1665-
let self_ty = wfcx.normalize(span, None, self_ty);
1666+
let self_ty = wfcx.normalize(DUMMY_SP, loc, self_ty);
16661667

16671668
let receiver_ty = sig.inputs()[0];
1668-
let receiver_ty = wfcx.normalize(span, None, receiver_ty);
1669+
let receiver_ty = wfcx.normalize(DUMMY_SP, loc, receiver_ty);
16691670

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

0 commit comments

Comments
 (0)