Hello,
Rust is an incredible language and I think it has a great potential in many software industries, especially in the embedded's one. But at the moment rustc is producing a really awful assembly, and I understand we have no choice. The biggest problem for me is the name mangling.
I think Rust lacks a no_mangling crate-level attribute, which would disable any name mangling for all symbols that are not generated for tricky languages features.
I guess it would be possible for example, a code like this:
Tagging everything directly would:
1/ Improve code readability, no no_mangle attribute everywhere
2/ Way clearer assembly since the one generated by rustc is so chaotic
It would also come at a cost: by using a crate-level attribute, a reader might think that e.g. generic fns or methods will also not be mangled. But that is impossible, and thus the attribute would be misleading.
Joking asside, Foo::bar isn't a valid symbol name on all platforms. How would this work if the unmangled name could not possibly be used on the platform?
Symbols aren't supposed to be human readable by default. Mangled names are an efficient, backwards compatible, representation allowing symbols with the same stem names to differ. The #[no_mangle] attribute spceifically makes the symbol name equal to the stem or declaration name, you're propsing something that has different behaviour (it keeps name scoping intact, but in a more "readable form")
If you have a better name mangling/name decoration scheme, that may be reasonable to pitch, but I'd argue that's a compiler-domain thing, not a language-domain thing (rust the language does not currently have any kind of rule imposing mangling).
If you want these names just for human use of generated assembly, this already can be done. I believe rustc has a demangle option, and many disassembles do.
Is your goal about linking or about readable assembly? If it's merely about readability, what about a tool similar to c++filt that demangles mangled symbol names in whatever file/stream you give it? (EDIT: rustfilt)