Skip to content

--remap-path-prefix doesn't work in debug mode? #84125

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
jyn514 opened this issue Apr 12, 2021 · 2 comments
Closed

--remap-path-prefix doesn't work in debug mode? #84125

jyn514 opened this issue Apr 12, 2021 · 2 comments
Labels
C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@jyn514
Copy link
Member

jyn514 commented Apr 12, 2021

I tried the following code:

$ cargo new hello-world
$ cd hello-world

In release mode, --remap-path-prefix works correctly:

$ RUSTFLAGS="--remap-path-prefix=$(realpath .)=src --remap-path-prefix=$CARGO_HOME=cargo-home --remap-path-prefix=$RUSTUP_HOME=rustup-home" cargo run --release -q
Hello, world!
$ strings target/release/hello-world | grep joshua | wc -l
0

but the same thing without --release (and without incremental) does not:

$ CARGO_INCREMENTAL=0 RUSTFLAGS="--remap-path-prefix=$(realpath .)=src' --remap-path-prefix=$CARGO_HOME=cargo-home --remap-path-prefix=$RUSTUP_HOME=rustup-home" cargo run
Hello, world!
$ strings target/debug/hello-world | grep joshua | wc -l
8

Note this is unrelated to #66955 because incremental is disabled.

Originally posted by @jyn514 in #75263 (comment)

@jyn514 jyn514 added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. labels Apr 12, 2021
@nagisa
Copy link
Member

nagisa commented Apr 12, 2021

Do you have the rust-src component installed?

@jyn514
Copy link
Member Author

jyn514 commented Apr 12, 2021

Yes I do, and the issue only shows up with -C debuginfo=2. Thanks, this is a duplicate of #73167 then.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants