Skip to content

Commit 59874f3

Browse files
committed
Add regression test for stack overflow in redundant_pattern_matching
1 parent 344f04b commit 59874f3

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

tests/ui/crashes/ice-7169.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#[derive(Default)]
2+
struct A<T> {
3+
a: Vec<A<T>>,
4+
b: T,
5+
}
6+
7+
fn main() {
8+
if let Ok(_) = Ok::<_, ()>(A::<String>::default()) {}
9+
}

tests/ui/crashes/ice-7169.stderr

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error: redundant pattern matching, consider using `is_ok()`
2+
--> $DIR/ice-7169.rs:8:12
3+
|
4+
LL | if let Ok(_) = Ok::<_, ()>(A::<String>::default()) {}
5+
| -------^^^^^-------------------------------------- help: try this: `if Ok::<_, ()>(A::<String>::default()).is_ok()`
6+
|
7+
= note: `-D clippy::redundant-pattern-matching` implied by `-D warnings`
8+
9+
error: aborting due to previous error
10+

0 commit comments

Comments
 (0)