Skip to content

Add regression test for dead code elimination with drop + panic#155370

Merged
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
iyernaveenr:naveen_r_iyer/issue-114532-needs-test
Apr 19, 2026
Merged

Add regression test for dead code elimination with drop + panic#155370
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
iyernaveenr:naveen_r_iyer/issue-114532-needs-test

Conversation

@iyernaveenr
Copy link
Copy Markdown
Contributor

@iyernaveenr iyernaveenr commented Apr 16, 2026

Add a codegen test for #114532.

The bug was that dead code elimination failed when a Drop impl contained a panic! and a potentially-panicking external function was called after the value was created. This was fixed since 1.82 but no regression test was added.

The test verifies that foo() compiles to just a call to unknown() + ret void, with no panic or panicking call in the function body.

Closes #114532

@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 16, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 16, 2026

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
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

Why was this reviewer chosen?

The reviewer was selected based on:

  • Fallback group: @Mark-Simulacrum, @jieyouxu
  • @Mark-Simulacrum, @jieyouxu expanded to Mark-Simulacrum, jieyouxu

@rustbot

This comment has been minimized.

@iyernaveenr iyernaveenr force-pushed the naveen_r_iyer/issue-114532-needs-test branch from 4683be7 to 1b7cc0c Compare April 16, 2026 01:03
@rustbot

This comment has been minimized.

@iyernaveenr iyernaveenr force-pushed the naveen_r_iyer/issue-114532-needs-test branch from 1b7cc0c to edea8ca Compare April 16, 2026 01:06
@rust-log-analyzer

This comment has been minimized.

Dead code elimination used to fail when a Drop impl contained a panic
and a potentially-panicking external function was called after the value
was created. This was fixed since 1.82 but no regression test was added.

The test verifies that foo() compiles to just a call to unknown() and
ret void, with no panic or panicking call in the function body.

Signed-off-by: Naveen R. Iyer <iyernaveenr@gmail.com>
@iyernaveenr iyernaveenr force-pushed the naveen_r_iyer/issue-114532-needs-test branch from edea8ca to 46f360a Compare April 16, 2026 01:48
@Mark-Simulacrum
Copy link
Copy Markdown
Member

@bors r+ rollup=iffy

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Apr 18, 2026

📌 Commit 46f360a has been approved by Mark-Simulacrum

It is now in the queue for this repository.

@rust-bors rust-bors Bot 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 Apr 18, 2026
jhpratt added a commit to jhpratt/rust that referenced this pull request Apr 19, 2026
…4532-needs-test, r=Mark-Simulacrum

Add regression test for dead code elimination with drop + panic

Add a codegen test for rust-lang#114532.

The bug was that dead code elimination failed when a `Drop` impl contained a `panic!` and a potentially-panicking external function was called after the value was created. This was fixed since 1.82 but no regression test was added.

The test verifies that `foo()` compiles to just a call to `unknown()` + `ret void`, with no panic or panicking call in the function body.

Closes rust-lang#114532
rust-bors Bot pushed a commit that referenced this pull request Apr 19, 2026
Rollup of 8 pull requests

Successful merges:

 - #155370 (Add regression test for dead code elimination with drop + panic)
 - #154823 (Replace the spdx-rs dependency with a minimal in-tree SPDX tag-value parser)
 - #155352 (triagebot.toml: Sync `assign.owners` with `autolabel."T-compiler"`)
 - #155431 (Add temporary scope to assert_matches)
 - #152995 (ACP Implementation of PermissionsExt for Windows )
 - #153873 (deprecate `std::char` constants and functions)
 - #154654 (Move `std::io::ErrorKind` to `core::io`)
 - #154865 (libtest: use binary search for --exact test filtering)
jhpratt added a commit to jhpratt/rust that referenced this pull request Apr 19, 2026
…4532-needs-test, r=Mark-Simulacrum

Add regression test for dead code elimination with drop + panic

Add a codegen test for rust-lang#114532.

The bug was that dead code elimination failed when a `Drop` impl contained a `panic!` and a potentially-panicking external function was called after the value was created. This was fixed since 1.82 but no regression test was added.

The test verifies that `foo()` compiles to just a call to `unknown()` + `ret void`, with no panic or panicking call in the function body.

