Open
Description
I tried this code:
#![feature(backtrace)]
fn main() {
futures::executor::block_on(async move {
println!("{}", std::backtrace::Backtrace::capture());
panic!()
});
}
with the environment variables:
RUSTFLAGS='--remap-path-prefix=/home/nemo157/.cargo/registry/src/github.com-1ecc6299db9ec823=crates.io'
RUST_BACKTRACE=1
RUSTC_BOOTSTRAP=1
On 1.46 (and earlier) this results in backtraces looking as expected (for both the Backtrace::capture
and begin_panic
):
5: std::thread::local::LocalKey<T>::with
at /rustc/04488afe34512aa4c33566eb16d8c912a3ae04f9/src/libstd/thread/local.rs:239
6: futures_executor::local_pool::run_executor
at crates.io/futures-executor-0.3.7/src/local_pool.rs:83
7: futures_executor::local_pool::block_on
at crates.io/futures-executor-0.3.7/src/local_pool.rs:317
8: foo::main
at src/main.rs:4
but on 1.47 and later there is a spurious ./
prefixed onto the remapped paths:
6: std::thread::local::LocalKey<T>::with
at /rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/library/std/src/thread/local.rs:241
7: futures_executor::local_pool::run_executor
at ./crates.io/futures-executor-0.3.7/src/local_pool.rs:83
8: futures_executor::local_pool::block_on
at ./crates.io/futures-executor-0.3.7/src/local_pool.rs:317
9: foo::main
at ./src/main.rs:4
If there are remapped frames on top of each other this seems to become even more complex, in another project using this set of flags:
rustflags = [
"--remap-path-prefix=/home/nemo157=~",
"--remap-path-prefix=/home/nemo157/.cargo=cargo",
"--remap-path-prefix=/home/nemo157/.cargo/registry/src/github.com-1ecc6299db9ec823=crates.io",
"--remap-path-prefix=/home/nemo157/.rustup=rustup",
]
I got a backtrace like this:
8: clap::app::App::get_matches_from
at crates.io/clap-2.33.3/crates.io/clap-2.33.3/src/app/mod.rs:1519:9
9: clap::app::App::get_matches
at crates.io/clap-2.33.3/crates.io/clap-2.33.3/src/app/mod.rs:1460:9
10: structopt::StructOpt::from_args
at ~/sources/bs58-rs/crates.io/structopt-0.3.18/src/lib.rs:1089:26
11: <bs58::Args as paw_raw::ParseArgs>::parse_args
at ~/sources/bs58-rs/cli/src/main.rs:69:17
12: bs58::main
at ~/sources/bs58-rs/cli/src/main.rs:83:1
Frames 8 and 9 include duplicate crates.io/clap-2.33.3
prefixes, and frame 10 randomly has a ~/sources/bs58-rs
prefix