gnzlbg / cargo-asm

cargo subcommand showing the assembly or llvm-ir generated for Rust code
https://github.com/gnzlbg/cargo-asm
Other
1.19k stars 37 forks source link

improve the use case when function under $NAME isn't found #29

Open petr-tik opened 6 years ago

petr-tik commented 6 years ago

Problem description

Running cargo asm builds the binary with --release by default. The compiler is smart enough to optimise some functions away. Those functions then won't be found when running cargo asm crate::function::was_optimised_away

Improvement suggestion

gnzlbg commented 6 years ago

This won't help for functions marked #[inline] or #[inline(always)]. This won't also help for generics that are not monomorphized, nor for unused items (e.g. non-exported non-used functions), so I don't think this is worth the trouble.

The error message notes should be improved in the spirit of what is discussed in #23 to make it clear in which cases can the compiler actually emit machine code or llvm-ir for a function.