-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Remove coroutine info when building coroutine drop body #120330
Merged
bors
merged 2 commits into
rust-lang:master
from
compiler-errors:no-coroutine-info-in-coroutine-drop-body
Jan 26, 2024
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
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
21 changes: 0 additions & 21 deletions
21
tests/mir-opt/coroutine_drop_cleanup.main-{closure#0}.coroutine_drop.0.panic-abort.mir
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,4 @@ | ||
// MIR for `main::{closure#0}` 0 coroutine_drop | ||
/* coroutine_layout = CoroutineLayout { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (Unsurprisingly, coroutine layout is not present in the drop shim body anymore. This does affect the MIR dump, but does not affect the drop's codegen.) |
||
field_tys: { | ||
_0: CoroutineSavedTy { | ||
ty: std::string::String, | ||
source_info: SourceInfo { | ||
span: $DIR/coroutine_drop_cleanup.rs:12:13: 12:15 (#0), | ||
scope: scope[0], | ||
}, | ||
ignore_for_traits: false, | ||
}, | ||
}, | ||
variant_fields: { | ||
Unresumed(0): [], | ||
Returned (1): [], | ||
Panicked (2): [], | ||
Suspend0 (3): [_0], | ||
}, | ||
storage_conflicts: BitMatrix(1x1) { | ||
(_0, _0), | ||
}, | ||
} */ | ||
|
||
fn main::{closure#0}(_1: *mut {coroutine@$DIR/coroutine_drop_cleanup.rs:11:15: 11:17}) -> () { | ||
let mut _0: (); | ||
|
21 changes: 0 additions & 21 deletions
21
tests/mir-opt/coroutine_drop_cleanup.main-{closure#0}.coroutine_drop.0.panic-unwind.mir
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
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.
Brief mention of when it goes from
Some
toNone
would be good.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.
So this never goes from
Some
toNone
for normal MIR bodies. The only reason it "goes fromSome
toNone
" when we're building the coroutine drop shim is because we're cloning the whole MIR body struct (presumably out out of convenience) rather than, for example, just copying the basic blocks and locals into a fresh body.The idea is that this is just basically "take what we can from the parent MIR body, and then just fix up what is wrong". Other body information is patched up at the same time, such as the
source
andarg_count
, and I don't believe that it makes sense to leave a parallel comment onarg_count
, for example.I can leave a comment on the
take
call below though.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 would be great info to put into the comment! E.g. "
Some
" in the normal case,None
only when we're building the coroutine drop shim".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.
And every other MIR body, not just coroutine drop shims. Which is why I think it feels redundant to note this, since this already says "when it is lowered from a coroutine".
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 final version looks fine, thanks!