I’ve been thinking about this and have come to the conclusion that I don’t think this is an important goal. If there’s a way to unambiguously encode everything that Rust needs via vanilla Itanium that also demangles to proper Rust syntax, we could do it. But I don’t know how to. And, as @tromey states, it’s good for tools if they can tell from the symbol name if it’s Rust or C++.
A point of reference here is debuginfo and how we tried to shoehorn Rust concepts into an equivalent C++ DWARF representation. DWARF is very flexible, much more so than Itanium mangling I’d say, and it still did not work well. I’d like to not repeat this approach without a really good reason. (We had a good reason for debuginfo back then but we are still paying the cost of doing the workaround).
I don’t think the argument that existing tools don’t support the new encoding out of the box is a good one. Many tools out there (like GDB and valgrind) already support the current Rust mangling, which isn’t Itanium either and rather messy. Given a good specification and a reference implementation, a demangler can be implemented in half a day. And Rust-based projects can just pull in the reference implementation from crates.io.
I think this is kind of off-topic. The compiler’s strategy of dealing with generic code is not defined by symbol mangling. The mangling scheme just has to support all the strategies the compiler might choose. If we were to switch to an ODR based strategy, the scheme proposed above would support it by just omitting the instantiating-crate suffix.
Noted. It still think that doing platform-specific things without a really good reason is unnecessarily asking for trouble.