Skip to content

Commit 2425f80

Browse files
committed
add regression test for guard patterns liveness ICE
1 parent a417515 commit 2425f80

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//@ check-pass
2+
//! Regression test for issue #146445.
3+
//!
4+
//! This test ensures that liveness linting works correctly with guard patterns
5+
//! and doesn't cause an ICE ("no successor") when using variables without
6+
//! underscore prefixes in guard expressions.
7+
//!
8+
//! Fixed by #142390 which moved liveness analysis to MIR.
9+
10+
#![feature(guard_patterns)]
11+
#![expect(incomplete_features)]
12+
13+
fn main() {
14+
// This used to ICE before liveness analysis was moved to MIR.
15+
// The variable `main` (without underscore prefix) would trigger
16+
// liveness linting which wasn't properly implemented for guard patterns.
17+
match (0,) {
18+
(_ if { let main = false; main },) => {}
19+
_ => {}
20+
}
21+
}

0 commit comments

Comments
 (0)