-
Notifications
You must be signed in to change notification settings - Fork 13.3k
[MIR] Refine representation and translation of calls #30481
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
893a66d
Split Call into Call and DivergingCall
nagisa 6f18b55
Generate DivergingCall terminator
nagisa ecf4d0e
Add Resume Terminator which corresponds to resume
nagisa 5b34690
Remove the Panic block terminator
nagisa 4e86dcd
Remove diverge terminator
nagisa a1e1398
Have a cached unreachable block inside MIR state
nagisa 924bb1e
Refine call terminator translation
nagisa 20ec53a
Fix ReturnPointer generation for void return types
nagisa cef6aee
Don’t generate landing-pads if -Z no-landing-pads
nagisa 5010703
Add tests
nagisa d1c644c
Merge Call and DivergingCall diffs into CallKind
nagisa f981424
panic/panic_bounds_check to destructure tys
nagisa 36b3951
Create personality slot when translating Resume
nagisa 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 hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
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.
Why clone here instead of returning
Option<&Lvalue<'tcx>>
and letting the caller decide if it needs to clone?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.
There’s two reasons, mostly, I had in mind:
Lvalue
is very cheap most of the time (i.e. whenLvalue
is not aProjection
);&mut lvalue
and there’s users who want&lvalue
. Returning a value allows to make either one easier when pattern matching (ref
vsref mut
).On the hindsight, I think this might actually be a bug to return destination by value in some cases which I didn’t think about before, thus I’ll submit a patch in a moment making these return a mutable reference instead.