Skip to content

Fix ICE in v0 symbol mangling for deeply nested generic types#155122

Open
GokhanKabar wants to merge 1 commit intorust-lang:mainfrom
GokhanKabar:fix-ice-symbol-mangling-deeply-nested-generics
Open

Fix ICE in v0 symbol mangling for deeply nested generic types#155122
GokhanKabar wants to merge 1 commit intorust-lang:mainfrom
GokhanKabar:fix-ice-symbol-mangling-deeply-nested-generics

Conversation

@GokhanKabar
Copy link
Copy Markdown
Contributor

@GokhanKabar GokhanKabar commented Apr 10, 2026

Fixes #154965

When using -C symbol-mangling-version=v0, pathologically nested generic
type aliases cause the v0 mangler to emit a symbol so deeply nested that
rustc_demangle exceeds its MAX_DEPTH = 500 recursion limit and returns
Err. This trips the debug_assert! in compute_symbol_name, producing an ICE.

The fix mirrors the existing fallback for legacy mangling (which falls back
to v0 when symbols are too long for PDB): if the v0-mangled symbol cannot
be demangled, we fall back to hashed mangling, which always produces a
short, demanglable symbol.

A build-pass regression test is included.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 10, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 10, 2026

r? @wesleywiser

rustbot has assigned @wesleywiser.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 69 candidates
  • Random selection from 12 candidates

@rustbot

This comment has been minimized.

@GokhanKabar GokhanKabar force-pushed the fix-ice-symbol-mangling-deeply-nested-generics branch from 71fdd51 to af904a7 Compare April 10, 2026 18:47
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 10, 2026

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ICE]: compute_symbol_name: cannot be demangled

3 participants