Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow demangling improperly c++filted symbols (maybe through an opt-in --feature?) #22

Open
danielhenrymantilla opened this issue Nov 7, 2024 · 0 comments

Comments

@danielhenrymantilla
Copy link

danielhenrymantilla commented Nov 7, 2024

Consider __ZN4core5slice29_$LT$impl$u20$$u5b$T$u5d$$GT$16sort_unstable_by28_$u7b$$u7b$closure$u7d$$u7d$17hcf92dcf9c48f99dbE.

rustc-demangle properly unmangles this as: _core::slice::<impl [T]>::sort_unstable_by::{{closure}}.

But if some intermediary debugging tool were to assume the more common C++ mangling scheme, and attempt to demangle it as such (à la c++filt), we then end up with: core::slice::_$LT$impl$u20$$u5b$T$u5d$$GT$::sort_unstable_by::_$u7b$$u7b$closure$u7d$$u7d$::hcf92dcf9c48f99db.

And by then rustc-demangle (silently) does not recognize mangled input, and decides to just output it back, as-is.

While we could submit this kind of issue to rustc-demangle, it could legitimately be deemed out of scope for it.

However, for a CLI convenience tool such as rustfilt, it could be more legitimate to expect it to be more flexible w.r.t. the input it needs to handle.

If adding a "C++ mangler" involves too many deps, that functionality of rustfilt could be --feature-gated, for instance 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant