Skip to content

Commit 3acb261

Browse files
committed
Auto merge of #118256 - petrochenkov:nohir, r=compiler-errors
rustc: `hir().local_def_id_to_hir_id()` -> `tcx.local_def_id_to_hir_id()` cleanup Noticed this while working on #118188. The history here is that the method was moved from HIR map to tcx in #93373 as a part of incremental compilation work, so it's unlikely to go back.
2 parents 274b524 + c697927 commit 3acb261

File tree

110 files changed

+189
-199
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+189
-199
lines changed

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
413413
(None, &[][..], 0)
414414
};
415415
if let Some(def_id) = def_id
416-
&& let Some(node) = hir.find(hir.local_def_id_to_hir_id(def_id))
416+
&& let Some(node) = hir.find(self.infcx.tcx.local_def_id_to_hir_id(def_id))
417417
&& let Some(fn_sig) = node.fn_sig()
418418
&& let Some(ident) = node.ident()
419419
&& let Some(pos) = args.iter().position(|arg| arg.hir_id == expr.hir_id)
@@ -3243,7 +3243,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
32433243
) -> Option<AnnotatedBorrowFnSignature<'tcx>> {
32443244
debug!("annotate_fn_sig: did={:?} sig={:?}", did, sig);
32453245
let is_closure = self.infcx.tcx.is_closure(did.to_def_id());
3246-
let fn_hir_id = self.infcx.tcx.hir().local_def_id_to_hir_id(did);
3246+
let fn_hir_id = self.infcx.tcx.local_def_id_to_hir_id(did);
32473247
let fn_decl = self.infcx.tcx.hir().fn_decl_by_hir_id(fn_hir_id)?;
32483248

32493249
// We need to work out which arguments to highlight. We do this by looking

