-Zremap-path-scope=macro
still remaps inlined ELF symbols · Issue #139217 · rust-lang/rust (original) (raw)
The unstable feature -Zremap-path-scope
is supposed to constrain --remap-path-prefix
to only a certain subset of remappings. However, it seems as though DWARF data still has paths remapped for functions that are inlined.
I tried this code:
cargo init a cargo init --lib b echo 'b = {path = "../b"}' >> a/Cargo.toml echo '#[inline] pub fn get_some_value() -> i32 { 42 }' > b/src/lib.rs echo 'fn main() { println!("{}", b::get_some_value()); }' > a/src/main.rs cd a RUSTFLAGS="--remap-path-prefix=/=foo -Zremap-path-scope=macro" cargo +nightly build llvm-dwarfdump-15 --show-sources target/debug/a | grep -v ^/rust
I expected to see this happen: No DWARF symbols should contain foo
, because only file!()
macros should be remapped.
Instead, this happened: The inlined symbol got remapped:
user@ubuntu:/opt/Xous/simple-test/a$ llvm-dwarfdump-15 --show-sources target/debug/a | grep -v ^/rust
/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/fmt/mod.rs
/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/fmt/rt.rs
/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/hint.rs
/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs
/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs
/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/process.rs
/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs
/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/backtrace.rs
/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/process/unix/common.rs
/opt/Xous/simple-test/a/foo/opt/Xous/simple-test/b/src/lib.rs
/opt/Xous/simple-test/a/src/main.rs
user@ubuntu:/opt/Xous/simple-test/a$
Meta
rustc --version --verbose
:
rustc 1.88.0-nightly (fedf10752 2025-03-30)
binary: rustc
commit-hash: fedf10752b973d83f3f7c0f819b2659c21a634de
commit-date: 2025-03-30
host: x86_64-unknown-linux-gnu
release: 1.88.0-nightly
LLVM version: 20.1.1