Closed
Description
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.
Activity
pierwill commentedon Oct 12, 2021
@rustbot claim
pierwill commentedon Oct 12, 2021
Looks like this code has moved. Still looking into what happened.
pierwill commentedon Oct 13, 2021
The crate disambiguator was moved to
rustc_span::StableCrateId
in #85804.pierwill commentedon Oct 13, 2021
This looks like the relevant code:
rust/compiler/rustc_span/src/def_id.rs
Lines 148 to 175 in 0446743
rustc_span::StableCrateId
#89836Rollup merge of rust-lang#89836 - pierwill:fix-85142-crate-hash, r=bj…