about summary refs log tree commit diff
path: root/compiler/rustc_middle
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2024-02-03 15:50:14 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2024-02-03 15:50:14 +0300
commitc5eca333fc8ad2b3f7d45d3a0af59d1cf83df23c (patch)
tree7f9f5bd25ce36d757a583ff517f76fd7c343b2ce /compiler/rustc_middle
parentbf3c6c5bed498f41ad815641319a1ad9bcecb8e8 (diff)
downloadrust-c5eca333fc8ad2b3f7d45d3a0af59d1cf83df23c.tar.gz
rust-c5eca333fc8ad2b3f7d45d3a0af59d1cf83df23c.zip
hir: Remove the generic type parameter from `MaybeOwned`
It's only ever used with a reference to `OwnerInfo` as an argument.
Diffstat (limited to 'compiler/rustc_middle')
-rw-r--r--compiler/rustc_middle/src/hir/mod.rs9
-rw-r--r--compiler/rustc_middle/src/query/erase.rs4
2 files changed, 6 insertions, 7 deletions
diff --git a/compiler/rustc_middle/src/hir/mod.rs b/compiler/rustc_middle/src/hir/mod.rs
index b54e438f614..94191df30a5 100644
--- a/compiler/rustc_middle/src/hir/mod.rs
+++ b/compiler/rustc_middle/src/hir/mod.rs
@@ -127,12 +127,11 @@ pub fn provide(providers: &mut Providers) {
     providers.hir_crate_items = map::hir_crate_items;
     providers.crate_hash = map::crate_hash;
     providers.hir_module_items = map::hir_module_items;
-    providers.opt_local_def_id_to_hir_id = |tcx, id| {
-        let owner = tcx.hir_crate(()).owners[id].map(|_| ());
-        Some(match owner {
-            MaybeOwner::Owner(_) => HirId::make_owner(id),
-            MaybeOwner::Phantom => bug!("No HirId for {:?}", id),
+    providers.opt_local_def_id_to_hir_id = |tcx, def_id| {
+        Some(match tcx.hir_crate(()).owners[def_id] {
+            MaybeOwner::Owner(_) => HirId::make_owner(def_id),
             MaybeOwner::NonOwner(hir_id) => hir_id,
+            MaybeOwner::Phantom => bug!("No HirId for {:?}", def_id),
         })
     };
     providers.opt_hir_owner_nodes =
diff --git a/compiler/rustc_middle/src/query/erase.rs b/compiler/rustc_middle/src/query/erase.rs
index 1b01df6a187..a272a51f327 100644
--- a/compiler/rustc_middle/src/query/erase.rs
+++ b/compiler/rustc_middle/src/query/erase.rs
@@ -185,8 +185,8 @@ impl EraseType for Option<ty::EarlyBinder<Ty<'_>>> {
     type Result = [u8; size_of::<Option<ty::EarlyBinder<Ty<'static>>>>()];
 }
 
-impl<T> EraseType for rustc_hir::MaybeOwner<&'_ T> {
-    type Result = [u8; size_of::<rustc_hir::MaybeOwner<&'static ()>>()];
+impl EraseType for rustc_hir::MaybeOwner<'_> {
+    type Result = [u8; size_of::<rustc_hir::MaybeOwner<'static>>()];
 }
 
 impl<T: EraseType> EraseType for ty::EarlyBinder<T> {