diff options
| author | Ralf Jung <post@ralfj.de> | 2024-03-22 16:04:28 +0100 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2024-03-22 16:04:28 +0100 |
| commit | ee57d2b318fc17080740172896269cd9865a17f4 (patch) | |
| tree | 2e95d58c16c36d9159307f386ce1912c94bc4fff /tests/coverage/let_else_loop.coverage | |
| parent | 5719d09d92a4dc171531452b5f72f46c28c9ee32 (diff) | |
| parent | 2171243b2b9cf1be8f285f200fbede9a47585d18 (diff) | |
Merge from rustc
Diffstat (limited to 'tests/coverage/let_else_loop.coverage')
| -rw-r--r-- | tests/coverage/let_else_loop.coverage | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/coverage/let_else_loop.coverage b/tests/coverage/let_else_loop.coverage new file mode 100644 index 00000000000..d193c8ca1b5 --- /dev/null +++ b/tests/coverage/let_else_loop.coverage @@ -0,0 +1,35 @@ + LL| |#![feature(coverage_attribute)] + LL| |//@ edition: 2021 + LL| | + LL| |// Regression test for <https://github.com/rust-lang/rust/issues/122738>. + LL| |// These code patterns should not trigger an ICE when allocating a physical + LL| |// counter to a node and also one of its in-edges, because that is allowed + LL| |// when the node contains a tight loop to itself. + LL| | + LL| 1|fn loopy(cond: bool) { + LL| 1| let true = cond else { loop {} }; + ^0 + LL| 1|} + LL| | + LL| |// Variant that also has `loop {}` on the success path. + LL| |// This isn't needed to catch the original ICE, but might help detect regressions. + LL| 0|fn _loop_either_way(cond: bool) { + LL| 0| let true = cond else { loop {} }; + LL| 0| loop {} + LL| |} + LL| | + LL| |// Variant using regular `if` instead of let-else. + LL| |// This doesn't trigger the original ICE, but might help detect regressions. + LL| 0|fn _if(cond: bool) { + LL| 0| if cond { + LL| 0| loop {} + LL| | } else { + LL| 0| loop {} + LL| | } + LL| |} + LL| | + LL| |#[coverage(off)] + LL| |fn main() { + LL| | loopy(true); + LL| |} + |
