Skip to content

-Zremap-path-scope=macro still remaps inlined ELF symbols #139217

Closed
@xobs

Description

@xobs

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

A-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)A-path-remappingArea: path remapping, --remap-path-prefix, --remap-cwd-prefix, --remap-diagnostics-scope etc.C-bugCategory: This is a bug.F-trim-pathsFeature: trim-pathsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions