Skip to content

Commit

Permalink
Make local_def_id_to_hir_id return MaybeOwner<()>
Browse files Browse the repository at this point in the history
  • Loading branch information
spastorino committed Jan 28, 2022
1 parent d17eb78 commit 5a299a9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
7 changes: 1 addition & 6 deletions compiler/rustc_middle/src/hir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<crate::hir::Owner<'tcx>> {
query local_def_id_to_hir_id(key: LocalDefId) -> hir::MaybeOwner<()> {
desc { |tcx| "HIR ID of `{}`", tcx.def_path_str(key.to_def_id()) }
}

Expand Down

0 comments on commit 5a299a9

Please sign in to comment.