compiler/rustc_borrowck/src/diagnostics/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -958,7 +958,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
958958
"closure_span: def_id={:?} target_place={:?} places={:?}",
959959
def_id, target_place, places
960960
);
961-
let hir_id = self.infcx.tcx.hir().local_def_id_to_hir_id(def_id);
961+
let hir_id = self.infcx.tcx.local_def_id_to_hir_id(def_id);
962962
let expr = &self.infcx.tcx.hir().expect_expr(hir_id).kind;
963963
debug!("closure_span: hir_id={:?} expr={:?}", hir_id, expr);
964964
if let hir::ExprKind::Closure(&hir::Closure { body, fn_decl_span, .. }) = expr {

compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
661661
}
662662
let hir_map = self.infcx.tcx.hir();
663663
let my_def = self.body.source.def_id();
664-
let my_hir = hir_map.local_def_id_to_hir_id(my_def.as_local().unwrap());
664+
let my_hir = self.infcx.tcx.local_def_id_to_hir_id(my_def.as_local().unwrap());
665665
let Some(td) =
666666
self.infcx.tcx.impl_of_method(my_def).and_then(|x| self.infcx.tcx.trait_id_of_impl(x))
667667
else {

compiler/rustc_borrowck/src/diagnostics/region_errors.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
215215
.map(|placeholder| {
216216
if let Some(id) = placeholder.bound.kind.get_id()
217217
&& let Some(placeholder_id) = id.as_local()
218-
&& let gat_hir_id = hir.local_def_id_to_hir_id(placeholder_id)
218+
&& let gat_hir_id = self.infcx.tcx.local_def_id_to_hir_id(placeholder_id)
219219
&& let Some(generics_impl) = hir.get_parent(gat_hir_id).generics()
220220
{
221221
Some((gat_hir_id, generics_impl))
@@ -236,7 +236,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
236236
};
237237
if bound_generic_params
238238
.iter()
239-
.rfind(|bgp| hir.local_def_id_to_hir_id(bgp.def_id) == *gat_hir_id)
239+
.rfind(|bgp| self.infcx.tcx.local_def_id_to_hir_id(bgp.def_id) == *gat_hir_id)
240240
.is_some()
241241
{
242242
for bound in *bounds {

compiler/rustc_borrowck/src/diagnostics/region_name.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
199199
}
200200

201201
pub(crate) fn mir_hir_id(&self) -> hir::HirId {
202-
self.infcx.tcx.hir().local_def_id_to_hir_id(self.mir_def_id())
202+
self.infcx.tcx.local_def_id_to_hir_id(self.mir_def_id())
203203
}
204204

205205
/// Generate a synthetic region named `'N`, where `N` is the next value of the counter. Then,

compiler/rustc_borrowck/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ fn mir_borrowck(tcx: TyCtxt<'_>, def: LocalDefId) -> &BorrowCheckResult<'_> {
134134
return tcx.arena.alloc(result);
135135
}
136136

137-
let hir_owner = tcx.hir().local_def_id_to_hir_id(def).owner;
137+
let hir_owner = tcx.local_def_id_to_hir_id(def).owner;
138138

139139
let infcx =
140140
tcx.infer_ctxt().with_opaque_type_inference(DefiningAnchor::Bind(hir_owner.def_id)).build();

compiler/rustc_borrowck/src/universal_regions.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,7 @@ fn for_each_late_bound_region_in_item<'tcx>(
928928
return;
929929
}
930930

931-
for bound_var in tcx.late_bound_vars(tcx.hir().local_def_id_to_hir_id(mir_def_id)) {
931+
for bound_var in tcx.late_bound_vars(tcx.local_def_id_to_hir_id(mir_def_id)) {
932932
let ty::BoundVariableKind::Region(bound_region) = bound_var else {
933933
continue;
934934
};

compiler/rustc_codegen_ssa/src/codegen_attrs.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
5757
);
5858
}
5959

60-
let attrs = tcx.hir().attrs(tcx.hir().local_def_id_to_hir_id(did));
60+
let attrs = tcx.hir().attrs(tcx.local_def_id_to_hir_id(did));
6161
let mut codegen_fn_attrs = CodegenFnAttrs::new();
6262
if tcx.should_inherit_track_caller(did) {
6363
codegen_fn_attrs.flags |= CodegenFnAttrFlags::TRACK_CALLER;
@@ -572,7 +572,7 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
572572
if !codegen_fn_attrs.no_sanitize.is_empty() {
573573
if codegen_fn_attrs.inline == InlineAttr::Always {
574574
if let (Some(no_sanitize_span), Some(inline_span)) = (no_sanitize_span, inline_span) {
575-
let hir_id = tcx.hir().local_def_id_to_hir_id(did);
575+
let hir_id = tcx.local_def_id_to_hir_id(did);
576576
tcx.struct_span_lint_hir(
577577
lint::builtin::INLINE_NO_SANITIZE,
578578
hir_id,

compiler/rustc_const_eval/src/interpret/eval_context.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
456456
self.stack()
457457
.iter()
458458
.find_map(|frame| frame.body.source.def_id().as_local())
459-
.map_or(CRATE_HIR_ID, |def_id| self.tcx.hir().local_def_id_to_hir_id(def_id))
459+
.map_or(CRATE_HIR_ID, |def_id| self.tcx.local_def_id_to_hir_id(def_id))
460460
}
461461

462462
/// Turn the given error into a human-readable string. Expects the string to be printed, so if

compiler/rustc_const_eval/src/transform/check_consts/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ pub fn rustc_allow_const_fn_unstable(
8282
def_id: LocalDefId,
8383
feature_gate: Symbol,
8484
) -> bool {
85-
let attrs = tcx.hir().attrs(tcx.hir().local_def_id_to_hir_id(def_id));
85+
let attrs = tcx.hir().attrs(tcx.local_def_id_to_hir_id(def_id));
8686
attr::rustc_allow_const_fn_unstable(tcx.sess, attrs).any(|name| name == feature_gate)
8787
}
8888

compiler/rustc_const_eval/src/transform/check_consts/ops.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ impl<'tcx> NonConstOp<'tcx> for FnCallNonConst<'tcx> {
119119
match self_ty.kind() {
120120
Param(param_ty) => {
121121
debug!(?param_ty);
122-
let caller_hir_id = tcx.hir().local_def_id_to_hir_id(caller);
122+
let caller_hir_id = tcx.local_def_id_to_hir_id(caller);
123123
if let Some(generics) = tcx.hir().get(caller_hir_id).generics() {
124124
let constraint = with_no_trimmed_paths!(format!(
125125
"~const {}",

compiler/rustc_hir_analysis/src/astconv/errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
201201
);
202202
let hir = self.tcx().hir();
203203
if let Some(def_id) = ty_param_def_id
204-
&& let parent = hir.get_parent_item(hir.local_def_id_to_hir_id(def_id))
204+
&& let parent = hir.get_parent_item(self.tcx().local_def_id_to_hir_id(def_id))
205205
&& let Some(generics) = hir.get_generics(parent.def_id)
206206
{
207207
if generics.bounds_for_param(def_id).flat_map(|pred| pred.bounds.iter()).any(

compiler/rustc_hir_analysis/src/astconv/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
239239
def: Option<&ty::GenericParamDef>,
240240
) -> ty::Region<'tcx> {
241241
let tcx = self.tcx();
242-
let lifetime_name = |def_id| tcx.hir().name(tcx.hir().local_def_id_to_hir_id(def_id));
242+
let lifetime_name = |def_id| tcx.hir().name(tcx.local_def_id_to_hir_id(def_id));
243243

244244
match tcx.named_bound_var(lifetime.hir_id) {
245245
Some(rbv::ResolvedArg::StaticLifetime) => tcx.lifetimes.re_static,
@@ -1872,7 +1872,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
18721872

18731873
let parent_def_id = def_id
18741874
.as_local()
1875-
.map(|def_id| tcx.hir().local_def_id_to_hir_id(def_id))
1875+
.map(|def_id| tcx.local_def_id_to_hir_id(def_id))
18761876
.map(|hir_id| tcx.hir().get_parent_item(hir_id).to_def_id());
18771877

18781878
debug!("qpath_to_ty: parent_def_id={:?}", parent_def_id);

compiler/rustc_hir_analysis/src/check/check.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ fn check_static_inhabited(tcx: TyCtxt<'_>, def_id: LocalDefId) {
188188
if layout.abi.is_uninhabited() {
189189
tcx.struct_span_lint_hir(
190190
UNINHABITED_STATIC,
191-
tcx.hir().local_def_id_to_hir_id(def_id),
191+
tcx.local_def_id_to_hir_id(def_id),
192192
span,
193193
"static of uninhabited type",
194194
|lint| {
@@ -753,8 +753,7 @@ fn check_impl_items_against_trait<'tcx>(
753753
leaf_def.as_ref().is_some_and(|node_item| !node_item.defining_node.is_from_trait());
754754

755755
if !is_implemented_here {
756-
let full_impl_span =
757-
tcx.hir().span_with_body(tcx.hir().local_def_id_to_hir_id(impl_id));
756+
let full_impl_span = tcx.hir().span_with_body(tcx.local_def_id_to_hir_id(impl_id));
758757
match tcx.eval_default_body_stability(trait_item_id, full_impl_span) {
759758
EvalResult::Deny { feature, reason, issue, .. } => default_body_is_unstable(
760759
tcx,
@@ -811,8 +810,7 @@ fn check_impl_items_against_trait<'tcx>(
811810
}
812811

813812
if !missing_items.is_empty() {
814-
let full_impl_span =
815-
tcx.hir().span_with_body(tcx.hir().local_def_id_to_hir_id(impl_id));
813+
let full_impl_span = tcx.hir().span_with_body(tcx.local_def_id_to_hir_id(impl_id));
816814
missing_items_err(tcx, impl_id, &missing_items, full_impl_span);
817815
}
818816

@@ -1083,7 +1081,7 @@ pub(super) fn check_transparent<'tcx>(tcx: TyCtxt<'tcx>, adt: ty::AdtDef<'tcx>)
10831081
if non_trivial_count > 0 || prev_non_exhaustive_1zst {
10841082
tcx.struct_span_lint_hir(
10851083
REPR_TRANSPARENT_EXTERNAL_PRIVATE_FIELDS,
1086-
tcx.hir().local_def_id_to_hir_id(adt.did().expect_local()),
1084+
tcx.local_def_id_to_hir_id(adt.did().expect_local()),
10871085
span,
10881086
"zero-sized fields in `repr(transparent)` cannot \
10891087
contain external non-exhaustive types",

compiler/rustc_hir_analysis/src/check/compare_impl_item.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ fn compare_method_predicate_entailment<'tcx>(
380380
if !errors.is_empty() {
381381
match check_implied_wf {
382382
CheckImpliedWfMode::Check => {
383-
let impl_m_hir_id = tcx.hir().local_def_id_to_hir_id(impl_m_def_id);
383+
let impl_m_hir_id = tcx.local_def_id_to_hir_id(impl_m_def_id);
384384
return compare_method_predicate_entailment(
385385
tcx,
386386
impl_m,
@@ -410,7 +410,7 @@ fn compare_method_predicate_entailment<'tcx>(
410410
if !errors.is_empty() {
411411
// FIXME(compiler-errors): This can be simplified when IMPLIED_BOUNDS_ENTAILMENT
412412
// becomes a hard error (i.e. ideally we'd just call `resolve_regions_and_report_errors`
413-
let impl_m_hir_id = tcx.hir().local_def_id_to_hir_id(impl_m_def_id);
413+
let impl_m_hir_id = tcx.local_def_id_to_hir_id(impl_m_def_id);
414414
match check_implied_wf {
415415
CheckImpliedWfMode::Check => {
416416
return compare_method_predicate_entailment(
@@ -667,7 +667,7 @@ pub(super) fn collect_return_position_impl_trait_in_trait_tys<'tcx>(
667667

668668
let trait_to_impl_args = impl_trait_ref.args;
669669

670-
let impl_m_hir_id = tcx.hir().local_def_id_to_hir_id(impl_m_def_id);
670+
let impl_m_hir_id = tcx.local_def_id_to_hir_id(impl_m_def_id);
671671
let return_span = tcx.hir().fn_decl_by_hir_id(impl_m_hir_id).unwrap().output.span();
672672
let cause = ObligationCause::new(
673673
return_span,

compiler/rustc_hir_analysis/src/check/entry.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ fn check_main_fn_ty(tcx: TyCtxt<'_>, main_def_id: DefId) {
4242
if !def_id.is_local() {
4343
return None;
4444
}
45-
let hir_id = tcx.hir().local_def_id_to_hir_id(def_id.expect_local());
45+
let hir_id = tcx.local_def_id_to_hir_id(def_id.expect_local());
4646
match tcx.hir().find(hir_id) {
4747
Some(Node::Item(hir::Item { kind: hir::ItemKind::Fn(_, generics, _), .. })) => {
4848
generics.params.is_empty().not().then_some(generics.span)
@@ -57,7 +57,7 @@ fn check_main_fn_ty(tcx: TyCtxt<'_>, main_def_id: DefId) {
5757
if !def_id.is_local() {
5858
return None;
5959
}
60-
let hir_id = tcx.hir().local_def_id_to_hir_id(def_id.expect_local());
60+
let hir_id = tcx.local_def_id_to_hir_id(def_id.expect_local());
6161
match tcx.hir().find(hir_id) {
6262
Some(Node::Item(hir::Item { kind: hir::ItemKind::Fn(_, generics, _), .. })) => {
6363
Some(generics.where_clause_span)
@@ -79,7 +79,7 @@ fn check_main_fn_ty(tcx: TyCtxt<'_>, main_def_id: DefId) {
7979
if !def_id.is_local() {
8080
return None;
8181
}
82-
let hir_id = tcx.hir().local_def_id_to_hir_id(def_id.expect_local());
82+
let hir_id = tcx.local_def_id_to_hir_id(def_id.expect_local());
8383
match tcx.hir().find(hir_id) {
8484
Some(Node::Item(hir::Item { kind: hir::ItemKind::Fn(fn_sig, _, _), .. })) => {
8585
Some(fn_sig.decl.output.span())
@@ -194,7 +194,7 @@ fn check_main_fn_ty(tcx: TyCtxt<'_>, main_def_id: DefId) {
194194

195195
fn check_start_fn_ty(tcx: TyCtxt<'_>, start_def_id: DefId) {
196196
let start_def_id = start_def_id.expect_local();
197-
let start_id = tcx.hir().local_def_id_to_hir_id(start_def_id);
197+
let start_id = tcx.local_def_id_to_hir_id(start_def_id);
198198
let start_span = tcx.def_span(start_def_id);
199199
let start_t = tcx.type_of(start_def_id).instantiate_identity();
200200
match start_t.kind() {

compiler/rustc_hir_analysis/src/check/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ fn get_owner_return_paths(
128128
tcx: TyCtxt<'_>,
129129
def_id: LocalDefId,
130130
) -> Option<(LocalDefId, ReturnsVisitor<'_>)> {
131-
let hir_id = tcx.hir().local_def_id_to_hir_id(def_id);
131+
let hir_id = tcx.local_def_id_to_hir_id(def_id);
132132
let parent_id = tcx.hir().get_parent_item(hir_id).def_id;
133133
tcx.hir().find_by_def_id(parent_id).and_then(|node| node.body_id()).map(|body_id| {
134134
let body = tcx.hir().body(body_id);

compiler/rustc_hir_analysis/src/coherence/orphan.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ fn lint_auto_trait_impl<'tcx>(
497497

498498
tcx.struct_span_lint_hir(
499499
lint::builtin::SUSPICIOUS_AUTO_TRAIT_IMPLS,
500-
tcx.hir().local_def_id_to_hir_id(impl_def_id),
500+
tcx.local_def_id_to_hir_id(impl_def_id),
501501
tcx.def_span(impl_def_id),
502502
DelayDm(|| {
503503
format!(

compiler/rustc_hir_analysis/src/collect.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ impl<'tcx> ItemCtxt<'tcx> {
350350
}
351351

352352
pub fn hir_id(&self) -> hir::HirId {
353-
self.tcx.hir().local_def_id_to_hir_id(self.item_def_id)
353+
self.tcx.local_def_id_to_hir_id(self.item_def_id)
354354
}
355355

356356
pub fn node(&self) -> hir::Node<'tcx> {
@@ -835,7 +835,7 @@ fn convert_variant(
835835
fn adt_def(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::AdtDef<'_> {
836836
use rustc_hir::*;
837837

838-
let hir_id = tcx.hir().local_def_id_to_hir_id(def_id);
838+
let hir_id = tcx.local_def_id_to_hir_id(def_id);
839839
let Node::Item(item) = tcx.hir().get(hir_id) else {
840840
bug!();
841841
};
@@ -1101,7 +1101,7 @@ fn fn_sig(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::EarlyBinder<ty::PolyFnSig<
11011101
use rustc_hir::Node::*;
11021102
use rustc_hir::*;
11031103

1104-
let hir_id = tcx.hir().local_def_id_to_hir_id(def_id);
1104+
let hir_id = tcx.local_def_id_to_hir_id(def_id);
11051105

11061106
let icx = ItemCtxt::new(tcx, def_id);
11071107

@@ -1186,7 +1186,7 @@ fn infer_return_ty_for_fn_sig<'tcx>(
11861186
def_id: LocalDefId,
11871187
icx: &ItemCtxt<'tcx>,
11881188
) -> ty::PolyFnSig<'tcx> {
1189-
let hir_id = tcx.hir().local_def_id_to_hir_id(def_id);
1189+
let hir_id = tcx.local_def_id_to_hir_id(def_id);
11901190

11911191
match get_infer_ret_ty(&sig.decl.output) {
11921192
Some(ty) => {
@@ -1519,7 +1519,7 @@ fn compute_sig_of_foreign_fn_decl<'tcx>(
15191519
} else {
15201520
hir::Unsafety::Unsafe
15211521
};
1522-
let hir_id = tcx.hir().local_def_id_to_hir_id(def_id);
1522+
let hir_id = tcx.local_def_id_to_hir_id(def_id);
15231523
let fty =
15241524
ItemCtxt::new(tcx, def_id).astconv().ty_of_fn(hir_id, unsafety, abi, decl, None, None);
15251525

compiler/rustc_hir_analysis/src/collect/generics_of.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use rustc_span::{sym, Span};
1414
pub(super) fn generics_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Generics {
1515
use rustc_hir::*;
1616

17-
let hir_id = tcx.hir().local_def_id_to_hir_id(def_id);
17+
let hir_id = tcx.local_def_id_to_hir_id(def_id);
1818

1919
let node = tcx.hir().get(hir_id);
2020
let parent_def_id = match node {

compiler/rustc_hir_analysis/src/collect/item_bounds.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ pub(super) fn explicit_item_bounds(
105105
None => {}
106106
}
107107

108-
let hir_id = tcx.hir().local_def_id_to_hir_id(def_id);
108+
let hir_id = tcx.local_def_id_to_hir_id(def_id);
109109
let bounds = match tcx.hir().get(hir_id) {
110110
hir::Node::TraitItem(hir::TraitItem {
111111
kind: hir::TraitItemKind::Type(bounds, _),

compiler/rustc_hir_analysis/src/collect/predicates_of.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Gen
134134
None => {}
135135
}
136136

137-
let hir_id = tcx.hir().local_def_id_to_hir_id(def_id);
137+
let hir_id = tcx.local_def_id_to_hir_id(def_id);
138138
let node = tcx.hir().get(hir_id);
139139

140140
let mut is_trait = None;
@@ -412,7 +412,7 @@ fn const_evaluatable_predicates_of(
412412
}
413413
}
414414

415-
let hir_id = tcx.hir().local_def_id_to_hir_id(def_id);
415+
let hir_id = tcx.local_def_id_to_hir_id(def_id);
416416
let node = tcx.hir().get(hir_id);
417417

418418
let mut collector = ConstCollector { tcx, preds: FxIndexSet::default() };
@@ -503,7 +503,7 @@ pub(super) fn explicit_predicates_of<'tcx>(
503503
}
504504
} else {
505505
if matches!(def_kind, DefKind::AnonConst) && tcx.features().generic_const_exprs {
506-
let hir_id = tcx.hir().local_def_id_to_hir_id(def_id);
506+
let hir_id = tcx.local_def_id_to_hir_id(def_id);
507507
let parent_def_id = tcx.hir().get_parent_item(hir_id);
508508

509509
if let Some(defaulted_param_def_id) =
@@ -571,7 +571,7 @@ pub(super) fn explicit_predicates_of<'tcx>(
571571
// To fix this, we call `explicit_predicates_of` directly on `foo`, the parent's parent.
572572

573573
// In the above example this is `foo::{opaque#0}` or `impl Iterator`
574-
let parent_hir_id = tcx.hir().local_def_id_to_hir_id(parent_def_id.def_id);
574+
let parent_hir_id = tcx.local_def_id_to_hir_id(parent_def_id.def_id);
575575

576576
// In the above example this is the function `foo`
577577
let item_def_id = tcx.hir().get_parent_item(parent_hir_id);
@@ -631,7 +631,7 @@ pub(super) fn implied_predicates_with_filter(
631631
return tcx.super_predicates_of(trait_def_id);
632632
};
633633

634-
let trait_hir_id = tcx.hir().local_def_id_to_hir_id(trait_def_id);
634+
let trait_hir_id = tcx.local_def_id_to_hir_id(trait_def_id);
635635

636636
let Node::Item(item) = tcx.hir().get(trait_hir_id) else {
637637
bug!("trait_node_id {} is not an item", trait_hir_id);
@@ -691,7 +691,7 @@ pub(super) fn type_param_predicates(
691691
// written inline like `<T: Foo>` or in a where-clause like
692692
// `where T: Foo`.
693693

694-
let param_id = tcx.hir().local_def_id_to_hir_id(def_id);
694+
let param_id = tcx.local_def_id_to_hir_id(def_id);
695695
let param_owner = tcx.hir().ty_param_owner(def_id);
696696
let generics = tcx.generics_of(param_owner);
697697
let index = generics.param_def_id_to_index[&def_id.to_def_id()];
@@ -712,7 +712,7 @@ pub(super) fn type_param_predicates(
712712
.unwrap_or_default();
713713
let mut extend = None;
714714

715-
let item_hir_id = tcx.hir().local_def_id_to_hir_id(item_def_id);
715+
let item_hir_id = tcx.local_def_id_to_hir_id(item_def_id);
716716
let ast_generics = match tcx.hir().get(item_hir_id) {
717717
Node::TraitItem(item) => item.generics,
718718

0 commit comments

Comments
 (0)