diff --git a/src/backend/libs-and-metadata.md b/src/backend/libs-and-metadata.md index 91d8cb3aa..d2cf8b692 100644 --- a/src/backend/libs-and-metadata.md +++ b/src/backend/libs-and-metadata.md @@ -72,8 +72,8 @@ Here are a few highlights of things it contains: from any other version. * The [Strict Version Hash](#strict-version-hash) (SVH). This helps ensure the correct dependency is loaded. -* The [Crate Disambiguator](#crate-disambiguator). This is a hash used - to disambiguate between different crates of the same name. +* The [Stable Crate Id](#stable-crate-id). This is a hash used + to identify crates. * Information about all the source files in the library. This can be used for a variety of things, such as diagnostics pointing to sources in a dependency. @@ -114,21 +114,22 @@ computed. [incremental compilation]: ../queries/incremental-compilation.md [`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 -### Crate Disambiguator +### Stable Crate Id -The [`CrateDisambiguator`] is a 128-bit hash used to distinguish between -different crates of the same name. It is a hash of all the [`-C metadata`] CLI -options computed in [`compute_crate_disambiguator`]. It is used in a variety -of places, such as symbol name mangling, crate loading, and much more. +The [`StableCrateId`] is a 64-bit hash used to identify different crates with +potentially the same name. It is a hash of the crate name and all the +[`-C metadata`] CLI options computed in [`StableCrateId::new`]. It is +used in a variety of places, such as symbol name mangling, crate loading, and +much more. -By default, all Rust symbols are mangled and incorporate the disambiguator -hash. This allows multiple versions of the same crate to be included together. -Cargo automatically generates `-C metadata` hashes based on a variety of -factors, like the package version, source, and the target kind (a lib and bin -can have the same crate name, so they need to be disambiguated). +By default, all Rust symbols are mangled and incorporate the stable crate id. +This allows multiple versions of the same crate to be included together. Cargo +automatically generates `-C metadata` hashes based on a variety of factors, +like the package version, source, and the target kind (a lib and test can have +the same crate name, so they need to be disambiguated). -[`CrateDisambiguator`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_ast/crate_disambiguator/struct.CrateDisambiguator.html -[`compute_crate_disambiguator`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_interface/util/fn.compute_crate_disambiguator.html +[`StableCrateId`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_span/def_id/struct.StableCrateId.html +[`StableCrateId::new`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_span/def_id/struct.StableCrateId.html#method.new [`-C metadata`]: https://doc.rust-lang.org/rustc/codegen-options/index.html#metadata ## Crate loading