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

Stop clearing box's drop flags early #131146

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

beepster4096
Copy link
Contributor

Ever since #100036, drop flags have been incorrectly cleared when destructors are called. This only does anything in a very specific case involving Box, leading to the fields of the Box not being dropped when they should. This PR fixes that.

Fixes #131082

@rustbot
Copy link
Collaborator

rustbot commented Oct 2, 2024

r? @wesleywiser

rustbot has assigned @wesleywiser.
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 Oct 2, 2024
@rustbot
Copy link
Collaborator

rustbot commented Oct 2, 2024

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

Copy link
Member

@wesleywiser wesleywiser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a "mir opt" test for elaborate drops that shows this behavior? (You can look at /~https://github.com/rust-lang/rust/blob/master/tests/mir-opt/elaborate_box_deref_in_debuginfo.rs for a similar kind of test)

@wesleywiser wesleywiser added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 18, 2024
@alex-semenyuk
Copy link
Member

@beepster4096
From wg-triage. Any updates on this PR?

@beepster4096
Copy link
Contributor Author

I forgot to @rustbot ready after responding to the review comments. Apologies.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 28, 2024
@wesleywiser
Copy link
Member

Thanks @beepster4096!

@bors r+

@bors
Copy link
Contributor

bors commented Jan 6, 2025

📌 Commit 1bd8217 has been approved by wesleywiser

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 Jan 6, 2025
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 7, 2025
…leywiser

Stop clearing box's drop flags early

Ever since rust-lang#100036, drop flags have been incorrectly cleared when destructors are called. This only does anything in a very specific case involving Box, leading to the fields of the Box not being dropped when they should. This PR fixes that.

Fixes rust-lang#131082
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 7, 2025
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#131146 (Stop clearing box's drop flags early)
 - rust-lang#133810 (remove unnecessary `eval_verify_bound`)
 - rust-lang#134745 (Normalize each signature input/output in `typeck_with_fallback` with its own span)
 - rust-lang#134989 (Lower Guard Patterns to HIR.)
 - rust-lang#135149 (Use a post-monomorphization typing env when mangling components that come from impls)
 - rust-lang#135171 (rustdoc: use stable paths as preferred canonical paths)
 - rust-lang#135200 (rustfmt: drop nightly-gating of the `--style-edition` flag registration)

r? `@ghost`
`@rustbot` modify labels: rollup
@jieyouxu
Copy link
Member

jieyouxu commented Jan 7, 2025

Failed in rollup on test-various:

---- [mir-opt] tests/mir-opt/box_conditional_drop_allocator.rs stdout ----
72   
73       bb6: {
74           StorageDead(_4);
- -         drop(_1) -> [return: bb7, unwind continue];
+ -         drop(_1) -> [return: bb7, unwind: bb13];
76 +         goto -> bb22;
78   

@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Box sometimes forgets to drop its allocator when the Box is conditionally initialized.
6 participants