-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
#[track_caller] does nothing on async fns #78840
Comments
This seems to be working correctly. The call to |
But I expect it to work further: automatically generates the (Feature request) It's even better if |
This comment has been minimized.
This comment has been minimized.
Since the call to an This would require impementing #74042 (if only on nightly), so that the desugaring can forward |
This comment has been minimized.
This comment has been minimized.
Forwarding to the poll function does seem reasonable to me. @anp any thoughts on this? |
Forwarding to the generated future SGTM. |
… r=eholk Support `#[track_caller]` on async fns Adds `#[track_caller]` to the generator that is created when we desugar the async fn. Fixes rust-lang#78840 Open questions: - What is the performance impact of adding `#[track_caller]` to every `GenFuture`'s `poll(...)` function, even if it's unused (i.e., the parent span does not set `#[track_caller]`)? We might need to set it only conditionally, if the indirection causes overhead we don't want.
…=eholk Support `#[track_caller]` on async fns Adds `#[track_caller]` to the generator that is created when we desugar the async fn. Fixes rust-lang#78840 Open questions: - What is the performance impact of adding `#[track_caller]` to every `GenFuture`'s `poll(...)` function, even if it's unused (i.e., the parent span does not set `#[track_caller]`)? We might need to set it only conditionally, if the indirection causes overhead we don't want.
I tried:
I expected the seventh line to be the panic location, but I got this:
With
RUST_BACKTRACE=1
Playground (tried using nightly 2020-11-06 a601302)
I can achieve the result I expected by implementing a
Future
manually:Output:
Playground
I noticed that (in the backtrace) the compiler generated a closure (
Generator
?) for theasync fn
, so #74042 may be related.@rustbot modify labels: A-async-await A-attributes
The text was updated successfully, but these errors were encountered: