-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tracking Issue for #[track_caller]
on closures
#87417
Comments
What's the status of this issue? I'd be happy to try and pursue stabilization if it's ready. |
Even if this is stabilized, you'll still need the unstable |
That seems to be the case only if the closure is not passed immediately as a function argument: // This works
let x = std::convert::identity(#[track_caller] || {});
// But this does not
let x = #[track_caller] || {}; Maybe I'm misunderstanding the terminology, but in the case that does work, the closure is still an expression, no? |
You're right - this seems like a bug in the |
`#[track_caller]` has no effect on async functions currently, and the compiler warns about that. However, fixing this is in progress ([0]). Rather than removing the annotations from async functions, we instead ignore the compiler warning, so we don't forget to add the annotations again once [0] is implemented. [0]: rust-lang/rust#87417
…> for more information
* Set log lever via RUST_LOG * track_caller on async is a no-op see issue #87417 <rust-lang/rust#87417> for more information * cargo update and fix deny * ignore clippy warning for no-op track_caller
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 @rustbot label I-lang-nominated I-async-nominated @rust-lang/lang, can we get consensus on stabilizing support for 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 Additionally, how close are we to consensus on stabilizing |
One clarification @tmandry -- why exactly did we back things out? Was it because we were afraid of committing to something that would require a feature gate, or because the compiler didn't accept the patch because of the feature gate being needed on stable? (If the latter, there's a way to deal with that.) That said, I feel fairly comfortable with approving attributes on closures. |
This wasn't entirely clear to me, but I think it was more the latter - or more specifically, because the original patch had a bug that caused an error to appear on stable when |
We reused the |
We discussed this in the t-lang meeting (notes). We agreed that we should make a separate flag for It's not 100% clear that tracking the poller, rather than the original caller, is the ideal behavior. That said, we may still be able to resolve the question without an RFC. Arguments in favor of tracking the poller (current behavior):
Arguments in favor of tracking the original caller instead of the poller:
|
@bryangarza Would you be interested in making a separate feature flag and (optionally) opening a new tracking issue? |
@tmandry sure, I can do both of those |
Is there an RFC? Or is this just noise that should be removed from the issue? |
… so that #[track_caller] works. Adding #[track_caller] to the two functions would not have the same effect as the closures passed to both would also need the attribute, but it's currently not supported on closures: rust-lang/rust#87417
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
Unresolved Questions
XXX --- list all the "unresolved questions" found in the RFC to ensure they are
not forgotten
async {}
, etc support track caller on their lowered closures?Implementation history
#[track_caller]
on closures and generators #87064The text was updated successfully, but these errors were encountered: