Skip to content

Commit 91d8e59

Browse files
committed
Remove HirItemLike.
1 parent 7dd1e8c commit 91d8e59

File tree

1 file changed

+7
-25
lines changed

1 file changed

+7
-25
lines changed

Diff for: compiler/rustc_middle/src/hir/map/collector.rs

+7-25
Original file line numberDiff line numberDiff line change
@@ -55,22 +55,19 @@ fn insert_vec_map<K: Idx, V: Clone>(map: &mut IndexVec<K, Option<V>>, k: K, v: V
5555
map[k] = Some(v);
5656
}
5757

58-
fn hash(
59-
hcx: &mut StableHashingContext<'_>,
60-
input: impl for<'a> HashStable<StableHashingContext<'a>>,
61-
) -> Fingerprint {
62-
let mut stable_hasher = StableHasher::new();
63-
input.hash_stable(hcx, &mut stable_hasher);
64-
stable_hasher.finish()
65-
}
66-
6758
fn hash_body(
6859
hcx: &mut StableHashingContext<'_>,
6960
def_path_hash: DefPathHash,
7061
item_like: impl for<'a> HashStable<StableHashingContext<'a>>,
7162
hir_body_nodes: &mut Vec<(DefPathHash, Fingerprint)>,
7263
) -> Fingerprint {
73-
let hash = hash(hcx, HirItemLike { item_like: &item_like });
64+
let hash = {
65+
let mut stable_hasher = StableHasher::new();
66+
hcx.while_hashing_hir_bodies(true, |hcx| {
67+
item_like.hash_stable(hcx, &mut stable_hasher);
68+
});
69+
stable_hasher.finish()
70+
};
7471
hir_body_nodes.push((def_path_hash, hash));
7572
hash
7673
}
@@ -575,18 +572,3 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
575572
self.visit_nested_foreign_item(id);
576573
}
577574
}
578-
579-
struct HirItemLike<T> {
580-
item_like: T,
581-
}
582-
583-
impl<'hir, T> HashStable<StableHashingContext<'hir>> for HirItemLike<T>
584-
where
585-
T: HashStable<StableHashingContext<'hir>>,
586-
{
587-
fn hash_stable(&self, hcx: &mut StableHashingContext<'hir>, hasher: &mut StableHasher) {
588-
hcx.while_hashing_hir_bodies(true, |hcx| {
589-
self.item_like.hash_stable(hcx, hasher);
590-
});
591-
}
592-
}

0 commit comments

Comments
 (0)