diff options
| author | bors <bors@rust-lang.org> | 2025-06-21 18:54:29 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-06-21 18:54:29 +0000 |
| commit | d4e1159b8c97478778b09a4cc1c7adce5653b8bf (patch) | |
| tree | 5b30910b66c51467b03d70720091e96e07551995 /tests | |
| parent | ea34650916887b5075812d0f11c1d3209e7f94ab (diff) | |
| parent | 89b079d844454d0288fbce1160dab129987a4921 (diff) | |
| download | rust-d4e1159b8c97478778b09a4cc1c7adce5653b8bf.tar.gz rust-d4e1159b8c97478778b09a4cc1c7adce5653b8bf.zip | |
Auto merge of #142546 - cjgillot:reachable-jump, r=compiler-errors
Only traverse reachable blocks in JumpThreading. Fixes https://github.com/rust-lang/rust/issues/131451 We only compute loop headers for reachable blocks. We shouldn't try to perform an opt on unreachable blocks anyway.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui/mir/unreachable-loop-jump-threading.rs (renamed from tests/crashes/131451.rs) | 3 | ||||
| -rw-r--r-- | tests/ui/mir/unreachable-loop-jump-threading.stderr | 10 |
2 files changed, 12 insertions, 1 deletions
diff --git a/tests/crashes/131451.rs b/tests/ui/mir/unreachable-loop-jump-threading.rs index cd5b44bad8a..8403906bb5c 100644 --- a/tests/crashes/131451.rs +++ b/tests/ui/mir/unreachable-loop-jump-threading.rs @@ -1,9 +1,10 @@ -//@ known-bug: #131451 +//@ build-pass //@ needs-rustc-debug-assertions //@ compile-flags: -Zmir-enable-passes=+GVN -Zmir-enable-passes=+JumpThreading --crate-type=lib pub fn fun(terminate: bool) { while true {} + //~^ WARN denote infinite loops with `loop { ... }` while !terminate {} } diff --git a/tests/ui/mir/unreachable-loop-jump-threading.stderr b/tests/ui/mir/unreachable-loop-jump-threading.stderr new file mode 100644 index 00000000000..21b174c8021 --- /dev/null +++ b/tests/ui/mir/unreachable-loop-jump-threading.stderr @@ -0,0 +1,10 @@ +warning: denote infinite loops with `loop { ... }` + --> $DIR/unreachable-loop-jump-threading.rs:6:5 + | +LL | while true {} + | ^^^^^^^^^^ help: use `loop` + | + = note: `#[warn(while_true)]` on by default + +warning: 1 warning emitted + |
