-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Include rustc version in crate disambiguator #85142
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Labels
A-linkage
Area: linking into static, shared libraries and binaries
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
@rustbot claim |
Looks like this code has moved. Still looking into what happened. |
The crate disambiguator was moved to |
This looks like the relevant code: rust/compiler/rustc_span/src/def_id.rs Lines 148 to 175 in 0446743
|
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Nov 21, 2021
…orn3 Include rustc version in `rustc_span::StableCrateId` `rustc_span::def_id::StableCrateId` is a hash of various data about a crate during compilation. This PR includes the version of `rustc` in the input when computing this hash. From a cursory reading of [RFC 2603](https://rust-lang.github.io/rfcs/2603-rust-symbol-name-mangling-v0.html), this appears to be acceptable within that design. In order to pass the `mir-opt` and `ui` test suites, this adds new [normalization for hashes and symbol names in `compiletest`](https://github.com/rust-lang/rust/pull/89836/files#diff-03a0567fa80ca04ed5a55f9ac5c711b4f84659be2d0ac4a984196d581c04f76b). These are enabled by default, but we might prefer it to be configurable. In the UI tests, I had to truncate a signification amount of error annotations in v0 symbols (and maybe some legacy) in order to get the normalization to work correctly. (See rust-lang#90116.) Closes rust-lang#85142.
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Labels
A-linkage
Area: linking into static, shared libraries and binaries
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Uh oh!
There was an error while loading. Please reload this page.
Otherwise with
-Zsymbol-mangling-version=v0
and no-Cmetadata
, symbols from the same crate compiled with different versions of rustc are named the same. This makes it possible to replace a rust dylib compiled with one version of rustc with one compiled by another version of rustc even if the ABI doesn't match.The crate disambiguator is calculated at
rust/compiler/rustc_interface/src/util.rs
Lines 500 to 531 in 354cc75
option_env!("CFG_VERSION").unwrap_or("unknown version")
in the hash. This matches what the version info included in the rustc metadata header.The text was updated successfully, but these errors were encountered: