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.
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
Update
catch_unwind
doc comments forc_unwind
#128321Update
catch_unwind
doc comments forc_unwind
#128321Changes from all commits
249d3d2
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 sounds like it is the library implementation that chooses which of the two happen, which I don't think is the case?
It would be good to explain somewhere (not as stable docs, but as information for people that want to understand the system) what decides which of these two outcomes occurs.
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 thought that the library did indeed make that decision from my first look at the code, but on looking again I'm not so sure.
The files where the detection, and handling, of "foreign" exceptions occur seems to be in
rust/library/panic_unwind/src/<target>.rs
.@workingjubilee or @chorman0773 , can either of you confirm that this understanding is correct, and that the standard library, rather than the compiler intrinsic, determines whether
catch_unwind
aborts in the face of a foreign exception?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 can't speak to how rustc in particular handles things, I can only speak to abi-level handling and guarantees.
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.
@nbdd0121 Are you the right person to ask here?
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.
Yeah, the library decides
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.
Hi, sorry. Yes, that's correct, as mentioned we call
__rust_foreign_exception
, which shows up in these places: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.
Our unwinding code is unfortunately not very localized, and is splashed all over the library folder (workspace, now?). Some of the relevant code is inside library/std and some of it is in library/panic_unwind and some of it is in library/unwind and just... ugh.
I think half the reason this situation has not been cleaned up is because it's hard to just find it all.
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.
That sounds like we currently always abort (seeing as
__rust_foreign_exception
has return type!
)? But the point of the docs here is that we may change that in the future?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.
Yes, we currently always abort, which is why no implementation change accompanies these doc changes. The point of the doc change here is to constrain what we may do in the future, because it is currently officially UB.