Repository navigation
Tracking Issue for #[track_caller] on closures #87417
Copy link
Copy link
Open
Labels
A-closuresArea: Closures (`|…| { … }`)Area: Closures (`|…| { … }`)C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCF-track_caller`#![feature(track_caller)]``#![feature(track_caller)]`I-lang-nominatedNominated for discussion during a lang team meeting.Nominated for discussion during a lang team meeting.I-lang-radarItems that are on lang's radar and will need eventual work or consideration.Items that are on lang's radar and will need eventual work or consideration.P-lang-drag-1Lang team prioritization drag level 1. https://rust-lang.zulipchat.com/#narrow/channel/410516-t-langLang team prioritization drag level 1. https://rust-lang.zulipchat.com/#narrow/channel/410516-t-langS-tracking-ready-to-stabilizeStatus: This is ready to stabilize; it may need a stabilization report and a PRStatus: This is ready to stabilize; it may need a stabilization report and a PRT-langRelevant to the language teamRelevant to the language team
Description
This is a tracking issue for the RFC "XXX" (rust-lang/rfcs#NNN).
The feature gate for the issue is #![feature(closure_track_caller)].
About tracking issues
Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.
Steps
- Implement the RFC
- Adjust documentation (see instructions on rustc-dev-guide)
- Stabilization PR (see instructions on rustc-dev-guide)
Unresolved Questions
XXX --- list all the "unresolved questions" found in the RFC to ensure they are
not forgotten
- Should
async {}, etc support track caller on their lowered closures?
Implementation history
- Initial implementation in Support
#[track_caller]on closures and generators #87064
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-closuresArea: Closures (`|…| { … }`)Area: Closures (`|…| { … }`)C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCF-track_caller`#![feature(track_caller)]``#![feature(track_caller)]`I-lang-nominatedNominated for discussion during a lang team meeting.Nominated for discussion during a lang team meeting.I-lang-radarItems that are on lang's radar and will need eventual work or consideration.Items that are on lang's radar and will need eventual work or consideration.P-lang-drag-1Lang team prioritization drag level 1. https://rust-lang.zulipchat.com/#narrow/channel/410516-t-langLang team prioritization drag level 1. https://rust-lang.zulipchat.com/#narrow/channel/410516-t-langS-tracking-ready-to-stabilizeStatus: This is ready to stabilize; it may need a stabilization report and a PRStatus: This is ready to stabilize; it may need a stabilization report and a PRT-langRelevant to the language teamRelevant to the language team
Activity
kartva commentedon Oct 5, 2022
What's the status of this issue? I'd be happy to try and pursue stabilization if it's ready.
Aaron1011 commentedon Oct 22, 2022
Even if this is stabilized, you'll still need the unstable
stmt_expr_attributesto actually write it on a closure expression: #15701mpfaff commentedon Jan 22, 2023
That seems to be the case only if the closure is not passed immediately as a function argument:
Maybe I'm misunderstanding the terminology, but in the case that does work, the closure is still an expression, no?
Aaron1011 commentedon Jan 22, 2023
You're right - this seems like a bug in the
stmt_expr_attributesfeature gate (or maybe an intentional partial stabilization).persist-client: ignore warning about `#[track_caller]`
track_caller on async is a no-op see issue #87417 <rust-lang/rust#87417…
Set log level via RUST_LOG (#44)
tmandry commentedon Mar 28, 2023
Nominating for lang team discussion. We may not be ready to approve attributes on closures generally. However, this being unstable led to the backing out of
#[track_caller]support onasync fnin #104741 (originally implemented in #104219) unless theclosure_track_callerfeature gate is enabled, because it uses that feature under the hood.@rustbot label I-lang-nominated I-async-nominated
@rust-lang/lang, can we get consensus on stabilizing support for
#[track_caller]onasync fnonly, and does that need an FCP?The only possible question I see is whether caller tracking should occur during initial call or subsequent polling; this follows the approach adopted and FCP'd in #87064 and adds it to
poll. One implication of this is that combinators would need to add#[track_caller]to their poll implementations to be able to "see through" them to user code. @rust-lang/wg-async in case there are any concerns about this.Additionally, how close are we to consensus on stabilizing
closure_track_callerif a stabilization PR were to come up?22 remaining items
Rollup merge of rust-lang#161972 - theemathas:async-track_caller-test…
Rollup merge of rust-lang#161972 - theemathas:async-track_caller-test…
Rollup merge of rust-lang#161972 - theemathas:async-track_caller-test…
Rollup merge of rust-lang#161972 - theemathas:async-track_caller-test…
Rollup merge of rust-lang#161972 - theemathas:async-track_caller-test…
Rollup merge of rust-lang#161972 - theemathas:async-track_caller-test…
Rollup merge of rust-lang#161972 - theemathas:async-track_caller-test…
Rollup merge of rust-lang#161972 - theemathas:async-track_caller-test…
Rollup merge of rust-lang#161972 - theemathas:async-track_caller-test…
Rollup merge of rust-lang#161972 - theemathas:async-track_caller-test…
Unrolled build for #161972 in rollup 162229
Rollup merge of #161972 - theemathas:async-track_caller-tests, r=Shoy…
theemathas commentedon Oct 7, 2026
Note: After my work at #163396 is done and then merged,
#[track_caller] async fnwill track the caller, but#[track_caller] asyncclosures will track the poller/awaiter. This is due to implementation difficulties with the latter.This means that
async_fn_track_callerandclosure_track_callertogether won't be able to be simultaneously stabilized as-is after my PR, as doing so would stabilize#[track_caller] asyncclosures, which currently don't work properly. (Such closures are currently gated behind both features, requiring both features to be enabled.)Maybe
#[track_caller] asyncclosures should be moved to a new feature gate?