Skip to content

Commit cd53760

Browse files
committed
merge as_local_hir_id with local_def_id_to_hir_id
1 parent 4745cbe commit cd53760

File tree

82 files changed

+241
-237
lines changed

Some content is hidden

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

82 files changed

+241
-237
lines changed

src/librustc_codegen_llvm/consts.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ impl CodegenCx<'ll, 'tcx> {
215215
debug!("get_static: sym={} instance={:?}", sym, instance);
216216

217217
let g = if let Some(def_id) = def_id.as_local() {
218-
let id = self.tcx.hir().as_local_hir_id(def_id);
218+
let id = self.tcx.hir().local_def_id_to_hir_id(def_id);
219219
let llty = self.layout_of(ty).llvm_type(self);
220220
// FIXME: refactor this to work without accessing the HIR
221221
let (g, attrs) = match self.tcx.hir().get(id) {

src/librustc_codegen_ssa/back/symbol_export.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ fn upstream_drop_glue_for_provider<'tcx>(
370370

371371
fn is_unreachable_local_definition_provider(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
372372
if let Some(def_id) = def_id.as_local() {
373-
!tcx.reachable_set(LOCAL_CRATE).contains(&tcx.hir().as_local_hir_id(def_id))
373+
!tcx.reachable_set(LOCAL_CRATE).contains(&tcx.hir().local_def_id_to_hir_id(def_id))
374374
} else {
375375
bug!("is_unreachable_local_definition called with non-local DefId: {:?}", def_id)
376376
}

src/librustc_hir/definitions.rs

-5
Original file line numberDiff line numberDiff line change
@@ -306,11 +306,6 @@ impl Definitions {
306306
})
307307
}
308308

309-
#[inline]
310-
pub fn as_local_hir_id(&self, def_id: LocalDefId) -> hir::HirId {
311-
self.local_def_id_to_hir_id(def_id)
312-
}
313-
314309
#[inline]
315310
pub fn local_def_id_to_hir_id(&self, id: LocalDefId) -> hir::HirId {
316311
self.def_id_to_hir_id[id].unwrap()

src/librustc_infer/infer/error_reporting/mod.rs

+7-4
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ fn msg_span_from_early_bound_and_free_regions(
144144
let sm = tcx.sess.source_map();
145145

146146
let scope = region.free_region_binding_scope(tcx);
147-
let node = tcx.hir().as_local_hir_id(scope.expect_local());
147+
let node = tcx.hir().local_def_id_to_hir_id(scope.expect_local());
148148
let tag = match tcx.hir().find(node) {
149149
Some(Node::Block(_) | Node::Expr(_)) => "body",
150150
Some(Node::Item(it)) => item_scope_tag(&it),
@@ -1707,7 +1707,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
17071707
.in_progress_typeck_results
17081708
.map(|typeck_results| typeck_results.borrow().hir_owner)
17091709
.map(|owner| {
1710-
let hir_id = hir.as_local_hir_id(owner);
1710+
let hir_id = hir.local_def_id_to_hir_id(owner);
17111711
let parent_id = hir.get_parent_item(hir_id);
17121712
(
17131713
// Parent item could be a `mod`, so we check the HIR before calling:
@@ -1733,7 +1733,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
17331733
// Get the `hir::Param` to verify whether it already has any bounds.
17341734
// We do this to avoid suggesting code that ends up as `T: 'a'b`,
17351735
// instead we suggest `T: 'a + 'b` in that case.
1736-
let id = hir.as_local_hir_id(def_id);
1736+
let id = hir.local_def_id_to_hir_id(def_id);
17371737
let mut has_bounds = false;
17381738
if let Node::GenericParam(param) = hir.get(id) {
17391739
has_bounds = !param.bounds.is_empty();
@@ -1786,7 +1786,10 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
17861786
.and_then(|(_, g)| g.params.first())
17871787
.and_then(|param| param.def_id.as_local())
17881788
.map(|def_id| {
1789-
(hir.span(hir.as_local_hir_id(def_id)).shrink_to_lo(), format!("{}, ", new_lt))
1789+
(
1790+
hir.span(hir.local_def_id_to_hir_id(def_id)).shrink_to_lo(),
1791+
format!("{}, ", new_lt),
1792+
)
17901793
});
17911794

17921795
let labeled_user_string = match bound_kind {

src/librustc_infer/infer/error_reporting/nice_region_error/find_anon_type.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
2828
br: &ty::BoundRegion,
2929
) -> Option<(&hir::Ty<'tcx>, &hir::FnDecl<'tcx>)> {
3030
if let Some(anon_reg) = self.tcx().is_suitable_region(region) {
31-
let hir_id = self.tcx().hir().as_local_hir_id(anon_reg.def_id);
31+
let hir_id = self.tcx().hir().local_def_id_to_hir_id(anon_reg.def_id);
3232
let fndecl = match self.tcx().hir().get(hir_id) {
3333
Node::Item(&hir::Item { kind: hir::ItemKind::Fn(ref m, ..), .. })
3434
| Node::TraitItem(&hir::TraitItem {

src/librustc_infer/infer/error_reporting/nice_region_error/trait_impl_difference.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
6767
match assoc_item.kind {
6868
ty::AssocKind::Fn => {
6969
let hir = self.tcx().hir();
70-
if let Some(hir_id) = assoc_item.def_id.as_local().map(|id| hir.as_local_hir_id(id))
70+
if let Some(hir_id) =
71+
assoc_item.def_id.as_local().map(|id| hir.local_def_id_to_hir_id(id))
7172
{
7273
if let Some(decl) = hir.fn_decl_by_hir_id(hir_id) {
7374
visitor.visit_fn_decl(decl);

src/librustc_infer/infer/error_reporting/nice_region_error/util.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
4949
};
5050

5151
let hir = &self.tcx().hir();
52-
let hir_id = hir.as_local_hir_id(id.as_local()?);
52+
let hir_id = hir.local_def_id_to_hir_id(id.as_local()?);
5353
let body_id = hir.maybe_body_owned_by(hir_id)?;
5454
let body = hir.body(body_id);
5555
let owner_id = hir.body_owner(body_id);

src/librustc_lint/builtin.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingDoc {
440440
// reported for missing docs.
441441
let real_trait = trait_ref.path.res.def_id();
442442
if let Some(def_id) = real_trait.as_local() {
443-
let hir_id = cx.tcx.hir().as_local_hir_id(def_id);
443+
let hir_id = cx.tcx.hir().local_def_id_to_hir_id(def_id);
444444
if let Some(Node::Item(item)) = cx.tcx.hir().find(hir_id) {
445445
if let hir::VisibilityKind::Inherited = item.vis.node {
446446
for impl_item_ref in items {
@@ -614,7 +614,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingDebugImplementations {
614614
cx.tcx.for_each_impl(debug, |d| {
615615
if let Some(ty_def) = cx.tcx.type_of(d).ty_adt_def() {
616616
if let Some(def_id) = ty_def.did.as_local() {
617-
impls.insert(cx.tcx.hir().as_local_hir_id(def_id));
617+
impls.insert(cx.tcx.hir().local_def_id_to_hir_id(def_id));
618618
}
619619
}
620620
});

src/librustc_lint/late.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ fn late_lint_mod_pass<'tcx, T: LateLintPass<'tcx>>(
379379
param_env: ty::ParamEnv::empty(),
380380
access_levels,
381381
lint_store: unerased_lint_store(tcx),
382-
last_node_with_lint_attrs: tcx.hir().as_local_hir_id(module_def_id),
382+
last_node_with_lint_attrs: tcx.hir().local_def_id_to_hir_id(module_def_id),
383383
generics: None,
384384
only_module: true,
385385
};

src/librustc_metadata/rmeta/encoder.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ impl EncodeContext<'a, 'tcx> {
733733
is_non_exhaustive: variant.is_field_list_non_exhaustive(),
734734
};
735735

736-
let enum_id = tcx.hir().as_local_hir_id(def.did.expect_local());
736+
let enum_id = tcx.hir().local_def_id_to_hir_id(def.did.expect_local());
737737
let enum_vis = &tcx.hir().expect_item(enum_id).vis;
738738

739739
record!(self.tables.kind[def_id] <- EntryKind::Variant(self.lazy(data)));
@@ -780,7 +780,7 @@ impl EncodeContext<'a, 'tcx> {
780780

781781
// Variant constructors have the same visibility as the parent enums, unless marked as
782782
// non-exhaustive, in which case they are lowered to `pub(crate)`.
783-
let enum_id = tcx.hir().as_local_hir_id(def.did.expect_local());
783+
let enum_id = tcx.hir().local_def_id_to_hir_id(def.did.expect_local());
784784
let enum_vis = &tcx.hir().expect_item(enum_id).vis;
785785
let mut ctor_vis = ty::Visibility::from_hir(enum_vis, enum_id, tcx);
786786
if variant.is_field_list_non_exhaustive() && ctor_vis == ty::Visibility::Public {
@@ -819,11 +819,11 @@ impl EncodeContext<'a, 'tcx> {
819819
let data = ModData {
820820
reexports: match tcx.module_exports(local_def_id) {
821821
Some(exports) => {
822-
let hir_map = self.tcx.hir();
822+
let hir = self.tcx.hir();
823823
self.lazy(
824824
exports
825825
.iter()
826-
.map(|export| export.map_id(|id| hir_map.as_local_hir_id(id))),
826+
.map(|export| export.map_id(|id| hir.local_def_id_to_hir_id(id))),
827827
)
828828
}
829829
_ => Lazy::empty(),
@@ -855,7 +855,7 @@ impl EncodeContext<'a, 'tcx> {
855855
let def_id = field.did;
856856
debug!("EncodeContext::encode_field({:?})", def_id);
857857

858-
let variant_id = tcx.hir().as_local_hir_id(variant.def_id.expect_local());
858+
let variant_id = tcx.hir().local_def_id_to_hir_id(variant.def_id.expect_local());
859859
let variant_data = tcx.hir().expect_variant_data(variant_id);
860860

861861
record!(self.tables.kind[def_id] <- EntryKind::Field);
@@ -883,7 +883,7 @@ impl EncodeContext<'a, 'tcx> {
883883
is_non_exhaustive: variant.is_field_list_non_exhaustive(),
884884
};
885885

886-
let struct_id = tcx.hir().as_local_hir_id(adt_def.did.expect_local());
886+
let struct_id = tcx.hir().local_def_id_to_hir_id(adt_def.did.expect_local());
887887
let struct_vis = &tcx.hir().expect_item(struct_id).vis;
888888
let mut ctor_vis = ty::Visibility::from_hir(struct_vis, struct_id, tcx);
889889
for field in &variant.fields {
@@ -945,7 +945,7 @@ impl EncodeContext<'a, 'tcx> {
945945
debug!("EncodeContext::encode_info_for_trait_item({:?})", def_id);
946946
let tcx = self.tcx;
947947

948-
let hir_id = tcx.hir().as_local_hir_id(def_id.expect_local());
948+
let hir_id = tcx.hir().local_def_id_to_hir_id(def_id.expect_local());
949949
let ast_item = tcx.hir().expect_trait_item(hir_id);
950950
let trait_item = tcx.associated_item(def_id);
951951

@@ -1034,7 +1034,7 @@ impl EncodeContext<'a, 'tcx> {
10341034
debug!("EncodeContext::encode_info_for_impl_item({:?})", def_id);
10351035
let tcx = self.tcx;
10361036

1037-
let hir_id = self.tcx.hir().as_local_hir_id(def_id.expect_local());
1037+
let hir_id = self.tcx.hir().local_def_id_to_hir_id(def_id.expect_local());
10381038
let ast_item = self.tcx.hir().expect_impl_item(hir_id);
10391039
let impl_item = self.tcx.associated_item(def_id);
10401040

@@ -1438,7 +1438,7 @@ impl EncodeContext<'a, 'tcx> {
14381438

14391439
// NOTE(eddyb) `tcx.type_of(def_id)` isn't used because it's fully generic,
14401440
// including on the signature, which is inferred in `typeck.
1441-
let hir_id = self.tcx.hir().as_local_hir_id(def_id);
1441+
let hir_id = self.tcx.hir().local_def_id_to_hir_id(def_id);
14421442
let ty = self.tcx.typeck(def_id).node_type(hir_id);
14431443

14441444
record!(self.tables.kind[def_id.to_def_id()] <- match ty.kind {
@@ -1465,7 +1465,7 @@ impl EncodeContext<'a, 'tcx> {
14651465

14661466
fn encode_info_for_anon_const(&mut self, def_id: LocalDefId) {
14671467
debug!("EncodeContext::encode_info_for_anon_const({:?})", def_id);
1468-
let id = self.tcx.hir().as_local_hir_id(def_id);
1468+
let id = self.tcx.hir().local_def_id_to_hir_id(def_id);
14691469
let body_id = self.tcx.hir().body_owned_by(id);
14701470
let const_data = self.encode_rendered_const_for_body(body_id);
14711471
let qualifs = self.tcx.mir_const_qualif(def_id);

src/librustc_middle/dep_graph/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,6 @@ impl<'tcx> DepContext for TyCtxt<'tcx> {
185185
}
186186

187187
fn def_id_corresponds_to_hir_dep_node(tcx: TyCtxt<'_>, def_id: LocalDefId) -> bool {
188-
let hir_id = tcx.hir().as_local_hir_id(def_id);
188+
let hir_id = tcx.hir().local_def_id_to_hir_id(def_id);
189189
def_id == hir_id.owner
190190
}

src/librustc_middle/hir/map/mod.rs

+3-8
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,6 @@ impl<'hir> Map<'hir> {
173173
self.tcx.definitions.opt_hir_id_to_local_def_id(hir_id)
174174
}
175175

176-
#[inline]
177-
pub fn as_local_hir_id(&self, def_id: LocalDefId) -> HirId {
178-
self.tcx.definitions.as_local_hir_id(def_id)
179-
}
180-
181176
#[inline]
182177
pub fn local_def_id_to_hir_id(&self, def_id: LocalDefId) -> HirId {
183178
self.tcx.definitions.local_def_id_to_hir_id(def_id)
@@ -450,7 +445,7 @@ impl<'hir> Map<'hir> {
450445
}
451446

452447
pub fn get_module(&self, module: LocalDefId) -> (&'hir Mod<'hir>, Span, HirId) {
453-
let hir_id = self.as_local_hir_id(module);
448+
let hir_id = self.local_def_id_to_hir_id(module);
454449
match self.get_entry(hir_id).node {
455450
Node::Item(&Item { span, kind: ItemKind::Mod(ref m), .. }) => (m, span, hir_id),
456451
Node::Crate(item) => (&item.module, item.span, hir_id),
@@ -483,7 +478,7 @@ impl<'hir> Map<'hir> {
483478
}
484479

485480
pub fn get_if_local(&self, id: DefId) -> Option<Node<'hir>> {
486-
id.as_local().map(|id| self.get(self.as_local_hir_id(id)))
481+
id.as_local().map(|id| self.get(self.local_def_id_to_hir_id(id)))
487482
}
488483

489484
pub fn get_generics(&self, id: DefId) -> Option<&'hir Generics<'hir>> {
@@ -872,7 +867,7 @@ impl<'hir> Map<'hir> {
872867
}
873868

874869
pub fn span_if_local(&self, id: DefId) -> Option<Span> {
875-
id.as_local().map(|id| self.span(self.as_local_hir_id(id)))
870+
id.as_local().map(|id| self.span(self.local_def_id_to_hir_id(id)))
876871
}
877872

878873
pub fn res_span(&self, res: Res) -> Option<Span> {

src/librustc_middle/hir/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -66,20 +66,20 @@ impl<'tcx> TyCtxt<'tcx> {
6666
pub fn provide(providers: &mut Providers) {
6767
providers.parent_module_from_def_id = |tcx, id| {
6868
let hir = tcx.hir();
69-
hir.local_def_id(hir.get_module_parent_node(hir.as_local_hir_id(id)))
69+
hir.local_def_id(hir.get_module_parent_node(hir.local_def_id_to_hir_id(id)))
7070
};
7171
providers.hir_crate = |tcx, _| tcx.untracked_crate;
7272
providers.index_hir = map::index_hir;
7373
providers.hir_module_items = |tcx, id| {
7474
let hir = tcx.hir();
75-
let module = hir.as_local_hir_id(id);
75+
let module = hir.local_def_id_to_hir_id(id);
7676
&tcx.untracked_crate.modules[&module]
7777
};
7878
providers.hir_owner = |tcx, id| tcx.index_hir(LOCAL_CRATE).map[id].signature;
7979
providers.hir_owner_nodes = |tcx, id| tcx.index_hir(LOCAL_CRATE).map[id].with_bodies.as_deref();
8080
providers.fn_arg_names = |tcx, id| {
8181
let hir = tcx.hir();
82-
let hir_id = hir.as_local_hir_id(id.expect_local());
82+
let hir_id = hir.local_def_id_to_hir_id(id.expect_local());
8383
if let Some(body_id) = hir.maybe_body_owned_by(hir_id) {
8484
tcx.arena.alloc_from_iter(hir.body_param_names(body_id))
8585
} else if let Node::TraitItem(&TraitItem {

src/librustc_middle/mir/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2127,7 +2127,7 @@ impl<'tcx> Debug for Rvalue<'tcx> {
21272127

21282128
AggregateKind::Closure(def_id, substs) => ty::tls::with(|tcx| {
21292129
if let Some(def_id) = def_id.as_local() {
2130-
let hir_id = tcx.hir().as_local_hir_id(def_id);
2130+
let hir_id = tcx.hir().local_def_id_to_hir_id(def_id);
21312131
let name = if tcx.sess.opts.debugging_opts.span_free_formats {
21322132
let substs = tcx.lift(&substs).unwrap();
21332133
format!(
@@ -2155,7 +2155,7 @@ impl<'tcx> Debug for Rvalue<'tcx> {
21552155

21562156
AggregateKind::Generator(def_id, _, _) => ty::tls::with(|tcx| {
21572157
if let Some(def_id) = def_id.as_local() {
2158-
let hir_id = tcx.hir().as_local_hir_id(def_id);
2158+
let hir_id = tcx.hir().local_def_id_to_hir_id(def_id);
21592159
let name = format!("[generator@{:?}]", tcx.hir().span(hir_id));
21602160
let mut struct_fmt = fmt.debug_struct(&name);
21612161

src/librustc_middle/mir/mono.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -198,10 +198,10 @@ impl<'tcx> MonoItem<'tcx> {
198198
pub fn local_span(&self, tcx: TyCtxt<'tcx>) -> Option<Span> {
199199
match *self {
200200
MonoItem::Fn(Instance { def, .. }) => {
201-
def.def_id().as_local().map(|def_id| tcx.hir().as_local_hir_id(def_id))
201+
def.def_id().as_local().map(|def_id| tcx.hir().local_def_id_to_hir_id(def_id))
202202
}
203203
MonoItem::Static(def_id) => {
204-
def_id.as_local().map(|def_id| tcx.hir().as_local_hir_id(def_id))
204+
def_id.as_local().map(|def_id| tcx.hir().local_def_id_to_hir_id(def_id))
205205
}
206206
MonoItem::GlobalAsm(hir_id) => Some(hir_id),
207207
}
@@ -346,9 +346,10 @@ impl<'tcx> CodegenUnit<'tcx> {
346346
// instances into account. The others don't matter for
347347
// the codegen tests and can even make item order
348348
// unstable.
349-
InstanceDef::Item(def) => {
350-
def.did.as_local().map(|def_id| tcx.hir().as_local_hir_id(def_id))
351-
}
349+
InstanceDef::Item(def) => def
350+
.did
351+
.as_local()
352+
.map(|def_id| tcx.hir().local_def_id_to_hir_id(def_id)),
352353
InstanceDef::VtableShim(..)
353354
| InstanceDef::ReifyShim(..)
354355
| InstanceDef::Intrinsic(..)
@@ -360,7 +361,7 @@ impl<'tcx> CodegenUnit<'tcx> {
360361
}
361362
}
362363
MonoItem::Static(def_id) => {
363-
def_id.as_local().map(|def_id| tcx.hir().as_local_hir_id(def_id))
364+
def_id.as_local().map(|def_id| tcx.hir().local_def_id_to_hir_id(def_id))
364365
}
365366
MonoItem::GlobalAsm(hir_id) => Some(hir_id),
366367
},

src/librustc_middle/query/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ rustc_queries! {
352352
/// per-type-parameter predicates for resolving `T::AssocTy`.
353353
query type_param_predicates(key: (DefId, LocalDefId)) -> ty::GenericPredicates<'tcx> {
354354
desc { |tcx| "computing the bounds for type parameter `{}`", {
355-
let id = tcx.hir().as_local_hir_id(key.1);
355+
let id = tcx.hir().local_def_id_to_hir_id(key.1);
356356
tcx.hir().ty_param_name(id)
357357
}}
358358
}

src/librustc_middle/ty/consts.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ impl<'tcx> Const<'tcx> {
8888
ExprKind::Path(QPath::Resolved(_, &Path { res: Res::Def(ConstParam, def_id), .. })) => {
8989
// Find the name and index of the const parameter by indexing the generics of
9090
// the parent item and construct a `ParamConst`.
91-
let hir_id = tcx.hir().as_local_hir_id(def_id.expect_local());
91+
let hir_id = tcx.hir().local_def_id_to_hir_id(def_id.expect_local());
9292
let item_id = tcx.hir().get_parent_node(hir_id);
9393
let item_def_id = tcx.hir().local_def_id(item_id);
9494
let generics = tcx.generics_of(item_def_id.to_def_id());

src/librustc_middle/ty/context.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1420,7 +1420,7 @@ impl<'tcx> TyCtxt<'tcx> {
14201420
_ => return None, // not a free region
14211421
};
14221422

1423-
let hir_id = self.hir().as_local_hir_id(suitable_region_binding_scope);
1423+
let hir_id = self.hir().local_def_id_to_hir_id(suitable_region_binding_scope);
14241424
let is_impl_item = match self.hir().find(hir_id) {
14251425
Some(Node::Item(..) | Node::TraitItem(..)) => false,
14261426
Some(Node::ImplItem(..)) => {
@@ -1441,7 +1441,7 @@ impl<'tcx> TyCtxt<'tcx> {
14411441
&self,
14421442
scope_def_id: LocalDefId,
14431443
) -> Vec<&'tcx hir::Ty<'tcx>> {
1444-
let hir_id = self.hir().as_local_hir_id(scope_def_id);
1444+
let hir_id = self.hir().local_def_id_to_hir_id(scope_def_id);
14451445
let hir_output = match self.hir().get(hir_id) {
14461446
Node::Item(hir::Item {
14471447
kind:
@@ -1486,7 +1486,7 @@ impl<'tcx> TyCtxt<'tcx> {
14861486

14871487
pub fn return_type_impl_trait(&self, scope_def_id: LocalDefId) -> Option<(Ty<'tcx>, Span)> {
14881488
// HACK: `type_of_def_id()` will fail on these (#55796), so return `None`.
1489-
let hir_id = self.hir().as_local_hir_id(scope_def_id);
1489+
let hir_id = self.hir().local_def_id_to_hir_id(scope_def_id);
14901490
match self.hir().get(hir_id) {
14911491
Node::Item(item) => {
14921492
match item.kind {

0 commit comments

Comments
 (0)