about summary refs log tree commit diff
path: root/compiler/rustc_metadata/src/rmeta/decoder.rs
diff options
context:
space:
mode:
authorMichael Woerister <michaelwoerister@posteo>2021-01-27 14:28:07 +0100
committerMichael Woerister <michaelwoerister@posteo.de>2021-02-02 17:40:29 +0100
commit22d489be76271e36259ab1c7f76dbd88e6fdca2e (patch)
tree92663d83350193797f1d201b16416056aea80491 /compiler/rustc_metadata/src/rmeta/decoder.rs
parenta3ed564c130ec3f19e933a9ea31faca5a717ce91 (diff)
downloadrust-22d489be76271e36259ab1c7f76dbd88e6fdca2e.tar.gz
rust-22d489be76271e36259ab1c7f76dbd88e6fdca2e.zip
Let a portion of DefPathHash uniquely identify the DefPath's crate.
This allows to directly map from a DefPathHash to the crate it
originates from, without constructing side tables to do that mapping.

It also allows to reliably and cheaply check for DefPathHash collisions.
Diffstat (limited to 'compiler/rustc_metadata/src/rmeta/decoder.rs')
-rw-r--r--compiler/rustc_metadata/src/rmeta/decoder.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/rustc_metadata/src/rmeta/decoder.rs b/compiler/rustc_metadata/src/rmeta/decoder.rs
index e3c35390798..e9b8388c1c9 100644
--- a/compiler/rustc_metadata/src/rmeta/decoder.rs
+++ b/compiler/rustc_metadata/src/rmeta/decoder.rs
@@ -635,6 +635,10 @@ impl CrateRoot<'_> {
         self.hash
     }
 
+    crate fn stable_crate_id(&self) -> StableCrateId {
+        self.stable_crate_id
+    }
+
     crate fn triple(&self) -> &TargetTriple {
         &self.triple
     }