Closed
Description
It appears that if multiple--remap-path-prefix
arguments are supplied on the CLI, they will be applied in the reverse order, rather than in the CLI-occurence order.
To reproduce:
$ mkdir -p apple/banana
$ echo 'fn main(){ panic!() }' > apple/banana/chaenomeles.rs
$ rustc apple/banana/chaenomeles.rs --remap-path-prefix=apple/banana/=/first/ --remap-path-prefix=apple/=/second/
$ ./chaenomeles
thread 'main' panicked at 'explicit panic', /second/banana/chaenomeles.rs:1:12
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Note that only the latter --remap-path-prefix
got invoked and the panic path became /second/banana/chaenomeles.rs
. Instead users need to specify the order of remappings in reverse:
$ rustc apple/banana/chaenomeles.rs --remap-path-prefix=apple/=/first/ --remap-path-prefix=apple/banana/=/second/
$ ./chaenomeles
thread 'main' panicked at 'explicit panic', /second/chaenomeles.rs:1:12
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
(in contrast clang/gcc will apply remappings front-to-back)