-
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
Handle DropKind::ForLint
in coroutines correctly
#134575
Conversation
@@ -1500,6 +1492,14 @@ fn build_scope_drops<'tcx>( | |||
unwind_to = unwind_drops.drops[unwind_to].next; | |||
} | |||
|
|||
// If the operand has been moved, and we are not on an unwind |
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.
We want to do this early skip after we've adjusted the unwind_to
block.
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.
At least I think we do -- this isn't realted, 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.
Yes, I think you're right, that seems to match what happens above. It makes sense that we would do it after.
@@ -1552,7 +1552,7 @@ impl<'a, 'tcx: 'a> Builder<'a, 'tcx> { | |||
let mut unwind_indices = IndexVec::from_elem_n(unwind_target, 1); | |||
for (drop_idx, drop_node) in drops.drops.iter_enumerated().skip(1) { | |||
match drop_node.data.kind { | |||
DropKind::Storage => { | |||
DropKind::Storage | DropKind::ForLint => { |
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 is the fix for the ICE. Not totally sure why it fixes it :?
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.
Hmm. I think it fixes it because we generally copied the "storage" logic -- i.e., we only adjust unwind_to
when storage_dead_on_unwind
is true. I'm not 100% sure what the "add entry point" business is about 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.
OK, I did a bit of looking, I think this is correct, and it has to do with the fact that we are inserting a statement into a block and not a terminator.
I think only @nikomatsakis can review this r? nikomatsakis |
Looking |
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.
At first glance it seems reasonable. I'm going to be afk for about 7 hours, I can do a more detailed review tonight.
This comment has been minimized.
This comment has been minimized.
593679c
to
42d1a4c
Compare
@bors r+ |
Rollup of 7 pull requests Successful merges: - rust-lang#133087 (Detect missing `.` in method chain in `let` bindings and statements) - rust-lang#134575 (Handle `DropKind::ForLint` in coroutines correctly) - rust-lang#134576 (Improve prose around basic examples of Iter and IterMut) - rust-lang#134577 (Improve prose around `as_slice` example of Iter) - rust-lang#134579 (Improve prose around into_slice example of IterMut) - rust-lang#134593 (Less unwrap() in documentation) - rust-lang#134600 (Fix parenthesization of chained comparisons by pretty-printer) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#134575 - compiler-errors:drop-lint-coro, r=nikomatsakis Handle `DropKind::ForLint` in coroutines correctly Fixes rust-lang#134566 Fixes rust-lang#134541
Nominating this for beta b/c it goes along with #134486 |
[beta] backports - Do not call `extern_crate` on current trait on crate mismatch errors rust-lang#133585 - Correctly handle comments in attributes in doctests source code rust-lang#134260 - Correctly document CTFE behavior of is_null and methods that call is_null. rust-lang#134325 - Make sure we handle `backwards_incompatible_lint` drops appropriately in drop elaboration rust-lang#134486 - Bump compiler `cc` to 1.2.5 rust-lang#134505 - Handle `DropKind::ForLint` in coroutines correctly rust-lang#134575 - docs: inline `std::ffi::c_str` types to `std::ffi` rust-lang#134791 - docs: inline `alloc::ffi::c_str` types to `alloc::ffi` rust-lang#134851 r? cuviper
Fixes #134566
Fixes #134541