Closed
Description
I tried this code:
#[allow(unconditional_panic, unused)] // for minimal test case; doesn't cause problem
fn main() {
1 / &0;
}
I expected to see this happen: program panics with main.rs
or the actual location on disk of the standard library source code file that caused the panic given as the location
Instead, this happened: program gives /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/core/src/ops/arith.rs:484:1
(internal compiler location?) as the panic location
Meta
rustc --version --verbose
:
rustc 1.71.1 (eb26296b5 2023-08-03)
binary: rustc
commit-hash: eb26296b556cef10fb713a38f3d16b9886080f26
commit-date: 2023-08-03
host: x86_64-pc-windows-msvc
release: 1.71.1
LLVM version: 16.0.5
I also checked that it happened in WSL:
rustc --version --verbose
:
rustc 1.71.1 (eb26296b5 2023-08-03)
binary: rustc
commit-hash: eb26296b556cef10fb713a38f3d16b9886080f26
commit-date: 2023-08-03
host: x86_64-unknown-linux-gnu
release: 1.71.1
LLVM version: 16.0.5
Backtrace
No build errors, but the backtrace for the program also contains references to internal compiler locations that I would expect to point to the actual locations of standard library source files on disk, as well.
0: std::panicking::begin_panic_handler
at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library\std\src\panicking.rs:593
1: core::panicking::panic_fmt
at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library\core\src\panicking.rs:67
2: core::panicking::panic
at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library\core\src\panicking.rs:117
3: core::ops::arith::impl$177::div
at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26\library\core\src\ops\arith.rs:484
4: core::ops::arith::impl$208::div
at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26\library\core\src\internal_macros.rs:45
5: bug::main
at .\src\main.rs:3
6: core::ops::function::FnOnce::call_once<void (*)(),tuple$<> >
at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26\library\core\src\ops\function.rs:250