Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Failed to capture backtrace when compiling with --remap-path-prefix=${PWD}= #135853

Open
ashi009 opened this issue Jan 22, 2025 · 0 comments
Open
Labels
A-backtrace Area: Backtraces A-path-remapping Area: path remapping, --remap-path-prefix, --remap-cwd-prefix, --remap-diagnostics-scope etc. C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@ashi009
Copy link

ashi009 commented Jan 22, 2025

I tried this code:

fn main() {
    panic!("oh no!");
}

I expected to see this happen: backtrace_rs::main yields correct remapped source info.

$ RUST_BACKTRACE=1 cargo run
thread 'main' panicked at src/main.rs:2:5:
oh no!
stack backtrace:
   0: rust_begin_unwind
             at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/std/src/panicking.rs:662:5
   1: core::panicking::panic_fmt
             at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/core/src/panicking.rs:74:14
   2: backtrace_rs::main
             at src/main.rs:2:5
   3: core::ops::function::FnOnce::call_once
             at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Instead, this happened: source info for 2-3 are missing.

$ RUSTFLAGS="--remap-path-prefix=$(pwd)=" RUST_BACKTRACE=1 cargo run
thread 'main' panicked at src/main.rs:2:5:
oh no!
stack backtrace:
   0: rust_begin_unwind
             at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/std/src/panicking.rs:662:5
   1: core::panicking::panic_fmt
             at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/core/src/panicking.rs:74:14
   2: backtrace_rs::main
   3: core::ops::function::FnOnce::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Meta

rustc --version --verbose:

rustc 1.82.0 (f6e511eec 2024-10-15)
binary: rustc
commit-hash: f6e511eec7342f59a25f7c0534f1dbea00d01b14
commit-date: 2024-10-15
host: aarch64-apple-darwin
release: 1.82.0
LLVM version: 19.1.1

also checked:

rustc +nightly-aarch64-apple-darwin --version --verbose:

rustc 1.86.0-nightly (f3d1d47fd 2025-01-20)
binary: rustc
commit-hash: f3d1d47fd84dfcf7f513be1dbad356e74c8f3b2b
commit-date: 2025-01-20
host: aarch64-apple-darwin
release: 1.86.0-nightly
LLVM version: 19.1.7

This is also reported to rust-lang/backtrace-rs#691.

@ashi009 ashi009 added the C-bug Category: This is a bug. label Jan 22, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jan 22, 2025
@jieyouxu jieyouxu added A-backtrace Area: Backtraces A-path-remapping Area: path remapping, --remap-path-prefix, --remap-cwd-prefix, --remap-diagnostics-scope etc. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-backtrace Area: Backtraces A-path-remapping Area: path remapping, --remap-path-prefix, --remap-cwd-prefix, --remap-diagnostics-scope etc. 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

3 participants