gnzlbg / cargo-asm

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

Canonical libstd path calculation doesn't work on macOS #103

Closed therealprof closed 5 years ago

therealprof commented 5 years ago

I haven't checked whether this is also the case for Linux or Windows but the calculated path in rust_src_build_path() does not seem to be correct on macOS anymore, i.e. when I run cargo asm --rust on some native code I get some error like:

file /rustc/fc50f328b0353b285421b8ff5d4100966387a997/src/libcore/fmt/mod.rs does not exist!

where the long hash is the commit hash of the release, e.g.

rustc  -V -v
rustc 1.34.1 (fc50f328b 2019-04-24)
binary: rustc
commit-hash: fc50f328b0353b285421b8ff5d4100966387a997
commit-date: 2019-04-24
host: x86_64-apple-darwin
release: 1.34.1
LLVM version: 8.0

and the physical path on disc something like:

~/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/src/libcore/fmt/mod.rs