Incorrect panic location when function is passed as argument #105942
Labels
A-panic
Area: Panicking machinery
C-bug
Category: This is a bug.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Long story short:
#[track_caller]
leads to misleading span when a function is passed as argument.I tried this code (playground link):
In this situation, both panic messages should be:
However,
panic_1
panics with the following message:Permalink to
function.rs:251:5
Ideally, the panic location should be spanned to
src/lib.rs
as well.Meta
rustc --version --verbose
:This happens on nightly as well.
Backtrace
panic_0
stacktrace:panic_1
stacktrace:The text was updated successfully, but these errors were encountered: