diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2021-02-01 11:32:26 +0100 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2021-02-15 19:36:13 +0100 |
| commit | 91d8e59ccaacf7df2af847037d30871ed0bd90b6 (patch) | |
| tree | b5b7c61d858902d9e88882231308c53541f850be /compiler | |
| parent | 7dd1e8cfdf7f02010cc3d21eba59954255166484 (diff) | |
| download | rust-91d8e59ccaacf7df2af847037d30871ed0bd90b6.tar.gz rust-91d8e59ccaacf7df2af847037d30871ed0bd90b6.zip | |
Remove HirItemLike.
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_middle/src/hir/map/collector.rs | 32 |
1 files changed, 7 insertions, 25 deletions
diff --git a/compiler/rustc_middle/src/hir/map/collector.rs b/compiler/rustc_middle/src/hir/map/collector.rs index b9fb3142c63..a5ffa9c7a54 100644 --- a/compiler/rustc_middle/src/hir/map/collector.rs +++ b/compiler/rustc_middle/src/hir/map/collector.rs @@ -55,22 +55,19 @@ fn insert_vec_map<K: Idx, V: Clone>(map: &mut IndexVec<K, Option<V>>, k: K, v: V map[k] = Some(v); } -fn hash( - hcx: &mut StableHashingContext<'_>, - input: impl for<'a> HashStable<StableHashingContext<'a>>, -) -> Fingerprint { - let mut stable_hasher = StableHasher::new(); - input.hash_stable(hcx, &mut stable_hasher); - stable_hasher.finish() -} - fn hash_body( hcx: &mut StableHashingContext<'_>, def_path_hash: DefPathHash, item_like: impl for<'a> HashStable<StableHashingContext<'a>>, hir_body_nodes: &mut Vec<(DefPathHash, Fingerprint)>, ) -> Fingerprint { - let hash = hash(hcx, HirItemLike { item_like: &item_like }); + let hash = { + let mut stable_hasher = StableHasher::new(); + hcx.while_hashing_hir_bodies(true, |hcx| { + item_like.hash_stable(hcx, &mut stable_hasher); + }); + stable_hasher.finish() + }; hir_body_nodes.push((def_path_hash, hash)); hash } @@ -575,18 +572,3 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> { self.visit_nested_foreign_item(id); } } - -struct HirItemLike<T> { - item_like: T, -} - -impl<'hir, T> HashStable<StableHashingContext<'hir>> for HirItemLike<T> -where - T: HashStable<StableHashingContext<'hir>>, -{ - fn hash_stable(&self, hcx: &mut StableHashingContext<'hir>, hasher: &mut StableHasher) { - hcx.while_hashing_hir_bodies(true, |hcx| { - self.item_like.hash_stable(hcx, hasher); - }); - } -} |
