Skip to content

Commit

Permalink
Add regression test for stack overflow in redundant_pattern_matching
Browse files Browse the repository at this point in the history
  • Loading branch information
flip1995 committed May 5, 2021
1 parent 37b5e81 commit f915f8f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/ui/crashes/ice-7169.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#[derive(Default)]
struct A<T> {
a: Vec<A<T>>,
b: T,
}

fn main() {
if let Ok(_) = Ok::<_, ()>(A::<String>::default()) {}
}
10 changes: 10 additions & 0 deletions tests/ui/crashes/ice-7169.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
error: redundant pattern matching, consider using `is_ok()`
--> $DIR/ice-7169.rs:8:12
|
LL | if let Ok(_) = Ok::<_, ()>(A::<String>::default()) {}
| -------^^^^^-------------------------------------- help: try this: `if Ok::<_, ()>(A::<String>::default()).is_ok()`
|
= note: `-D clippy::redundant-pattern-matching` implied by `-D warnings`

error: aborting due to previous error

0 comments on commit f915f8f

Please sign in to comment.