]> git.lizzy.rs Git - rust.git/commitdiff
Add singleton patterns to test
authorvarkor <github@varkor.com>
Tue, 22 May 2018 00:03:05 +0000 (01:03 +0100)
committervarkor <github@varkor.com>
Thu, 16 Aug 2018 19:09:05 +0000 (20:09 +0100)
src/test/ui/exhaustive_integer_patterns.rs
src/test/ui/exhaustive_integer_patterns.stderr

index 8076441504565850091be39a6a278ceb2332a53a..e8f2affbec35812e307c991000bf085b32a5dc9c 100644 (file)
@@ -34,7 +34,7 @@ fn main() {
     }
 
     // An incomplete set of values.
-    match x { //~ ERROR non-exhaustive patterns: `128u8...255u8` not covered
+    match x { //~ ERROR non-exhaustive patterns
         0 .. 128 => {}
     }
 
@@ -96,10 +96,19 @@ fn main() {
         -128 ..= 127 => {} // ok
     }
 
+    match 0i8 { //~ ERROR non-exhaustive patterns
+        -127 ..= 127 => {}
+    }
+
     match 0i16 {
         i16::MIN ..= i16::MAX => {} // ok
     }
 
+    match 0i16 { //~ ERROR non-exhaustive patterns
+        i16::MIN ..= -1 => {}
+        1 ..= i16::MAX => {}
+    }
+
     match 0i32 {
         i32::MIN ..= i32::MAX => {} // ok
     }
index 85f12dad04736aaf9f38d74bb96f171579db89c9..243ba05251a48f7112749aa7127ec31c84d1cecd 100644 (file)
@@ -13,7 +13,7 @@ LL | #![deny(unreachable_patterns)]
 error[E0004]: non-exhaustive patterns: `128u8...255u8` not covered
   --> $DIR/exhaustive_integer_patterns.rs:37:11
    |
-LL |     match x { //~ ERROR non-exhaustive patterns: `128u8...255u8` not covered
+LL |     match x { //~ ERROR non-exhaustive patterns
    |           ^ pattern `128u8...255u8` not covered
 
 error[E0004]: non-exhaustive patterns: `11u8...19u8`, `31u8...34u8`, `36u8...69u8` and 1 more not covered
@@ -34,6 +34,18 @@ error[E0004]: non-exhaustive patterns: `-128i8...-6i8` and `122i8...127i8` not c
 LL |     match x { //~ ERROR non-exhaustive patterns
    |           ^ patterns `-128i8...-6i8` and `122i8...127i8` not covered
 
-error: aborting due to 5 previous errors
+error[E0004]: non-exhaustive patterns: `-128i8` not covered
+  --> $DIR/exhaustive_integer_patterns.rs:99:11
+   |
+LL |     match 0i8 { //~ ERROR non-exhaustive patterns
+   |           ^^^ pattern `-128i8` not covered
+
+error[E0004]: non-exhaustive patterns: `0i16` not covered
+  --> $DIR/exhaustive_integer_patterns.rs:107:11
+   |
+LL |     match 0i16 { //~ ERROR non-exhaustive patterns
+   |           ^^^^ pattern `0i16` not covered
+
+error: aborting due to 7 previous errors
 
 For more information about this error, try `rustc --explain E0004`.