diff --git a/Cargo.lock b/Cargo.lock index 696b797e612f9..f83bd25f617ac 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4412,6 +4412,7 @@ dependencies = [ "gsgdt", "parking_lot", "polonius-engine", + "rustc-demangle", "rustc_abi", "rustc_apfloat", "rustc_arena", diff --git a/README.md b/README.md index ed35016eb3a23..fa50f0aedcc41 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,8 @@ See [CONTRIBUTING.md](CONTRIBUTING.md). For a detailed explanation of the compiler's architecture and how to begin contributing, see the [rustc-dev-guide](https://rustc-dev-guide.rust-lang.org/). +test1 + ## License Rust is primarily distributed under the terms of both the MIT license and the diff --git a/compiler/rustc_middle/Cargo.toml b/compiler/rustc_middle/Cargo.toml index b26969a830f11..0ca2b23e8dab1 100644 --- a/compiler/rustc_middle/Cargo.toml +++ b/compiler/rustc_middle/Cargo.toml @@ -10,6 +10,7 @@ either = "1.5.0" gsgdt = "0.1.2" parking_lot = "0.12" polonius-engine = "0.13.0" +rustc-demangle = "0.1.28" rustc_abi = { path = "../rustc_abi" } rustc_apfloat = "0.2.0" rustc_arena = { path = "../rustc_arena" } diff --git a/compiler/rustc_middle/src/mono.rs b/compiler/rustc_middle/src/mono.rs index 76828cbee60f1..397189a1c9074 100644 --- a/compiler/rustc_middle/src/mono.rs +++ b/compiler/rustc_middle/src/mono.rs @@ -586,7 +586,12 @@ impl<'tcx> CodegenUnit<'tcx> { // See https://github.com/rust-lang/rust/pull/145358 for more details. // // Sorting by symbol name should not incur any new non-determinism. - items.sort_by_cached_key(|&(i, _)| i.symbol_name(tcx)); + items.sort_by_cached_key(|&(i, _)| { + let symbol_name = i.symbol_name(tcx); + let demangled = rustc_demangle::demangle(symbol_name.name); + let name_without_disambiguator = format!("{:#}", demangled); + (name_without_disambiguator, symbol_name) + }); } else { items.sort_by_cached_key(|&(i, _)| item_sort_key(tcx, i)); }