Skip to content

--remap-path-prefix broken in rustc version >= 1.46.0 #77046

Closed
@Bargsteen

Description

@Bargsteen

When compiling a rust program with --remap-path-prefix in 1.46.0, (and nightlies 1.47.0, 1.48.0) the specified prefixes in the binary are unaltered. I expected them to be changed.

When using 1.45.2 and 1.43.0, it works as expected.

Steps to reproduce

  1. Make sure you are using rustc >=1.46.0, check via rustc --version
  2. Create a new cargo project: cargo new --bin foo
  3. Add a dependency to Cargo.toml, for example regex = "1"
  4. Add code that uses this dependency, for example:
use regex::Regex;

fn main() {
    Regex::new(r"{").unwrap();
}
  1. Run RUSTFLAGS=--remap-path-prefix=/home/kasper=bar cargo build --release, where /home/kasper/ is the prefix you want to change, for example your $HOME.
  2. Inspect the binary using: strings target/release/foo | grep kasper (where kasper is something contained in the prefix), and see that it returns several lines.

If the same steps are taken on 1.45.2, step 5 returns no results, as expected.

Notes

The crate and code example is arbitrary, and the same behavior is observed for any combination of crates.

Software versions:

  • rustc 1.46.0 (04488af 2020-08-24)
  • OS: Linux (Ubuntu 20.04.1 LTS)

The following nightly versions also fail:

  • rustc 1.47.0-nightly (f44c6e4 2020-08-24)
  • rustc 1.48.0-nightly (1fd5b9d 2020-09-20)

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.E-needs-bisectionCall for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustcP-mediumMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions