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.
This will make it possible to drop the
UnwindTable
and return a reference toUnwindTableRow
whose lifetime will be bound only to the lifetime of theUninitializedUnwindContext
. This is still not perfect though since theUnwindTable
constructor originally accepts the unwind context through a&mut
, so you still won't be able to e.g. search through multiple sections and return a reference toUnwindTableRow
for only one of them due to the limitations of Rust's current borrow checker without laundering the lifetime throughunsafe
, but it's better than what we have now.(Some background on this change: I've been refactoring this horrible method from my profiler, and what I'd like to do is basically to look through multiple sections, and return the
UnwindTableRow
when I get a hit. I could justclone
it, but it's over 6 kilobytes so if the compiler won't be able to elide that copy the performance will tank.)An alternative to this would be to not store the
UnwindContext
inside ofUnwindTable
and just pass the unwind context manually each time we iterate over the rows instead of setting it once in the constructor. That would obviously be a more intrusive change than this one though, so I'm not sure if we actually want to go that way? (Especially since the new Polonius-based borrow checker fixes the issue I've described in the first paragraph.)