]> git.lizzy.rs Git - rust.git/blobdiff - src/test/compile-fail/non-exhaustive-pattern-witness.rs
auto merge of #15421 : catharsis/rust/doc-ffi-minor-fixes, r=alexcrichton
[rust.git] / src / test / compile-fail / non-exhaustive-pattern-witness.rs
index 22e93d70858e4deb68220fabdfd0f9cc6adbea50..6dc5ad8b606c37e7055f17596f5db1b43def01f0 100644 (file)
@@ -22,8 +22,8 @@ enum Color {
 }
 
 fn struct_with_a_nested_enum_and_vector() {
-    match Foo { first: true, second: None } {
-    //~^ ERROR non-exhaustive patterns: `Foo{first: false, second: Some([_, _, _, _])}` not covered
+    match (Foo { first: true, second: None }) {
+//~^ ERROR non-exhaustive patterns: `Foo { first: false, second: Some([_, _, _, _]) }` not covered
         Foo { first: true, second: None } => (),
         Foo { first: true, second: Some(_) } => (),
         Foo { first: false, second: None } => (),
@@ -40,7 +40,7 @@ fn enum_with_multiple_missing_variants() {
 
 fn enum_struct_variant() {
     match Red {
-    //~^ ERROR non-exhaustive patterns: `CustomRGBA{a: true, r: _, g: _, b: _}` not covered
+    //~^ ERROR non-exhaustive patterns: `CustomRGBA { a: true, .. }` not covered
         Red => (),
         Green => (),
         CustomRGBA { a: false, r: _, g: _, b: 0 } => (),
@@ -67,8 +67,11 @@ fn vectors_with_nested_enums() {
     }
 }
 
-fn main() {
-    struct_with_a_nested_enum_and_vector();
-    enum_with_multiple_missing_variants();
-    enum_struct_variant();
-}
\ No newline at end of file
+fn missing_nil() {
+    match ((), false) {
+    //~^ ERROR non-exhaustive patterns: `((), false)` not covered
+        ((), true) => ()
+    }
+}
+
+fn main() {}