1
Fork 0

Add unit test to ensure that both parts of a DefPathHash depend on the defining crate's ID.

This commit is contained in:
Michael Woerister 2021-02-04 11:04:29 +01:00
parent 97380e3b06
commit 9e5054498b
4 changed files with 54 additions and 3 deletions

View file

@ -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 {