From 5a299a9903abd6bd5161d610855b0c123ed58dfb Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Fri, 28 Jan 2022 15:13:01 -0300 Subject: [PATCH] Make local_def_id_to_hir_id return MaybeOwner<()> --- compiler/rustc_middle/src/hir/mod.rs | 7 +------ compiler/rustc_middle/src/query/mod.rs | 2 +- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/compiler/rustc_middle/src/hir/mod.rs b/compiler/rustc_middle/src/hir/mod.rs index 16b41c8f9d1b4..12379eed80ec4 100644 --- a/compiler/rustc_middle/src/hir/mod.rs +++ b/compiler/rustc_middle/src/hir/mod.rs @@ -69,12 +69,7 @@ pub fn provide(providers: &mut Providers) { let node = owner.node(); Some(Owner { node, hash_without_bodies: owner.nodes.hash_without_bodies }) }; - providers.local_def_id_to_hir_id = |tcx, id| { - tcx.hir_crate(()).owners[id].map(|owner| { - let node = owner.nodes.node(); - Owner { node, hash_without_bodies: owner.nodes.hash_without_bodies } - }) - }; + providers.local_def_id_to_hir_id = |tcx, id| tcx.hir_crate(()).owners[id].map(|_| ()); providers.hir_owner_nodes = |tcx, id| tcx.hir_crate(()).owners[id].map(|i| &i.nodes); providers.hir_owner_parent = |tcx, id| { // Accessing the def_key is ok since its value is hashed as part of `id`'s DefPathHash. diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs index 2eadcc6c1d3f9..334e06aa685a9 100644 --- a/compiler/rustc_middle/src/query/mod.rs +++ b/compiler/rustc_middle/src/query/mod.rs @@ -60,7 +60,7 @@ rustc_queries! { /// /// This can be conveniently accessed by methods on `tcx.hir()`. /// Avoid calling this query directly. - query local_def_id_to_hir_id(key: LocalDefId) -> hir::MaybeOwner> { + query local_def_id_to_hir_id(key: LocalDefId) -> hir::MaybeOwner<()> { desc { |tcx| "HIR ID of `{}`", tcx.def_path_str(key.to_def_id()) } }