-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[BUG] [Rust] all monomorphisation of a given function demangle to the same name #1754
Comments
Note: as bandage, it could be possible to just include the hash in the demangled name, like what the |
For reference, this is code that handles Rust demangling https://github.com/mattgodbolt/compiler-explorer-tools/blob/master/rust/src/main.rs afaik |
I tried to understand how the current rust-ABI and mangling works. I think that currently there is not enough information in the mangled name, and the RFC 2603 is trying to solve that (among other issue). If it's the case, the best we can do until that RFC is accepted is to display the hash. I also noticed that when using the nightly compiler with the option |
@robinmoussu The RFC was accepted, and implemented, with The new mangling will remain behind an unstable flag until we can finish upstreaming the demangler to GNU toolchain (which has taken me an unreasonable amount of time, despite the C implementation being ready since late January 2019 - it didn't help that this was my first contribution to a GNU project - most of the patches so far have tweaked the old demangler in several steps, to allow merging the two). |
I added the upstreaming effort status to rust-lang/rust#60705, and I'll post updates as comments on there, so you can subscribe to it if you want to track my progress. |
Thanks for keeping us updated on the issue, we really appreciate it :) |
Is there anything we can do on our end to move this forward? |
I tried to implement a solution to this in #6265: A checkbox that lets the user chose whether to show hashes or not. |
…6265) Demangled Rust identifiers under the `legacy` name mangling scheme rely on a hash to disambiguate items with the same name, such as different monomorphisations of the same function or different closures’ `call_once` methods. In the `v0` mangling scheme, this is no longer a problem. However, configuring the demangler to show hashes in `legacy` names will include crate-id hashes in `v0` names, which are [mostly unneeded](https://rust-lang.github.io/rfcs/2603-rust-symbol-name-mangling-v0.html#appendix-a---suggested-demangling). This PR introduces a new checkbox *Options...* → *Verbose demangling* that lets the user select if they want to include disambiguating hashes in demangled identifiers. This checkbox is only shown for compilers that support verbose demangling, and deactivated when the *Demangle identifiers* checkbox is unchecked. Resolves #1754. Resolves #6255.
Describe the bug
When a function is monomorphized in rust, the demangled name is the same for all demangled monomorphisation of that function. If someone wants to know witch monomorphised version is called where, it needs to look are the non-demangled assembly.
To Reproduce
If you look in the assembly, the function
sum_print_and_skip
can be found two times. It also looks like bothcaller
andcaller2
calls the same function (they don't). If you untick thedemangle
option, you can see that the full name are different for both monomorphisation.impl Trait
: https://godbolt.org/z/hr5rTMExpected behavior
It should display the generic type in the demangled name, just like what is done in C++ with template: https://rust.godbolt.org/z/YahqGR
The text was updated successfully, but these errors were encountered: