-
Notifications
You must be signed in to change notification settings - Fork 13.3k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Backtraces shouldn't show stack frames generated by the implementation of async-await #74779
Comments
Possible duplicate of #65978. |
Something like |
As someone who writes a lot of async rust (using async-std), this would be super handy. Some of my team members are also less experienced Rust programmers and it;s hard to expect them to know how to filter through this. I know it's out of scope of this, but related, a similar functionality in debuggers would often be super handy. |
As another side-effect, this makes the output of
|
This should be fixed by #104321 which gets rid of the |
I don't have a reproducer handy but can confirm the PR looks like it fixes this. Please reopen if not! |
Description
To reduce unnecessary noise while debugging, calls to the
poll()
method automatically generated by async-await's syntactic sugar should be hidden when generating a backtrace withRUST_BACKTRACE=1
.Actual Behaviour
As an example, this is a backtrace generated from a bot I've been playing around with:
Backtrace with 49 stack frames, of which 12 are calls to
core::future::from_generator::GenFuture<T>::poll()`
.Ignoring the initial
tokio
setup code (frame 25 and later), every second frame in the backtrace contains the exact same text:Expected Behaviour
Frames containing
core::future::from_generator::GenFuture<T>::poll()
should be ignored because they are not relevant (and indeed, not even accessible) to the developer while debugging.Compare the previous backtrace a version that removes the
GenFuture::poll()
stack frames:Because the
GenFuture
adapter is unique to async-await it should be relatively safe to add it to the list of functions ignored when printing a backtrace.Prior Art
As mentioned in #68336 (comment), trying to simplify backtraces is something that's had a lot of work in the past:
This might overlap with #68336 in that a rustc-internal attribute could be used when generating a backtrace to know what frames can be skipped. That issue mentions
#[track_caller]
, but I'd probably create a#[rustc_backtrace_skip]
attribute just for this.The text was updated successfully, but these errors were encountered: