Skip to content

Use Rust Symbol Mangling by default - #85530

Closed
tmiasko wants to merge 6 commits into
rust-lang:masterfrom
tmiasko:rust-symbol-mangling
Closed

Use Rust Symbol Mangling by default#85530
tmiasko wants to merge 6 commits into
rust-lang:masterfrom
tmiasko:rust-symbol-mangling

Conversation

@tmiasko

Copy link
Copy Markdown
Contributor

@rust-highfiverust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 20, 2021
@tmiasko

Copy link
Copy Markdown
ContributorAuthor

@bors try

@bors

bors commented May 20, 2021

Copy link
Copy Markdown
Collaborator

⌛ Trying commit 493a43f55df7482188e83d68b8ca1bfc26bfd11a with merge ce59db7a1b1b012fb2793c4641c1bdecad7a128b...

@rust-log-analyzer

This comment has been minimized.

@bors

bors commented May 20, 2021

Copy link
Copy Markdown
Collaborator

☀️ Try build successful - checks-actions
Build commit: ce59db7a1b1b012fb2793c4641c1bdecad7a128b (ce59db7a1b1b012fb2793c4641c1bdecad7a128b)

@tmiasko

Copy link
Copy Markdown
ContributorAuthor

@craterbot run mode=build-and-test

@craterbot

Copy link
Copy Markdown
Collaborator

🔒 Error: you're not allowed to interact with this bot.

🔑 If you are a member of the Rust team and need access, add yourself to the whitelist.
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@michaelwoerister

Copy link
Copy Markdown
Member

@craterbot run mode=build-and-test

@craterbot

Copy link
Copy Markdown
Collaborator

👌 Experiment pr-85530 created and queued.
🤖 Automatically detected try build ce59db7a1b1b012fb2793c4641c1bdecad7a128b
🔍 You can check out the queue and this experiment's details.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbotcraterbot added S-waiting-on-crater Status: Waiting on a crater run to be completed. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 21, 2021
@michaelwoerister

Copy link
Copy Markdown
Member

Thanks for the PR, @tmiasko!

cc #60705

@bjorn3

Copy link
Copy Markdown
Member

Should this get a perf run?

@klensy

Copy link
Copy Markdown
Contributor

Should this get a perf run?

As i understand, this pr does double work: it mangle and demangle at the same time

ifletErr(_) = rustc_demangle::try_demangle(&mangled){bug!("demangle error: {:?}\n{}", instance, mangled);}

So perf run will show some non related info.

@michaelwoerister

Copy link
Copy Markdown
Member

Yeah, I was debating whether it makes sense to do a perf run here but as @klensy points out, we also do the demangling check.

I would be interested to see how expensive that demangling check is. But we'll need a compiler with the new mangling scheme enabled by default as baseline. We could do that in another PR. It would be great if we could do the demangling check unconditionally -- although doing it as a debug assertion would also be a big improvement.

@Mark-Simulacrum

Copy link
Copy Markdown
Member

@michaelwoerister@tmiasko Can you share why this needs to be a build-and-test Crater run? I think just building should suffice; that builds tests too: https://github.com/rust-lang/crater/blob/aa40b144e61f7f1c6ba6a3bfc5e85b52b9e4a177/src/runner/test.rs#L233

If mangling changes introduce different runtime behavior that would seem very surprising to me and likely hard to catch reliably with crater (e.g., collisions seem likely to be pretty hard to identify unless they cause obvious linker errors).

@tmiasko

Copy link
Copy Markdown
ContributorAuthor

@Mark-Simulacrum potential interaction with mechanisms for collecting & formatting backtraces was one of motivations for opting for some runtime coverage. Generally, reducing the scope of a crater run to build only, seems fine to me.

@craterbot

Copy link
Copy Markdown
Collaborator

🚧 Experiment pr-85530 is now running

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot

Copy link
Copy Markdown
Collaborator

🎉 Experiment pr-85530 is completed!
📊 78 regressed and 58 fixed (163710 total)
📰 Open the full report.

⚠️ If you notice any spurious failure please add them to the blacklist!
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbotcraterbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-crater Status: Waiting on a crater run to be completed. labels Jun 9, 2021
@bjorn3

Copy link
Copy Markdown
Member

ICE for encoding_rs-0.8.28:

Details
[INFO] [stderr] thread 'rustc' panicked at 'Box<Any>', /rustc/ce59db7a1b1b012fb2793c4641c1bdecad7a128b/library/std/src/panic.rs:59:5
[INFO] [stdout] error: internal compiler error: compiler/rustc_symbol_mangling/src/v0.rs:568:17: symbol_names: unsupported constant of type `[u32; 16]` (Const { ty: [u32; 16], val: Value(ByRef { alloc: Allocation { bytes: [8, 0, 0, 0, 24, 0, 0, 0, 9, 0, 0, 0, 25, 0, 0, 0, 10, 0, 0, 0, 26, 0, 0, 0, 11, 0, 0, 0, 27, 0, 0, 0, 12, 0, 0, 0, 28, 0, 0, 0, 13, 0, 0, 0, 29, 0, 0, 0, 14, 0, 0, 0, 30, 0, 0, 0, 15, 0, 0, 0, 31, 0, 0, 0], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [18446744073709551615, 0], len: Size { raw: 64 } }, align: Align { pow2: 2 }, mutability: Not, extra: () }, offset: Size { raw: 0 } }) })
[INFO] [stdout] [INFO] [stdout] [INFO] [stderr] stack backtrace:
[INFO] [stderr] 0: 0x7f328cbf74c0 - std[77c0456e0eb29f0c]::backtrace_rs::backtrace::libunwind::trace
[INFO] [stderr] at /rustc/ce59db7a1b1b012fb2793c4641c1bdecad7a128b/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
[INFO] [stderr] 1: 0x7f328cbf74c0 - std[77c0456e0eb29f0c]::backtrace_rs::backtrace::trace_unsynchronized::<std[77c0456e0eb29f0c]::sys_common::backtrace::_print_fmt::{closure#1}>
[INFO] [stderr] at /rustc/ce59db7a1b1b012fb2793c4641c1bdecad7a128b/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
[INFO] [stderr] 2: 0x7f328cbf74c0 - std[77c0456e0eb29f0c]::sys_common::backtrace::_print_fmt
[INFO] [stderr] at /rustc/ce59db7a1b1b012fb2793c4641c1bdecad7a128b/library/std/src/sys_common/backtrace.rs:67:5
[INFO] [stderr] 3: 0x7f328cbf74c0 - <std[77c0456e0eb29f0c]::sys_common::backtrace::_print::DisplayBacktrace as core[ee1ca6415511a9c4]::fmt::Display>::fmt
[INFO] [stderr] at /rustc/ce59db7a1b1b012fb2793c4641c1bdecad7a128b/library/std/src/sys_common/backtrace.rs:46:22
[INFO] [stderr] 4: 0x7f328cc64e9c - core[ee1ca6415511a9c4]::fmt::write
[INFO] [stderr] at /rustc/ce59db7a1b1b012fb2793c4641c1bdecad7a128b/library/core/src/fmt/mod.rs:1110:17
[INFO] [stderr] 5: 0x7f328cbe8e15 - <std[77c0456e0eb29f0c]::sys::unix::stdio::Stderr as std[77c0456e0eb29f0c]::io::Write>::write_fmt
[INFO] [stderr] at /rustc/ce59db7a1b1b012fb2793c4641c1bdecad7a128b/library/std/src/io/mod.rs:1584:15
[INFO] [stderr] 6: 0x7f328cbfb20b - std[77c0456e0eb29f0c]::sys_common::backtrace::_print
[INFO] [stderr] at /rustc/ce59db7a1b1b012fb2793c4641c1bdecad7a128b/library/std/src/sys_common/backtrace.rs:49:5
[INFO] [stderr] 7: 0x7f328cbfb20b - std[77c0456e0eb29f0c]::sys_common::backtrace::print
[INFO] [stderr] at /rustc/ce59db7a1b1b012fb2793c4641c1bdecad7a128b/library/std/src/sys_common/backtrace.rs:36:9
[INFO] [stderr] 8: 0x7f328cbfb20b - std[77c0456e0eb29f0c]::panicking::default_hook::{closure#1}
[INFO] [stderr] at /rustc/ce59db7a1b1b012fb2793c4641c1bdecad7a128b/library/std/src/panicking.rs:208:50
[INFO] [stderr] 9: 0x7f328cbface1 - std[77c0456e0eb29f0c]::panicking::default_hook
[INFO] [stderr] at /rustc/ce59db7a1b1b012fb2793c4641c1bdecad7a128b/library/std/src/panicking.rs:225:9
[INFO] [stderr] 10: 0x7f328d3b0afd - rustc_driver[483abbcf9e72e7cf]::report_ice
[INFO] [stderr] 11: 0x7f328cbfba16 - std[77c0456e0eb29f0c]::panicking::rust_panic_with_hook
[INFO] [stderr] at /rustc/ce59db7a1b1b012fb2793c4641c1bdecad7a128b/library/std/src/panicking.rs:626:17
[INFO] [stderr] 12: 0x7f328e37234b - std[77c0456e0eb29f0c]::panicking::begin_panic::<rustc_errors[a6601eba5631ab8e]::ExplicitBug>::{closure#0}
[INFO] [stderr] 13: 0x7f328e372296 - std[77c0456e0eb29f0c]::sys_common::backtrace::__rust_end_short_backtrace::<std[77c0456e0eb29f0c]::panicking::begin_panic<rustc_errors[a6601eba5631ab8e]::ExplicitBug>::{closure#0}, !>
[INFO] [stderr] 14: 0x7f328e37361f - std[77c0456e0eb29f0c]::panicking::begin_panic::<rustc_errors[a6601eba5631ab8e]::ExplicitBug>
[INFO] [stderr] 15: 0x7f328e38b73d - std[77c0456e0eb29f0c]::panic::panic_any::<rustc_errors[a6601eba5631ab8e]::ExplicitBug>
[INFO] [stderr] 16: 0x7f328e38e5da - <rustc_errors[a6601eba5631ab8e]::HandlerInner>::bug
[INFO] [stderr] 17: 0x7f328e38e080 - <rustc_errors[a6601eba5631ab8e]::Handler>::bug
[INFO] [stderr] 18: 0x7f328e2c8450 - rustc_middle[4cd8eb4e66530e50]::ty::context::tls::with_opt::<rustc_middle[4cd8eb4e66530e50]::util::bug::opt_span_bug_fmt<rustc_span[41f5d8395d191526]::span_encoding::Span>::{closure#0}, ()>
[INFO] [stderr] 19: 0x7f328e2cd500 - rustc_middle[4cd8eb4e66530e50]::util::bug::opt_span_bug_fmt::<rustc_span[41f5d8395d191526]::span_encoding::Span>
[INFO] [stderr] 20: 0x7f328e2cd476 - rustc_middle[4cd8eb4e66530e50]::util::bug::bug_fmt
[INFO] [stderr] 21: 0x7f328f4f7957 - <rustc_symbol_mangling[e3ac7cad7aae7613]::v0::SymbolMangler as rustc_middle[4cd8eb4e66530e50]::ty::print::Printer>::print_const
[INFO] [stderr] 22: 0x7f328ead1f79 - <rustc_symbol_mangling[e3ac7cad7aae7613]::v0::SymbolMangler as rustc_middle[4cd8eb4e66530e50]::ty::print::Printer>::print_def_path
[INFO] [stderr] 23: 0x7f328eace1ac - rustc_symbol_mangling[e3ac7cad7aae7613]::v0::mangle
[INFO] [stderr] 24: 0x7f328eadafba - rustc_symbol_mangling[e3ac7cad7aae7613]::symbol_name_provider
[INFO] [stderr] 25: 0x7f328e7a7183 - <rustc_query_impl[73652419363b7eb3]::queries::symbol_name as rustc_query_system[195a98efe178d20a]::query::config::QueryAccessors<rustc_query_impl[73652419363b7eb3]::plumbing::QueryCtxt>>::compute
[INFO] [stderr] 26: 0x7f328e7ee766 - <rustc_query_system[195a98efe178d20a]::dep_graph::graph::DepGraph<rustc_middle[4cd8eb4e66530e50]::dep_graph::dep_node::DepKind>>::with_task_impl::<rustc_query_impl[73652419363b7eb3]::plumbing::QueryCtxt, rustc_middle[4cd8eb4e66530e50]::ty::instance::Instance, rustc_middle[4cd8eb4e66530e50]::ty::SymbolName, for<'a, 'b> fn(&'a mut rustc_middle[4cd8eb4e66530e50]::ich::hcx::StableHashingContext, &'b rustc_middle[4cd8eb4e66530e50]::ty::SymbolName) -> core[ee1ca6415511a9c4]::option::Option<rustc_data_structures[52e6d6087bd5b52c]::fingerprint::Fingerprint>>
[INFO] [stderr] 27: 0x7f328e7fa9af - rustc_data_structures[52e6d6087bd5b52c]::stack::ensure_sufficient_stack::<(rustc_middle[4cd8eb4e66530e50]::ty::SymbolName, rustc_query_system[195a98efe178d20a]::dep_graph::graph::DepNodeIndex), rustc_query_system[195a98efe178d20a]::query::plumbing::force_query_with_job<rustc_query_system[195a98efe178d20a]::query::caches::DefaultCache<rustc_middle[4cd8eb4e66530e50]::ty::instance::Instance, rustc_middle[4cd8eb4e66530e50]::ty::SymbolName>, rustc_query_impl[73652419363b7eb3]::plumbing::QueryCtxt>::{closure#0}::{closure#0}>
[...]

@tmiasko

Copy link
Copy Markdown
ContributorAuthor

Errors related to the use of unstable const generics feature with types that are currently unsupported in v0 mangling:

  • ametisf/snapshot_repeat <impl at src/lib.rs:30:1: 40:2>::to_norm (unsupported constant of type f32)
  • bounded 0.1.2 temp::temp::<std::collections::Bound::<usize>::Included(0_usize), std::collections::Bound::<usize>::Included(9_usize)>
  • danielbank/rust-const-generics <impl at examples/state.rs:17:1: 25:2>::freeze (unsupported constant of type &str)
  • encoding-rs 0.8.28 packed_simd::__shuffle_vector16::<[8_u32, 24_u32, 9_u32, 25_u32, 10_u32, 26_u32, 11_u32, 27_u32, 12_u32, 28_u32, 13_u32, 29_u32, 14_u32, 30_u32, 15_u32, 31_u32], packed_simd::codegen::v128::u8x16, packed_simd::codegen::v128::u8x16>
  • fast_rsync 0.1.3 packed_simd_2::__shuffle_vector8::<[2_u32, 10_u32, 3_u32, 11_u32, 6_u32, 14_u32, 7_u32, 15_u32], packed_simd_2::codegen::v256::u32x8, packed_simd_2::codegen::v256::u32x8>
  • nommy 0.4.1 parse::<[text::tag::Tag<".">; 3], std::str::Chars>
  • ritobanrc/firework <typetag::erased_serde::de::erase::Visitor<objects::rect::_::<impl at src/objects/rect.rs:13:28: 13:46>::deserialize::__FieldVisitor> as typetag::erased_serde::de::Visitor>::erased_visit_i64 (unsupported constant of type Axis)
  • tiny-uom 0.1.0 <tiny_uom::Quantity<tiny_uom::Unit { m: 1_i8, kg: 0_i8, s: -1_i8, A: 0_i8, K: 0_i8, mol: 0_i8, cd: 0_i8 }> as std::fmt::Debug>::fmt
  • umbra-lang 0.15.0 ops::<impl at src/ops.rs:637:1: 654:2>::op (unsupported constant of type ops::Op)

In logs there are two dozens of backtraces with mangled symbols (in cases where crate internally uses rustc-demangle crate without support for v0 mangling scheme).

The backtraces generated for RUST_BACKTRACE=full now include a crate hash for every mangled path, so there might be multiple hashes per symbol. Together with generic arguments this is even more verbose than before.

Summary of results:

Resultlegacyv0
broken:cargo-toml19121912
broken:missing-deps27302730
broken:missing-git-repository1274712747
broken:yanked377377
build-fail:compiler-error92019172
build-fail:depends-on1358413551
build-fail:ice310
build-fail:oom72017460
build-fail:timeout7872
build-fail:unknown1072810728
error328328
test-fail:oom599625
test-fail:timeout277272
test-fail:unknown87308698
test-pass9514994962
test-skipped5959

The most immediate question raised by those results is related to const generics. Enabling new mangling scheme will make it harder to experiment with unstable parts of const generics. Should we wait with switching the default until new mangling reaches parity with legacy scheme?

@tmiasko
tmiaskoforce-pushed the rust-symbol-mangling branch from 493a43f to d56c498CompareJune 18, 2021 19:38
@tmiasko

Copy link
Copy Markdown
ContributorAuthor

@bors try @rust-timer queue

@rust-timer

Copy link
Copy Markdown
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rustbotrustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jun 18, 2021
@eddyb

Copy link
Copy Markdown
Contributor

@craterbot

Copy link
Copy Markdown
Collaborator

🚨 Error: missing desired crates: {"https://crater-reports.s3.amazonaws.com/pr-85530/retry-regressed-list.txt"}

🆘 If you have any trouble with Crater please ping @rust-lang/infra!
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@eddyb

Copy link
Copy Markdown
Contributor

@craterbot run mode=build-and-test crates=https://crater-reports.s3.amazonaws.com/pr-85530/retry-regressed-list.txt p=1

@Mark-Simulacrum if this one works (see my previous failed attempt above), the crater docs need updating AFAICT.

@craterbot

Copy link
Copy Markdown
Collaborator

👌 Experiment pr-85530-1 created and queued.
🤖 Automatically detected try build 2b00690a2a9987274f9d399383a581d5df1bf5df
🔍 You can check out the queue and this experiment's details.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbotcraterbot added S-waiting-on-crater Status: Waiting on a crater run to be completed. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 18, 2021
@craterbot

Copy link
Copy Markdown
Collaborator

🚧 Experiment pr-85530-1 is now running

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot

Copy link
Copy Markdown
Collaborator

🎉 Experiment pr-85530-1 is completed!
📊 15 regressed and 11 fixed (78 total)
📰 Open the full report.

⚠️ If you notice any spurious failure please add them to the blacklist!
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbotcraterbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-crater Status: Waiting on a crater run to be completed. labels Jul 20, 2021
@eddyb

Copy link
Copy Markdown
Contributor

I'm not sure I'm not missing anything (I didn't open every single log), but AFAICT this is the only regression now:

error: internal compiler error: compiler/rustc_symbol_mangling/src/v0.rs:693:17:
symbol_names: unsupported constant of type `f32` (Const{ty: f32,val:Value(Scalar(0x3f800000))})

I explicitly said I don't want to support f32, it's a bug that it's not disallowed much earlier in the compilation, so this is fine.

@tmiasko

Copy link
Copy Markdown
ContributorAuthor

It looks like #87194 will contain all necessary changes, and this PR already served its role for crater run, so I am going to close it now.

Remaining test changes, that are not already part of #87194, landed in #87789.

@tmiaskotmiasko closed this Aug 8, 2021
@tmiasko
tmiasko deleted the rust-symbol-mangling branch August 8, 2021 10:45
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 26, 2021
…woerister,oli-obk
rustc_symbol_mangling: support structural constants and &str in v0.
This PR should unblock rust-lang#85530 (except for float `const` generics, which AFAIK should've never worked).
(cc `@tmiasko` could the rust-lang#85530 (comment) failures be retried with a quick crater "subset" run of this PR + changing the default to `v0`? Just to make sure I didn't miss anything other than the floats)
The encoding is the one suggested before in e.g. rust-lang#61486 (comment), tho this PR won't by itself finish rust-lang#61486, before closing that we'd likely want to move to `@oli-obk's` "valtrees" (i.e. rust-lang#83234 and other associated work).
<hr>
**EDITs**:
1. switched unit/tuple/braced-with-named-fields `<const-fields>` prefixes from `"u"`/`"T"`/`""` to `"U"`/`"T"`/`"S"` to avoid the ambiguity reported by `@tmiasko` in rust-lang#87194 (comment).
2. `rustc-demangle` PR: rust-lang/rustc-demangle#55
3. RFC amendment PR: rust-lang/rfcs#3161
* also removed the grammar changes included in that PR, from this description
4. added tests (temporarily using my fork of `rustc-demangle`)
<hr>
r? `@michaelwoerister`
bors added a commit that referenced this pull request Nov 11, 2025
…ngling-scheme, r=wesleywiser
sess: default to v0 symbol mangling on nightly
cc #60705rust-lang/compiler-team#938
Rust's current mangling scheme depends on compiler internals; loses information about generic parameters (and other things) which makes for a worse experience when using external tools that need to interact with Rust symbol names; is inconsistent; and can contain `.` characters which aren't universally supported. Therefore, Rust has defined its own symbol mangling scheme which is defined in terms of the Rust language, not the compiler implementation; encodes information about generic parameters in a reversible way; has a consistent definition; and generates symbols that only use the characters `A-Z`, `a-z`, `0-9`, and `_`.
Support for the new Rust symbol mangling scheme has been added to upstream tools that will need to interact with Rust symbols (e.g. debuggers).
This pull request changes the default symbol mangling scheme from the legacy scheme to the new Rust mangling scheme on nightly.
The following pull requests implemented v0 mangling in rustc (if I'm missing any, let me know):
- #57967
- #63559
- #75675
- #77452
- #77554
- #83767
- #87194
- #87789
Rust's symbol mangling scheme has support in the following external tools:
- `binutils`/`gdb` (GNU `libiberty`)
- [[PATCH] Move rust_{is_mangled,demangle_sym} to a private libiberty header.
](https://gcc.gnu.org/pipermail/gcc-patches/2019-June/523011.html) committed as gcc-mirror/gcc@979526c
- [[PATCH] Simplify and generalize rust-demangle's unescaping logic.
](https://gcc.gnu.org/pipermail/gcc-patches/2019-August/527835.html) committed as gcc-mirror/gcc@42bf58b
- [[PATCH] Remove some restrictions from rust-demangle.
](https://gcc.gnu.org/pipermail/gcc-patches/2019-September/530445.html) committed as gcc-mirror/gcc@e1cb00d
- [[PATCH] Refactor rust-demangle to be independent of C++ demangling.
](https://gcc.gnu.org/pipermail/gcc-patches/2019-November/533719.html) ([original submission](https://gcc.gnu.org/pipermail/gcc-patches/2019-October/532388.html)) committed as gcc-mirror/gcc@32fc371
- [[PATCH] Support the new ("v0") mangling scheme in rust-demangle.
](https://gcc.gnu.org/pipermail/gcc-patches/2020-November/558905.html) ([original submission](https://gcc.gnu.org/pipermail/gcc-patches/2020-March/542012.html)) committed as gcc-mirror/gcc@8409649
- `lldb`/`llvm-objdump`/`llvm-nm`/`llvm-symbolizer`/`llvm-cxxfilt`/etc
- llvm/llvm-project@7310403
- llvm/llvm-project@c8c2b46
- llvm/llvm-project@0a2d4f3
- Linux `perf`
- `valgrind`
- [Update demangler to support Rust v0 name mangling.](https://bugs.kde.org/show_bug.cgi?id=431306)
#85530 (comment) contains a summary of the most recent crater run of the v0 mangling, and the remaining issues from that were fixed by #87194 (confirmed by follow-up crater run, #85530 (comment)).
`@rustbot` label +T-compiler
r? `@michaelwoerister`
bors added a commit that referenced this pull request Nov 17, 2025
…ngling-scheme, r=wesleywiser
sess: default to v0 symbol mangling on nightly
cc #60705rust-lang/compiler-team#938
Rust's current mangling scheme depends on compiler internals; loses information about generic parameters (and other things) which makes for a worse experience when using external tools that need to interact with Rust symbol names; is inconsistent; and can contain `.` characters which aren't universally supported. Therefore, Rust has defined its own symbol mangling scheme which is defined in terms of the Rust language, not the compiler implementation; encodes information about generic parameters in a reversible way; has a consistent definition; and generates symbols that only use the characters `A-Z`, `a-z`, `0-9`, and `_`.
Support for the new Rust symbol mangling scheme has been added to upstream tools that will need to interact with Rust symbols (e.g. debuggers).
This pull request changes the default symbol mangling scheme from the legacy scheme to the new Rust mangling scheme on nightly.
The following pull requests implemented v0 mangling in rustc (if I'm missing any, let me know):
- #57967
- #63559
- #75675
- #77452
- #77554
- #83767
- #87194
- #87789
Rust's symbol mangling scheme has support in the following external tools:
- `binutils`/`gdb` (GNU `libiberty`)
- [[PATCH] Move rust_{is_mangled,demangle_sym} to a private libiberty header.
](https://gcc.gnu.org/pipermail/gcc-patches/2019-June/523011.html) committed as gcc-mirror/gcc@979526c
- [[PATCH] Simplify and generalize rust-demangle's unescaping logic.
](https://gcc.gnu.org/pipermail/gcc-patches/2019-August/527835.html) committed as gcc-mirror/gcc@42bf58b
- [[PATCH] Remove some restrictions from rust-demangle.
](https://gcc.gnu.org/pipermail/gcc-patches/2019-September/530445.html) committed as gcc-mirror/gcc@e1cb00d
- [[PATCH] Refactor rust-demangle to be independent of C++ demangling.
](https://gcc.gnu.org/pipermail/gcc-patches/2019-November/533719.html) ([original submission](https://gcc.gnu.org/pipermail/gcc-patches/2019-October/532388.html)) committed as gcc-mirror/gcc@32fc371
- [[PATCH] Support the new ("v0") mangling scheme in rust-demangle.
](https://gcc.gnu.org/pipermail/gcc-patches/2020-November/558905.html) ([original submission](https://gcc.gnu.org/pipermail/gcc-patches/2020-March/542012.html)) committed as gcc-mirror/gcc@8409649
- `lldb`/`llvm-objdump`/`llvm-nm`/`llvm-symbolizer`/`llvm-cxxfilt`/etc
- llvm/llvm-project@7310403
- llvm/llvm-project@c8c2b46
- llvm/llvm-project@0a2d4f3
- Linux `perf`
- `valgrind`
- [Update demangler to support Rust v0 name mangling.](https://bugs.kde.org/show_bug.cgi?id=431306)
#85530 (comment) contains a summary of the most recent crater run of the v0 mangling, and the remaining issues from that were fixed by #87194 (confirmed by follow-up crater run, #85530 (comment)).
`@rustbot` label +T-compiler
r? `@michaelwoerister`
bors added a commit that referenced this pull request Nov 19, 2025
…ngling-scheme, r=wesleywiser
sess: default to v0 symbol mangling on nightly
cc #60705rust-lang/compiler-team#938
Rust's current mangling scheme depends on compiler internals; loses information about generic parameters (and other things) which makes for a worse experience when using external tools that need to interact with Rust symbol names; is inconsistent; and can contain `.` characters which aren't universally supported. Therefore, Rust has defined its own symbol mangling scheme which is defined in terms of the Rust language, not the compiler implementation; encodes information about generic parameters in a reversible way; has a consistent definition; and generates symbols that only use the characters `A-Z`, `a-z`, `0-9`, and `_`.
Support for the new Rust symbol mangling scheme has been added to upstream tools that will need to interact with Rust symbols (e.g. debuggers).
This pull request changes the default symbol mangling scheme from the legacy scheme to the new Rust mangling scheme on nightly.
The following pull requests implemented v0 mangling in rustc (if I'm missing any, let me know):
- #57967
- #63559
- #75675
- #77452
- #77554
- #83767
- #87194
- #87789
Rust's symbol mangling scheme has support in the following external tools:
- `binutils`/`gdb` (GNU `libiberty`)
- [[PATCH] Move rust_{is_mangled,demangle_sym} to a private libiberty header.
](https://gcc.gnu.org/pipermail/gcc-patches/2019-June/523011.html) committed as gcc-mirror/gcc@979526c
- [[PATCH] Simplify and generalize rust-demangle's unescaping logic.
](https://gcc.gnu.org/pipermail/gcc-patches/2019-August/527835.html) committed as gcc-mirror/gcc@42bf58b
- [[PATCH] Remove some restrictions from rust-demangle.
](https://gcc.gnu.org/pipermail/gcc-patches/2019-September/530445.html) committed as gcc-mirror/gcc@e1cb00d
- [[PATCH] Refactor rust-demangle to be independent of C++ demangling.
](https://gcc.gnu.org/pipermail/gcc-patches/2019-November/533719.html) ([original submission](https://gcc.gnu.org/pipermail/gcc-patches/2019-October/532388.html)) committed as gcc-mirror/gcc@32fc371
- [[PATCH] Support the new ("v0") mangling scheme in rust-demangle.
](https://gcc.gnu.org/pipermail/gcc-patches/2020-November/558905.html) ([original submission](https://gcc.gnu.org/pipermail/gcc-patches/2020-March/542012.html)) committed as gcc-mirror/gcc@8409649
- `lldb`/`llvm-objdump`/`llvm-nm`/`llvm-symbolizer`/`llvm-cxxfilt`/etc
- llvm/llvm-project@7310403
- llvm/llvm-project@c8c2b46
- llvm/llvm-project@0a2d4f3
- Linux `perf`
- `valgrind`
- [Update demangler to support Rust v0 name mangling.](https://bugs.kde.org/show_bug.cgi?id=431306)
#85530 (comment) contains a summary of the most recent crater run of the v0 mangling, and the remaining issues from that were fixed by #87194 (confirmed by follow-up crater run, #85530 (comment)).
`@rustbot` label +T-compiler
r? `@michaelwoerister`
bors added a commit that referenced this pull request Nov 20, 2025
…ngling-scheme, r=wesleywiser
sess: default to v0 symbol mangling on nightly
cc #60705rust-lang/compiler-team#938
Rust's current mangling scheme depends on compiler internals; loses information about generic parameters (and other things) which makes for a worse experience when using external tools that need to interact with Rust symbol names; is inconsistent; and can contain `.` characters which aren't universally supported. Therefore, Rust has defined its own symbol mangling scheme which is defined in terms of the Rust language, not the compiler implementation; encodes information about generic parameters in a reversible way; has a consistent definition; and generates symbols that only use the characters `A-Z`, `a-z`, `0-9`, and `_`.
Support for the new Rust symbol mangling scheme has been added to upstream tools that will need to interact with Rust symbols (e.g. debuggers).
This pull request changes the default symbol mangling scheme from the legacy scheme to the new Rust mangling scheme on nightly.
The following pull requests implemented v0 mangling in rustc (if I'm missing any, let me know):
- #57967
- #63559
- #75675
- #77452
- #77554
- #83767
- #87194
- #87789
Rust's symbol mangling scheme has support in the following external tools:
- `binutils`/`gdb` (GNU `libiberty`)
- [[PATCH] Move rust_{is_mangled,demangle_sym} to a private libiberty header.
](https://gcc.gnu.org/pipermail/gcc-patches/2019-June/523011.html) committed as gcc-mirror/gcc@979526c
- [[PATCH] Simplify and generalize rust-demangle's unescaping logic.
](https://gcc.gnu.org/pipermail/gcc-patches/2019-August/527835.html) committed as gcc-mirror/gcc@42bf58b
- [[PATCH] Remove some restrictions from rust-demangle.
](https://gcc.gnu.org/pipermail/gcc-patches/2019-September/530445.html) committed as gcc-mirror/gcc@e1cb00d
- [[PATCH] Refactor rust-demangle to be independent of C++ demangling.
](https://gcc.gnu.org/pipermail/gcc-patches/2019-November/533719.html) ([original submission](https://gcc.gnu.org/pipermail/gcc-patches/2019-October/532388.html)) committed as gcc-mirror/gcc@32fc371
- [[PATCH] Support the new ("v0") mangling scheme in rust-demangle.
](https://gcc.gnu.org/pipermail/gcc-patches/2020-November/558905.html) ([original submission](https://gcc.gnu.org/pipermail/gcc-patches/2020-March/542012.html)) committed as gcc-mirror/gcc@8409649
- `lldb`/`llvm-objdump`/`llvm-nm`/`llvm-symbolizer`/`llvm-cxxfilt`/etc
- llvm/llvm-project@7310403
- llvm/llvm-project@c8c2b46
- llvm/llvm-project@0a2d4f3
- Linux `perf`
- `valgrind`
- [Update demangler to support Rust v0 name mangling.](https://bugs.kde.org/show_bug.cgi?id=431306)
#85530 (comment) contains a summary of the most recent crater run of the v0 mangling, and the remaining issues from that were fixed by #87194 (confirmed by follow-up crater run, #85530 (comment)).
`@rustbot` label +T-compiler
r? `@michaelwoerister`
RalfJung pushed a commit to RalfJung/miri that referenced this pull request Nov 21, 2025
…ngling-scheme, r=wesleywiser
sess: default to v0 symbol mangling on nightly
cc rust-lang/rust#60705rust-lang/compiler-team#938
Rust's current mangling scheme depends on compiler internals; loses information about generic parameters (and other things) which makes for a worse experience when using external tools that need to interact with Rust symbol names; is inconsistent; and can contain `.` characters which aren't universally supported. Therefore, Rust has defined its own symbol mangling scheme which is defined in terms of the Rust language, not the compiler implementation; encodes information about generic parameters in a reversible way; has a consistent definition; and generates symbols that only use the characters `A-Z`, `a-z`, `0-9`, and `_`.
Support for the new Rust symbol mangling scheme has been added to upstream tools that will need to interact with Rust symbols (e.g. debuggers).
This pull request changes the default symbol mangling scheme from the legacy scheme to the new Rust mangling scheme on nightly.
The following pull requests implemented v0 mangling in rustc (if I'm missing any, let me know):
- rust-lang/rust#57967
- rust-lang/rust#63559
- rust-lang/rust#75675
- rust-lang/rust#77452
- rust-lang/rust#77554
- rust-lang/rust#83767
- rust-lang/rust#87194
- rust-lang/rust#87789
Rust's symbol mangling scheme has support in the following external tools:
- `binutils`/`gdb` (GNU `libiberty`)
- [[PATCH] Move rust_{is_mangled,demangle_sym} to a private libiberty header.
](https://gcc.gnu.org/pipermail/gcc-patches/2019-June/523011.html) committed as gcc-mirror/gcc@979526c
- [[PATCH] Simplify and generalize rust-demangle's unescaping logic.
](https://gcc.gnu.org/pipermail/gcc-patches/2019-August/527835.html) committed as gcc-mirror/gcc@42bf58b
- [[PATCH] Remove some restrictions from rust-demangle.
](https://gcc.gnu.org/pipermail/gcc-patches/2019-September/530445.html) committed as gcc-mirror/gcc@e1cb00d
- [[PATCH] Refactor rust-demangle to be independent of C++ demangling.
](https://gcc.gnu.org/pipermail/gcc-patches/2019-November/533719.html) ([original submission](https://gcc.gnu.org/pipermail/gcc-patches/2019-October/532388.html)) committed as gcc-mirror/gcc@32fc371
- [[PATCH] Support the new ("v0") mangling scheme in rust-demangle.
](https://gcc.gnu.org/pipermail/gcc-patches/2020-November/558905.html) ([original submission](https://gcc.gnu.org/pipermail/gcc-patches/2020-March/542012.html)) committed as gcc-mirror/gcc@8409649
- `lldb`/`llvm-objdump`/`llvm-nm`/`llvm-symbolizer`/`llvm-cxxfilt`/etc
- llvm/llvm-project@7310403
- llvm/llvm-project@c8c2b46
- llvm/llvm-project@0a2d4f3
- Linux `perf`
- `valgrind`
- [Update demangler to support Rust v0 name mangling.](https://bugs.kde.org/show_bug.cgi?id=431306)
rust-lang/rust#85530 (comment) contains a summary of the most recent crater run of the v0 mangling, and the remaining issues from that were fixed by rust-lang/rust#87194 (confirmed by follow-up crater run, rust-lang/rust#85530 (comment)).
`@rustbot` label +T-compiler
r? `@michaelwoerister`
github-actionsBot pushed a commit to rust-lang/rust-analyzer that referenced this pull request Nov 27, 2025
…ngling-scheme, r=wesleywiser
sess: default to v0 symbol mangling on nightly
cc rust-lang/rust#60705rust-lang/compiler-team#938
Rust's current mangling scheme depends on compiler internals; loses information about generic parameters (and other things) which makes for a worse experience when using external tools that need to interact with Rust symbol names; is inconsistent; and can contain `.` characters which aren't universally supported. Therefore, Rust has defined its own symbol mangling scheme which is defined in terms of the Rust language, not the compiler implementation; encodes information about generic parameters in a reversible way; has a consistent definition; and generates symbols that only use the characters `A-Z`, `a-z`, `0-9`, and `_`.
Support for the new Rust symbol mangling scheme has been added to upstream tools that will need to interact with Rust symbols (e.g. debuggers).
This pull request changes the default symbol mangling scheme from the legacy scheme to the new Rust mangling scheme on nightly.
The following pull requests implemented v0 mangling in rustc (if I'm missing any, let me know):
- rust-lang/rust#57967
- rust-lang/rust#63559
- rust-lang/rust#75675
- rust-lang/rust#77452
- rust-lang/rust#77554
- rust-lang/rust#83767
- rust-lang/rust#87194
- rust-lang/rust#87789
Rust's symbol mangling scheme has support in the following external tools:
- `binutils`/`gdb` (GNU `libiberty`)
- [[PATCH] Move rust_{is_mangled,demangle_sym} to a private libiberty header.
](https://gcc.gnu.org/pipermail/gcc-patches/2019-June/523011.html) committed as gcc-mirror/gcc@979526c
- [[PATCH] Simplify and generalize rust-demangle's unescaping logic.
](https://gcc.gnu.org/pipermail/gcc-patches/2019-August/527835.html) committed as gcc-mirror/gcc@42bf58b
- [[PATCH] Remove some restrictions from rust-demangle.
](https://gcc.gnu.org/pipermail/gcc-patches/2019-September/530445.html) committed as gcc-mirror/gcc@e1cb00d
- [[PATCH] Refactor rust-demangle to be independent of C++ demangling.
](https://gcc.gnu.org/pipermail/gcc-patches/2019-November/533719.html) ([original submission](https://gcc.gnu.org/pipermail/gcc-patches/2019-October/532388.html)) committed as gcc-mirror/gcc@32fc371
- [[PATCH] Support the new ("v0") mangling scheme in rust-demangle.
](https://gcc.gnu.org/pipermail/gcc-patches/2020-November/558905.html) ([original submission](https://gcc.gnu.org/pipermail/gcc-patches/2020-March/542012.html)) committed as gcc-mirror/gcc@8409649
- `lldb`/`llvm-objdump`/`llvm-nm`/`llvm-symbolizer`/`llvm-cxxfilt`/etc
- llvm/llvm-project@7310403
- llvm/llvm-project@c8c2b46
- llvm/llvm-project@0a2d4f3
- Linux `perf`
- `valgrind`
- [Update demangler to support Rust v0 name mangling.](https://bugs.kde.org/show_bug.cgi?id=431306)
rust-lang/rust#85530 (comment) contains a summary of the most recent crater run of the v0 mangling, and the remaining issues from that were fixed by rust-lang/rust#87194 (confirmed by follow-up crater run, rust-lang/rust#85530 (comment)).
`@rustbot` label +T-compiler
r? `@michaelwoerister`
makai410 pushed a commit to makai410/rustc_public that referenced this pull request Dec 10, 2025
…ngling-scheme, r=wesleywiser
sess: default to v0 symbol mangling on nightly
cc rust-lang/rust#60705rust-lang/compiler-team#938
Rust's current mangling scheme depends on compiler internals; loses information about generic parameters (and other things) which makes for a worse experience when using external tools that need to interact with Rust symbol names; is inconsistent; and can contain `.` characters which aren't universally supported. Therefore, Rust has defined its own symbol mangling scheme which is defined in terms of the Rust language, not the compiler implementation; encodes information about generic parameters in a reversible way; has a consistent definition; and generates symbols that only use the characters `A-Z`, `a-z`, `0-9`, and `_`.
Support for the new Rust symbol mangling scheme has been added to upstream tools that will need to interact with Rust symbols (e.g. debuggers).
This pull request changes the default symbol mangling scheme from the legacy scheme to the new Rust mangling scheme on nightly.
The following pull requests implemented v0 mangling in rustc (if I'm missing any, let me know):
- rust-lang/rust#57967
- rust-lang/rust#63559
- rust-lang/rust#75675
- rust-lang/rust#77452
- rust-lang/rust#77554
- rust-lang/rust#83767
- rust-lang/rust#87194
- rust-lang/rust#87789
Rust's symbol mangling scheme has support in the following external tools:
- `binutils`/`gdb` (GNU `libiberty`)
- [[PATCH] Move rust_{is_mangled,demangle_sym} to a private libiberty header.
](https://gcc.gnu.org/pipermail/gcc-patches/2019-June/523011.html) committed as gcc-mirror/gcc@979526c
- [[PATCH] Simplify and generalize rust-demangle's unescaping logic.
](https://gcc.gnu.org/pipermail/gcc-patches/2019-August/527835.html) committed as gcc-mirror/gcc@42bf58b
- [[PATCH] Remove some restrictions from rust-demangle.
](https://gcc.gnu.org/pipermail/gcc-patches/2019-September/530445.html) committed as gcc-mirror/gcc@e1cb00d
- [[PATCH] Refactor rust-demangle to be independent of C++ demangling.
](https://gcc.gnu.org/pipermail/gcc-patches/2019-November/533719.html) ([original submission](https://gcc.gnu.org/pipermail/gcc-patches/2019-October/532388.html)) committed as gcc-mirror/gcc@32fc371
- [[PATCH] Support the new ("v0") mangling scheme in rust-demangle.
](https://gcc.gnu.org/pipermail/gcc-patches/2020-November/558905.html) ([original submission](https://gcc.gnu.org/pipermail/gcc-patches/2020-March/542012.html)) committed as gcc-mirror/gcc@8409649
- `lldb`/`llvm-objdump`/`llvm-nm`/`llvm-symbolizer`/`llvm-cxxfilt`/etc
- llvm/llvm-project@7310403
- llvm/llvm-project@c8c2b46
- llvm/llvm-project@0a2d4f3
- Linux `perf`
- `valgrind`
- [Update demangler to support Rust v0 name mangling.](https://bugs.kde.org/show_bug.cgi?id=431306)
rust-lang/rust#85530 (comment) contains a summary of the most recent crater run of the v0 mangling, and the remaining issues from that were fixed by rust-lang/rust#87194 (confirmed by follow-up crater run, rust-lang/rust#85530 (comment)).
`@rustbot` label +T-compiler
r? `@michaelwoerister`
makai410 pushed a commit to makai410/rust that referenced this pull request Dec 10, 2025
…symbol-mangling-scheme, r=wesleywiser
sess: default to v0 symbol mangling on nightly
cc rust-lang#60705rust-lang/compiler-team#938
Rust's current mangling scheme depends on compiler internals; loses information about generic parameters (and other things) which makes for a worse experience when using external tools that need to interact with Rust symbol names; is inconsistent; and can contain `.` characters which aren't universally supported. Therefore, Rust has defined its own symbol mangling scheme which is defined in terms of the Rust language, not the compiler implementation; encodes information about generic parameters in a reversible way; has a consistent definition; and generates symbols that only use the characters `A-Z`, `a-z`, `0-9`, and `_`.
Support for the new Rust symbol mangling scheme has been added to upstream tools that will need to interact with Rust symbols (e.g. debuggers).
This pull request changes the default symbol mangling scheme from the legacy scheme to the new Rust mangling scheme on nightly.
The following pull requests implemented v0 mangling in rustc (if I'm missing any, let me know):
- rust-lang#57967
- rust-lang#63559
- rust-lang#75675
- rust-lang#77452
- rust-lang#77554
- rust-lang#83767
- rust-lang#87194
- rust-lang#87789
Rust's symbol mangling scheme has support in the following external tools:
- `binutils`/`gdb` (GNU `libiberty`)
- [[PATCH] Move rust_{is_mangled,demangle_sym} to a private libiberty header.
](https://gcc.gnu.org/pipermail/gcc-patches/2019-June/523011.html) committed as gcc-mirror/gcc@979526c
- [[PATCH] Simplify and generalize rust-demangle's unescaping logic.
](https://gcc.gnu.org/pipermail/gcc-patches/2019-August/527835.html) committed as gcc-mirror/gcc@42bf58b
- [[PATCH] Remove some restrictions from rust-demangle.
](https://gcc.gnu.org/pipermail/gcc-patches/2019-September/530445.html) committed as gcc-mirror/gcc@e1cb00d
- [[PATCH] Refactor rust-demangle to be independent of C++ demangling.
](https://gcc.gnu.org/pipermail/gcc-patches/2019-November/533719.html) ([original submission](https://gcc.gnu.org/pipermail/gcc-patches/2019-October/532388.html)) committed as gcc-mirror/gcc@32fc371
- [[PATCH] Support the new ("v0") mangling scheme in rust-demangle.
](https://gcc.gnu.org/pipermail/gcc-patches/2020-November/558905.html) ([original submission](https://gcc.gnu.org/pipermail/gcc-patches/2020-March/542012.html)) committed as gcc-mirror/gcc@8409649
- `lldb`/`llvm-objdump`/`llvm-nm`/`llvm-symbolizer`/`llvm-cxxfilt`/etc
- llvm/llvm-project@7310403
- llvm/llvm-project@c8c2b46
- llvm/llvm-project@0a2d4f3
- Linux `perf`
- `valgrind`
- [Update demangler to support Rust v0 name mangling.](https://bugs.kde.org/show_bug.cgi?id=431306)
rust-lang#85530 (comment) contains a summary of the most recent crater run of the v0 mangling, and the remaining issues from that were fixed by rust-lang#87194 (confirmed by follow-up crater run, rust-lang#85530 (comment)).
`@rustbot` label +T-compiler
r? `@michaelwoerister`
Kobzol pushed a commit to Kobzol/rustc_codegen_cranelift that referenced this pull request Dec 29, 2025
…ngling-scheme, r=wesleywiser
sess: default to v0 symbol mangling on nightly
cc rust-lang/rust#60705rust-lang/compiler-team#938
Rust's current mangling scheme depends on compiler internals; loses information about generic parameters (and other things) which makes for a worse experience when using external tools that need to interact with Rust symbol names; is inconsistent; and can contain `.` characters which aren't universally supported. Therefore, Rust has defined its own symbol mangling scheme which is defined in terms of the Rust language, not the compiler implementation; encodes information about generic parameters in a reversible way; has a consistent definition; and generates symbols that only use the characters `A-Z`, `a-z`, `0-9`, and `_`.
Support for the new Rust symbol mangling scheme has been added to upstream tools that will need to interact with Rust symbols (e.g. debuggers).
This pull request changes the default symbol mangling scheme from the legacy scheme to the new Rust mangling scheme on nightly.
The following pull requests implemented v0 mangling in rustc (if I'm missing any, let me know):
- rust-lang/rust#57967
- rust-lang/rust#63559
- rust-lang/rust#75675
- rust-lang/rust#77452
- rust-lang/rust#77554
- rust-lang/rust#83767
- rust-lang/rust#87194
- rust-lang/rust#87789
Rust's symbol mangling scheme has support in the following external tools:
- `binutils`/`gdb` (GNU `libiberty`)
- [[PATCH] Move rust_{is_mangled,demangle_sym} to a private libiberty header.
](https://gcc.gnu.org/pipermail/gcc-patches/2019-June/523011.html) committed as gcc-mirror/gcc@979526c
- [[PATCH] Simplify and generalize rust-demangle's unescaping logic.
](https://gcc.gnu.org/pipermail/gcc-patches/2019-August/527835.html) committed as gcc-mirror/gcc@42bf58b
- [[PATCH] Remove some restrictions from rust-demangle.
](https://gcc.gnu.org/pipermail/gcc-patches/2019-September/530445.html) committed as gcc-mirror/gcc@e1cb00d
- [[PATCH] Refactor rust-demangle to be independent of C++ demangling.
](https://gcc.gnu.org/pipermail/gcc-patches/2019-November/533719.html) ([original submission](https://gcc.gnu.org/pipermail/gcc-patches/2019-October/532388.html)) committed as gcc-mirror/gcc@32fc371
- [[PATCH] Support the new ("v0") mangling scheme in rust-demangle.
](https://gcc.gnu.org/pipermail/gcc-patches/2020-November/558905.html) ([original submission](https://gcc.gnu.org/pipermail/gcc-patches/2020-March/542012.html)) committed as gcc-mirror/gcc@8409649
- `lldb`/`llvm-objdump`/`llvm-nm`/`llvm-symbolizer`/`llvm-cxxfilt`/etc
- llvm/llvm-project@7310403
- llvm/llvm-project@c8c2b46
- llvm/llvm-project@0a2d4f3
- Linux `perf`
- `valgrind`
- [Update demangler to support Rust v0 name mangling.](https://bugs.kde.org/show_bug.cgi?id=431306)
rust-lang/rust#85530 (comment) contains a summary of the most recent crater run of the v0 mangling, and the remaining issues from that were fixed by rust-lang/rust#87194 (confirmed by follow-up crater run, rust-lang/rust#85530 (comment)).
`@rustbot` label +T-compiler
r? `@michaelwoerister`
makai410 pushed a commit to makai410/rustc_public that referenced this pull request Mar 19, 2026
…ngling-scheme, r=wesleywiser
sess: default to v0 symbol mangling on nightly
cc rust-lang/rust#60705rust-lang/compiler-team#938
Rust's current mangling scheme depends on compiler internals; loses information about generic parameters (and other things) which makes for a worse experience when using external tools that need to interact with Rust symbol names; is inconsistent; and can contain `.` characters which aren't universally supported. Therefore, Rust has defined its own symbol mangling scheme which is defined in terms of the Rust language, not the compiler implementation; encodes information about generic parameters in a reversible way; has a consistent definition; and generates symbols that only use the characters `A-Z`, `a-z`, `0-9`, and `_`.
Support for the new Rust symbol mangling scheme has been added to upstream tools that will need to interact with Rust symbols (e.g. debuggers).
This pull request changes the default symbol mangling scheme from the legacy scheme to the new Rust mangling scheme on nightly.
The following pull requests implemented v0 mangling in rustc (if I'm missing any, let me know):
- rust-lang/rust#57967
- rust-lang/rust#63559
- rust-lang/rust#75675
- rust-lang/rust#77452
- rust-lang/rust#77554
- rust-lang/rust#83767
- rust-lang/rust#87194
- rust-lang/rust#87789
Rust's symbol mangling scheme has support in the following external tools:
- `binutils`/`gdb` (GNU `libiberty`)
- [[PATCH] Move rust_{is_mangled,demangle_sym} to a private libiberty header.
](https://gcc.gnu.org/pipermail/gcc-patches/2019-June/523011.html) committed as gcc-mirror/gcc@979526c
- [[PATCH] Simplify and generalize rust-demangle's unescaping logic.
](https://gcc.gnu.org/pipermail/gcc-patches/2019-August/527835.html) committed as gcc-mirror/gcc@42bf58b
- [[PATCH] Remove some restrictions from rust-demangle.
](https://gcc.gnu.org/pipermail/gcc-patches/2019-September/530445.html) committed as gcc-mirror/gcc@e1cb00d
- [[PATCH] Refactor rust-demangle to be independent of C++ demangling.
](https://gcc.gnu.org/pipermail/gcc-patches/2019-November/533719.html) ([original submission](https://gcc.gnu.org/pipermail/gcc-patches/2019-October/532388.html)) committed as gcc-mirror/gcc@32fc371
- [[PATCH] Support the new ("v0") mangling scheme in rust-demangle.
](https://gcc.gnu.org/pipermail/gcc-patches/2020-November/558905.html) ([original submission](https://gcc.gnu.org/pipermail/gcc-patches/2020-March/542012.html)) committed as gcc-mirror/gcc@8409649
- `lldb`/`llvm-objdump`/`llvm-nm`/`llvm-symbolizer`/`llvm-cxxfilt`/etc
- llvm/llvm-project@7310403
- llvm/llvm-project@c8c2b46
- llvm/llvm-project@0a2d4f3
- Linux `perf`
- `valgrind`
- [Update demangler to support Rust v0 name mangling.](https://bugs.kde.org/show_bug.cgi?id=431306)
rust-lang/rust#85530 (comment) contains a summary of the most recent crater run of the v0 mangling, and the remaining issues from that were fixed by rust-lang/rust#87194 (confirmed by follow-up crater run, rust-lang/rust#85530 (comment)).
`@rustbot` label +T-compiler
r? `@michaelwoerister`
makai410 pushed a commit to makai410/rustc_public that referenced this pull request Mar 27, 2026
…ngling-scheme, r=wesleywiser
sess: default to v0 symbol mangling on nightly
cc rust-lang/rust#60705rust-lang/compiler-team#938
Rust's current mangling scheme depends on compiler internals; loses information about generic parameters (and other things) which makes for a worse experience when using external tools that need to interact with Rust symbol names; is inconsistent; and can contain `.` characters which aren't universally supported. Therefore, Rust has defined its own symbol mangling scheme which is defined in terms of the Rust language, not the compiler implementation; encodes information about generic parameters in a reversible way; has a consistent definition; and generates symbols that only use the characters `A-Z`, `a-z`, `0-9`, and `_`.
Support for the new Rust symbol mangling scheme has been added to upstream tools that will need to interact with Rust symbols (e.g. debuggers).
This pull request changes the default symbol mangling scheme from the legacy scheme to the new Rust mangling scheme on nightly.
The following pull requests implemented v0 mangling in rustc (if I'm missing any, let me know):
- rust-lang/rust#57967
- rust-lang/rust#63559
- rust-lang/rust#75675
- rust-lang/rust#77452
- rust-lang/rust#77554
- rust-lang/rust#83767
- rust-lang/rust#87194
- rust-lang/rust#87789
Rust's symbol mangling scheme has support in the following external tools:
- `binutils`/`gdb` (GNU `libiberty`)
- [[PATCH] Move rust_{is_mangled,demangle_sym} to a private libiberty header.
](https://gcc.gnu.org/pipermail/gcc-patches/2019-June/523011.html) committed as gcc-mirror/gcc@979526c
- [[PATCH] Simplify and generalize rust-demangle's unescaping logic.
](https://gcc.gnu.org/pipermail/gcc-patches/2019-August/527835.html) committed as gcc-mirror/gcc@42bf58b
- [[PATCH] Remove some restrictions from rust-demangle.
](https://gcc.gnu.org/pipermail/gcc-patches/2019-September/530445.html) committed as gcc-mirror/gcc@e1cb00d
- [[PATCH] Refactor rust-demangle to be independent of C++ demangling.
](https://gcc.gnu.org/pipermail/gcc-patches/2019-November/533719.html) ([original submission](https://gcc.gnu.org/pipermail/gcc-patches/2019-October/532388.html)) committed as gcc-mirror/gcc@32fc371
- [[PATCH] Support the new ("v0") mangling scheme in rust-demangle.
](https://gcc.gnu.org/pipermail/gcc-patches/2020-November/558905.html) ([original submission](https://gcc.gnu.org/pipermail/gcc-patches/2020-March/542012.html)) committed as gcc-mirror/gcc@8409649
- `lldb`/`llvm-objdump`/`llvm-nm`/`llvm-symbolizer`/`llvm-cxxfilt`/etc
- llvm/llvm-project@7310403
- llvm/llvm-project@c8c2b46
- llvm/llvm-project@0a2d4f3
- Linux `perf`
- `valgrind`
- [Update demangler to support Rust v0 name mangling.](https://bugs.kde.org/show_bug.cgi?id=431306)
rust-lang/rust#85530 (comment) contains a summary of the most recent crater run of the v0 mangling, and the remaining issues from that were fixed by rust-lang/rust#87194 (confirmed by follow-up crater run, rust-lang/rust#85530 (comment)).
`@rustbot` label +T-compiler
r? `@michaelwoerister`
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-reviewStatus: Awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

13 participants

@tmiasko@bors@rust-log-analyzer@craterbot@michaelwoerister@bjorn3@klensy@Mark-Simulacrum@rust-timer@eddyb@JohnCSimon@rust-highfive@rustbot