Skip to content

Don't try to remove drop_in_place calls in RemoveUnneededDrops#155044

Open
WaffleLapkin wants to merge 1 commit intorust-lang:mainfrom
WaffleLapkin:dont-remove-unneeded-drops
Open

Don't try to remove drop_in_place calls in RemoveUnneededDrops#155044
WaffleLapkin wants to merge 1 commit intorust-lang:mainfrom
WaffleLapkin:dont-remove-unneeded-drops

Conversation

@WaffleLapkin
Copy link
Copy Markdown
Member

As per my justification in #154327 (comment)

r? scottmcm

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 9, 2026

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@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 Apr 9, 2026
Comment on lines 6 to 12
unsafe fn slice_in_place(ptr: *mut [char]) {
// CHECK-LABEL: fn slice_in_place(_1: *mut [char])
// CHECK: bb0: {
// CHECK-NEXT: return;
// CHECK: bb0: {
// CHECK-NEXT: StorageLive(_2);
// CHECK-NEXT: _2 = copy _1;
// CHECK-NEXT: StorageDead(_2);
// CHECK-NEXT: return;
// CHECK-NEXT: }
std::ptr::drop_in_place(ptr)
}
Copy link
Copy Markdown
Member Author

@WaffleLapkin WaffleLapkin Apr 9, 2026

Choose a reason for hiding this comment

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

View changes since the review

idk how this used to pass, given that the diff is unchanged...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You removed the compile-flags, so that probably impacted it? The filecheck validations are on final mir always...

Copy link
Copy Markdown
Member

@scottmcm scottmcm left a comment

Choose a reason for hiding this comment

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

Had a suggestion, but r=me.

I don't remember this ever being all that critical, so if nothing's failing without it, might as well make it simpler.

View changes since this review

@@ -1,12 +1,14 @@
//@ test-mir-pass: RemoveUnneededDrops
//@ test-mir-pass: Inline
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggestion: now that this isn't a different pass, maybe move it into https://github.com/rust-lang/rust/tree/main/tests/mir-opt/inline? Could rename it to inline_empty_drop_glue or something too, to make it clearer what the goal is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants