Skip to content

Commit 3599231

Browse files
committed
Avoid some eager uses of HIR spans
1 parent 7d05de4 commit 3599231

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 { .. } => {
@@ -1653,17 +1653,18 @@ fn check_method_receiver<'tcx>(
16531653
}
16541654

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

16571658
let sig = tcx.fn_sig(method.def_id).instantiate_identity();
16581659
let sig = tcx.liberate_late_bound_regions(method.def_id, sig);
1659-
let sig = wfcx.normalize(span, None, sig);
1660+
let sig = wfcx.normalize(DUMMY_SP, loc, sig);
16601661

16611662
debug!("check_method_receiver: sig={:?}", sig);
16621663

1663-
let self_ty = wfcx.normalize(span, None, self_ty);
1664+
let self_ty = wfcx.normalize(DUMMY_SP, loc, self_ty);
16641665

16651666
let receiver_ty = sig.inputs()[0];
1666-
let receiver_ty = wfcx.normalize(span, None, receiver_ty);
1667+
let receiver_ty = wfcx.normalize(DUMMY_SP, loc, receiver_ty);
16671668

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

0 commit comments

Comments
 (0)