-
-
Notifications
You must be signed in to change notification settings - Fork 15.9k
#[track_caller] on async closures silently do nothing unless async_fn_track_caller is enabled. #161961
Copy link
Copy link
Open
Labels
A-async-closures`async || {}``async || {}`A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.A-panicArea: Panicking machineryArea: Panicking machineryC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way. When possible, use a F-* label instead.This issue requires a nightly compiler in some way. When possible, use a F-* label instead.
Description
Activity
Metadata
Metadata
Assignees
Labels
A-async-closures`async || {}``async || {}`A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.A-panicArea: Panicking machineryArea: Panicking machineryC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way. When possible, use a F-* label instead.This issue requires a nightly compiler in some way. When possible, use a F-* label instead.
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)