Skip to content

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

Closed
@jyn514

Description

@jyn514

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions