I tried this code:
#![feature(closure_track_caller)]
#[tokio::main]
async fn main() {
let closure = {
#[track_caller]
async || {
panic!();
}
};
closure().await;
}
I expected either:
- the
ungated_async_fn_track_caller lint fires; or
- the panic output points to the
closure().await line (line 11)
Instead, no warning is given, and the panic output points to the panic!(); line (line 8):
thread 'main' (13) panicked at src/main.rs:8:13:
explicit panic
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Enabling the async_fn_track_caller feature causes the panic output to correctly point to line 11 instead.
The ungated_async_fn_track_caller lint (implemented in #104741) is supposed to warn the user if a #[track_caller] doesn't do anything due to not enabling the async_fn_track_caller feature. It does not work properly here.
Tracking issue for closure_track_caller: #87417
Tracking issue for async_fn_track_caller: #110011
Meta
Reproducible on the playground with version 1.100.0-nightly (2026-08-26 bff8e12ff5e6bcd53dfb)
I tried this code:
I expected either:
ungated_async_fn_track_callerlint fires; orclosure().awaitline (line 11)Instead, no warning is given, and the panic output points to the
panic!();line (line 8):Enabling the
async_fn_track_callerfeature causes the panic output to correctly point to line 11 instead.The
ungated_async_fn_track_callerlint (implemented in #104741) is supposed to warn the user if a#[track_caller]doesn't do anything due to not enabling theasync_fn_track_callerfeature. It does not work properly here.Tracking issue for
closure_track_caller: #87417Tracking issue for
async_fn_track_caller: #110011Meta
Reproducible on the playground with version
1.100.0-nightly (2026-08-26 bff8e12ff5e6bcd53dfb)