diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2022-11-11 12:10:09 +0000 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2022-11-11 13:02:37 +0000 |
| commit | d47424b8339e3c6f2e313ccc7bb08c6857d86e44 (patch) | |
| tree | 70b3de7918d9cfea98ac63fd24e59bc7de3e8f3c /compiler/rustc_data_structures/src | |
| parent | c42a4245cc8dac5da7386de68ec6a37a4f63b8ed (diff) | |
| download | rust-d47424b8339e3c6f2e313ccc7bb08c6857d86e44.tar.gz rust-d47424b8339e3c6f2e313ccc7bb08c6857d86e44.zip | |
Hash spans when interning.
Diffstat (limited to 'compiler/rustc_data_structures/src')
| -rw-r--r-- | compiler/rustc_data_structures/src/intern.rs | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/compiler/rustc_data_structures/src/intern.rs b/compiler/rustc_data_structures/src/intern.rs index 009b5d5340a..8c94ce29b42 100644 --- a/compiler/rustc_data_structures/src/intern.rs +++ b/compiler/rustc_data_structures/src/intern.rs @@ -110,11 +110,6 @@ where } } -/// A helper trait so that `Interned` things can cache stable hashes reproducibly. -pub trait InternedHashingContext { - fn with_def_path_and_no_spans(&mut self, f: impl FnOnce(&mut Self)); -} - /// A helper type that you can wrap round your own type in order to automatically /// cache the stable hash on creation and not recompute it whenever the stable hash /// of the type is computed. @@ -165,7 +160,7 @@ impl<T: Hash> Hash for WithStableHash<T> { } } -impl<T: HashStable<CTX>, CTX: InternedHashingContext> HashStable<CTX> for WithStableHash<T> { +impl<T: HashStable<CTX>, CTX> HashStable<CTX> for WithStableHash<T> { fn hash_stable(&self, hcx: &mut CTX, hasher: &mut StableHasher) { if self.stable_hash == Fingerprint::ZERO || cfg!(debug_assertions) { // No cached hash available. This can only mean that incremental is disabled. @@ -176,7 +171,7 @@ impl<T: HashStable<CTX>, CTX: InternedHashingContext> HashStable<CTX> for WithSt // otherwise the hashes will differ between cached and non-cached mode. let stable_hash: Fingerprint = { let mut hasher = StableHasher::new(); - hcx.with_def_path_and_no_spans(|hcx| self.internee.hash_stable(hcx, &mut hasher)); + self.internee.hash_stable(hcx, &mut hasher); hasher.finish() }; if cfg!(debug_assertions) && self.stable_hash != Fingerprint::ZERO { |
