about summary refs log tree commit diff
path: root/compiler/rustc_span/src
diff options
context:
space:
mode:
authorMichael Woerister <michaelwoerister@posteo>2021-02-04 11:04:29 +0100
committerMichael Woerister <michaelwoerister@posteo>2021-02-04 16:33:58 +0100
commit9e5054498b181fc3984e266d1aa05f076dfea22f (patch)
tree7914141ecdc8ee6b647b6f5be441c1f1b8c10008 /compiler/rustc_span/src
parent97380e3b06555c0dd3a8fd1e3d2ca7c4bfeeb21f (diff)
downloadrust-9e5054498b181fc3984e266d1aa05f076dfea22f.tar.gz
rust-9e5054498b181fc3984e266d1aa05f076dfea22f.zip
Add unit test to ensure that both parts of a DefPathHash depend on the defining crate's ID.
Diffstat (limited to 'compiler/rustc_span/src')
-rw-r--r--compiler/rustc_span/src/def_id.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/rustc_span/src/def_id.rs b/compiler/rustc_span/src/def_id.rs
index 7c02056105e..bd8c95fd661 100644
--- a/compiler/rustc_span/src/def_id.rs
+++ b/compiler/rustc_span/src/def_id.rs
@@ -159,6 +159,12 @@ impl DefPathHash {
         StableCrateId(self.0.as_value().0)
     }
 
+    /// Returns the crate-local part of the [DefPathHash].
+    #[inline]
+    pub fn local_hash(&self) -> u64 {
+        self.0.as_value().1
+    }
+
     /// Builds a new [DefPathHash] with the given [StableCrateId] and
     /// `local_hash`, where `local_hash` must be unique within its crate.
     pub fn new(stable_crate_id: StableCrateId, local_hash: u64) -> DefPathHash {