diff options
| author | flip1995 <philipp.krones@embecosm.com> | 2021-05-05 15:35:14 +0200 |
|---|---|---|
| committer | flip1995 <philipp.krones@embecosm.com> | 2021-05-05 16:12:39 +0200 |
| commit | 59874f3bea8fc27ec0659768b661c7961e73d4ab (patch) | |
| tree | 27e11487f4d3756f569973ccb49bcd8d0508bd6c | |
| parent | 344f04bea6fd61a10d079ca51d331307f4747288 (diff) | |
| download | rust-59874f3bea8fc27ec0659768b661c7961e73d4ab.tar.gz rust-59874f3bea8fc27ec0659768b661c7961e73d4ab.zip | |
Add regression test for stack overflow in redundant_pattern_matching
| -rw-r--r-- | tests/ui/crashes/ice-7169.rs | 9 | ||||
| -rw-r--r-- | tests/ui/crashes/ice-7169.stderr | 10 |
2 files changed, 19 insertions, 0 deletions
diff --git a/tests/ui/crashes/ice-7169.rs b/tests/ui/crashes/ice-7169.rs new file mode 100644 index 00000000000..82095febc19 --- /dev/null +++ b/tests/ui/crashes/ice-7169.rs @@ -0,0 +1,9 @@ +#[derive(Default)] +struct A<T> { + a: Vec<A<T>>, + b: T, +} + +fn main() { + if let Ok(_) = Ok::<_, ()>(A::<String>::default()) {} +} diff --git a/tests/ui/crashes/ice-7169.stderr b/tests/ui/crashes/ice-7169.stderr new file mode 100644 index 00000000000..5a9cd32380a --- /dev/null +++ b/tests/ui/crashes/ice-7169.stderr @@ -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 + |