Closes rust-lang#114532
rust-bors Bot pushed a commit that referenced this pull request Apr 19, 2026
Rollup of 9 pull requests

Successful merges:

 - #155370 (Add regression test for dead code elimination with drop + panic)
 - #154823 (Replace the spdx-rs dependency with a minimal in-tree SPDX tag-value parser)
 - #154972 (Implement `core::arch::return_address` and tests)
 - #155294 (Add test for coalescing of diagnostic attribute duplicates)
 - #155352 (triagebot.toml: Sync `assign.owners` with `autolabel."T-compiler"`)
 - #155431 (Add temporary scope to assert_matches)
 - #152995 (ACP Implementation of PermissionsExt for Windows )
 - #153873 (deprecate `std::char` constants and functions)
 - #154865 (libtest: use binary search for --exact test filtering)
jhpratt added a commit to jhpratt/rust that referenced this pull request Apr 19, 2026
…4532-needs-test, r=Mark-Simulacrum

Add regression test for dead code elimination with drop + panic

Add a codegen test for rust-lang#114532.

The bug was that dead code elimination failed when a `Drop` impl contained a `panic!` and a potentially-panicking external function was called after the value was created. This was fixed since 1.82 but no regression test was added.

The test verifies that `foo()` compiles to just a call to `unknown()` + `ret void`, with no panic or panicking call in the function body.

Closes rust-lang#114532
rust-bors Bot pushed a commit that referenced this pull request Apr 19, 2026
Rollup of 10 pull requests

Successful merges:

 - #155370 (Add regression test for dead code elimination with drop + panic)
 - #154823 (Replace the spdx-rs dependency with a minimal in-tree SPDX tag-value parser)
 - #155294 (Add test for coalescing of diagnostic attribute duplicates)
 - #155352 (triagebot.toml: Sync `assign.owners` with `autolabel."T-compiler"`)
 - #155431 (Add temporary scope to assert_matches)
 - #152995 (ACP Implementation of PermissionsExt for Windows )
 - #153873 (deprecate `std::char` constants and functions)
 - #154865 (libtest: use binary search for --exact test filtering)
 - #154979 (add #[must_use] macros for floats)
 - #155504 (Remove `AttributeLintKind` variants - part 2)
rust-bors Bot pushed a commit that referenced this pull request Apr 19, 2026
…uwer

Rollup of 12 pull requests

Successful merges:

 - #155370 (Add regression test for dead code elimination with drop + panic)
 - #154823 (Replace the spdx-rs dependency with a minimal in-tree SPDX tag-value parser)
 - #155294 (Add test for coalescing of diagnostic attribute duplicates)
 - #155352 (triagebot.toml: Sync `assign.owners` with `autolabel."T-compiler"`)
 - #155431 (Add temporary scope to assert_matches)
 - #153873 (deprecate `std::char` constants and functions)
 - #154865 (libtest: use binary search for --exact test filtering)
 - #154979 (add #[must_use] macros for floats)
 - #155486 (c-variadic: add roundtrip test)
 - #155504 (Remove `AttributeLintKind` variants - part 2)
 - #155510 (Update Tidy python executable path)
 - #155514 (codegen-options docs: remove -Csoft-float)
@rust-bors rust-bors Bot merged commit 8beec01 into rust-lang:main Apr 19, 2026
11 checks passed
@rustbot rustbot added this to the 1.97.0 milestone Apr 19, 2026
rust-timer added a commit that referenced this pull request Apr 19, 2026
Rollup merge of #155370 - iyernaveenr:naveen_r_iyer/issue-114532-needs-test, r=Mark-Simulacrum

Add regression test for dead code elimination with drop + panic

Add a codegen test for #114532.

The bug was that dead code elimination failed when a `Drop` impl contained a `panic!` and a potentially-panicking external function was called after the value was created. This was fixed since 1.82 but no regression test was added.

The test verifies that `foo()` compiles to just a call to `unknown()` + `ret void`, with no panic or panicking call in the function body.

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

Labels

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

Development

Successfully merging this pull request may close these issues.

Dead code elimination fails when panicking in drop impl and panicable function is called

4 participants