-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Expose Frames Iterator for the Backtrace Type #78299
Closed
Closed
Changes from 3 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
372ba21
Expose BacktraceFrame as public
seanchen1991 9b8e4fc
Add empty `frames` method to Backtrace type
seanchen1991 e07b25d
Fill in `frames` function
seanchen1991 277a2a4
Add `Frames` struct
seanchen1991 b4e21e6
Add `as_ref` method for `Frames` type
seanchen1991 43f2774
Remove `Backtrace::frames` method
seanchen1991 7331efe
Remove unnecessary newlines
seanchen1991 b43bcb6
Merge branch 'master' of github.com:rust-lang/rust
seanchen1991 6df53a1
Add `frames` method that doesn't borrow from lock
seanchen1991 37f4f13
Add private clone methods to Frame and BacktraceFrame
seanchen1991 747bb91
Add additional unstable feature flags
seanchen1991 c5d5912
Fix a type in Frames::clone
seanchen1991 30c5494
Add tracking issue
seanchen1991 4e6d2ef
Fix ownership issues
seanchen1991 e7df885
Add doc comments to `Frames` and `BacktraceFrame`
seanchen1991 61b198f
Derive Debug on `Frames`, `BacktraceFrame`, and `RawFrame`
seanchen1991 b4175b1
Tie `Frames` to `Backtrace` via PhantomData
seanchen1991 b30f662
Add `generate_fake_backtrace` fn to backtrace/tests.rs
seanchen1991 c624d22
Add test for empty frames iterator
seanchen1991 de98734
Impl `Iterator` for Frames
seanchen1991 da2e4a9
Fix IntoIter type
seanchen1991 0199300
Get empty iterator test passing
seanchen1991 48e6a38
Add test to check frames iterator count
seanchen1991 ff81eb1
Remove iterator impl on Backtrace Frame
seanchen1991 43b9783
Merge upstream changes
seanchen1991 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be a bit of an issue for us. We might end up needing to wrap this up in something like:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason being the lifetime of the frames we can borrow from that locked mutex won't be enough for us to return a reference to the slice of frames.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking about this more, we probably don't want to hand out a quiet borrow to locked state, otherwise we might create the potential for deadlocks. Instead, we could come up with something like this:
And materialize that
Vec
under the lock.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not quite sure what you mean by "materialize that
Vec
under the lock". Is that just referring to theFrames
type holding on to aVec<BacktraceFrame>
so that we don't need to manually deal with the lock?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah sorry, yes I meant making our
frames()
method look something like this:So that we're not handing out a borrow from that lock
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think
Frames
should have a lifetime tied toBacktrace
even if it currently isn't used. In the future a pure rust unwinder may avoid the lock. We could then generate the frames on the fly in theIterator
impl forFrames
, avoiding a memory allocation.