Skip to content
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

Merged
merged 1 commit into from
Dec 21, 2024

Conversation

compiler-errors
Copy link
Member

Fixes #134566
Fixes #134541

@rustbot
Copy link
Collaborator

rustbot commented Dec 20, 2024

r? @lcnr

rustbot has assigned @lcnr.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 20, 2024
@@ -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
Copy link
Member Author

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.

Copy link
Member Author

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.

Copy link
Contributor

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 => {
Copy link
Member Author

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 :?

Copy link
Contributor

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.

Copy link
Contributor

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.

@compiler-errors
Copy link
Member Author

I think only @nikomatsakis can review this

r? nikomatsakis

@rustbot rustbot assigned nikomatsakis and unassigned lcnr Dec 20, 2024
@nikomatsakis
Copy link
Contributor

Looking

Copy link
Contributor

@nikomatsakis nikomatsakis left a 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.

@rust-log-analyzer

This comment has been minimized.

@nikomatsakis
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Dec 21, 2024

📌 Commit 42d1a4c has been approved by nikomatsakis

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 21, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 21, 2024
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
@bors bors merged commit 307fe49 into rust-lang:master Dec 21, 2024
6 checks passed
@rustbot rustbot added this to the 1.85.0 milestone Dec 21, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Dec 21, 2024
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
@compiler-errors compiler-errors deleted the drop-lint-coro branch December 21, 2024 12:28
@compiler-errors compiler-errors added the beta-nominated Nominated for backporting to the compiler in the beta channel. label Dec 22, 2024
@compiler-errors
Copy link
Member Author

Nominating this for beta b/c it goes along with #134486

@apiraino
Copy link
Contributor

Beta backport accepted as per compiler team on Zulip. A backport PR will be authored by the release team at the end of the current development cycle.

@rustbot label +beta-accepted

@rustbot rustbot added the beta-accepted Accepted for backporting to the compiler in the beta channel. label Dec 26, 2024
@cuviper cuviper mentioned this pull request Jan 2, 2025
@cuviper cuviper removed this from the 1.85.0 milestone Jan 2, 2025
@cuviper cuviper added this to the 1.84.0 milestone Jan 2, 2025
@cuviper cuviper removed the beta-nominated Nominated for backporting to the compiler in the beta channel. label Jan 2, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 3, 2025
[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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beta-accepted Accepted for backporting to the compiler in the beta channel. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
8 participants