Closed
Description
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
Metadata
Metadata
Assignees
Labels
Area: Debugging information in compiled programs (DWARF, PDB, etc.)Area: path remapping, --remap-path-prefix, --remap-cwd-prefix, --remap-diagnostics-scope etc.Category: This is a bug.Feature: trim-pathsRelevant to the compiler team, which will review and decide on the PR/issue.This issue requires a nightly compiler in some way.