From bfc8ce36f8978994c4bc3df9f210cb2d15363f02 Mon Sep 17 00:00:00 2001 From: varkor Date: Sun, 12 Aug 2018 20:47:23 +0100 Subject: [PATCH] Add a test for integer products --- src/test/ui/exhaustive_integer_patterns.rs | 6 ++++++ src/test/ui/exhaustive_integer_patterns.stderr | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/test/ui/exhaustive_integer_patterns.rs b/src/test/ui/exhaustive_integer_patterns.rs index 294481389f7..c267c4ef28c 100644 --- a/src/test/ui/exhaustive_integer_patterns.rs +++ b/src/test/ui/exhaustive_integer_patterns.rs @@ -132,4 +132,10 @@ fn main() { 128 ..= 255 if false => {} 128 ..= 255 => {} // ok, because previous arm was guarded } + + // Now things start getting a bit more interesting. Testing products! + match (0u8, Some(())) { //~ ERROR non-exhaustive patterns + (1, _) => {} + (_, None) => {} + } } diff --git a/src/test/ui/exhaustive_integer_patterns.stderr b/src/test/ui/exhaustive_integer_patterns.stderr index a2ed9416b50..6fabbebf487 100644 --- a/src/test/ui/exhaustive_integer_patterns.stderr +++ b/src/test/ui/exhaustive_integer_patterns.stderr @@ -52,6 +52,12 @@ error[E0004]: non-exhaustive patterns: `128u8..=255u8` not covered LL | match 0u8 { //~ ERROR non-exhaustive patterns | ^^^ pattern `128u8..=255u8` not covered -error: aborting due to 8 previous errors +error[E0004]: non-exhaustive patterns: `(0u8, Some(_))` and `(2u8..=255u8, Some(_))` not covered + --> $DIR/exhaustive_integer_patterns.rs:137:11 + | +LL | match (0u8, Some(())) { //~ ERROR non-exhaustive patterns + | ^^^^^^^^^^^^^^^ patterns `(0u8, Some(_))` and `(2u8..=255u8, Some(_))` not covered + +error: aborting due to 9 previous errors For more information about this error, try `rustc --explain E0004`. -- 2.44.0