@@ -72,8 +72,8 @@ Here are a few highlights of things it contains:
7272 from any other version.
7373* The [ Strict Version Hash] ( #strict-version-hash ) (SVH). This helps ensure the
7474 correct dependency is loaded.
75- * The [ Crate Disambiguator ] ( #crate-disambiguator ) . This is a hash used
76- to disambiguate between different crates of the same name .
75+ * The [ Stable Crate Id ] ( #stable- crate-id ) . This is a hash used
76+ to identify crates.
7777* Information about all the source files in the library. This can be used for
7878 a variety of things, such as diagnostics pointing to sources in a
7979 dependency.
@@ -114,21 +114,22 @@ computed.
114114[ incremental compilation ] : ../queries/incremental-compilation.md
115115[ `finalize_and_compute_crate_hash` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/hir/map/collector/struct.NodeCollector.html#method.finalize_and_compute_crate_hash
116116
117- ### Crate Disambiguator
117+ ### Stable Crate Id
118118
119- The [ ` CrateDisambiguator ` ] is a 128-bit hash used to distinguish between
120- different crates of the same name. It is a hash of all the [ ` -C metadata ` ] CLI
121- options computed in [ ` compute_crate_disambiguator ` ] . It is used in a variety
122- of places, such as symbol name mangling, crate loading, and much more.
119+ The [ ` StableCrateId ` ] is a 64-bit hash used to identify different crates with
120+ potentially the same name. It is a hash of the crate name and all the
121+ [ ` -C metadata ` ] CLI options computed in [ ` StableCrateId::new ` ] . It is
122+ used in a variety of places, such as symbol name mangling, crate loading, and
123+ much more.
123124
124- By default, all Rust symbols are mangled and incorporate the disambiguator
125- hash. This allows multiple versions of the same crate to be included together.
126- Cargo automatically generates ` -C metadata ` hashes based on a variety of
127- factors, like the package version, source, and the target kind (a lib and bin
128- can have the same crate name, so they need to be disambiguated).
125+ By default, all Rust symbols are mangled and incorporate the stable crate id.
126+ This allows multiple versions of the same crate to be included together. Cargo
127+ automatically generates ` -C metadata ` hashes based on a variety of factors,
128+ like the package version, source, and the target kind (a lib and test can have
129+ the same crate name, so they need to be disambiguated).
129130
130- [ `CrateDisambiguator ` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_ast/crate_disambiguator /struct.CrateDisambiguator .html
131- [ `compute_crate_disambiguator ` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_interface/util/fn.compute_crate_disambiguator .html
131+ [ `StableCrateId ` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_span/def_id /struct.StableCrateId .html
132+ [ `StableCrateId::new ` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_span/def_id/struct.StableCrateId .html#method.new
132133[ `-C metadata` ] : https://doc.rust-lang.org/rustc/codegen-options/index.html#metadata
133134
134135## Crate loading
0 commit comments