1 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 #![feature(struct_variant)]
15 second: Option<[uint, ..4]>
21 CustomRGBA { a: bool, r: u8, g: u8, b: u8 }
24 fn struct_with_a_nested_enum_and_vector() {
25 match (Foo { first: true, second: None }) {
26 //~^ ERROR non-exhaustive patterns: `Foo { first: false, second: Some([_, _, _, _]) }` not covered
27 Foo { first: true, second: None } => (),
28 Foo { first: true, second: Some(_) } => (),
29 Foo { first: false, second: None } => (),
30 Foo { first: false, second: Some([1u, 2u, 3u, 4u]) } => ()
34 fn enum_with_multiple_missing_variants() {
36 //~^ ERROR non-exhaustive patterns: `Red` not covered
37 CustomRGBA { .. } => ()
41 fn enum_struct_variant() {
43 //~^ ERROR non-exhaustive patterns: `CustomRGBA { a: true, .. }` not covered
46 CustomRGBA { a: false, r: _, g: _, b: 0 } => (),
47 CustomRGBA { a: false, r: _, g: _, b: _ } => ()
56 fn vectors_with_nested_enums() {
57 let x: &'static [Enum] = [First, Second(false)];
59 //~^ ERROR non-exhaustive patterns: `[Second(true), Second(false)]` not covered
63 [Second(true), First] => (),
64 [Second(true), Second(true)] => (),
65 [Second(false), _] => (),
66 [_, _, ..tail, _] => ()
72 //~^ ERROR non-exhaustive patterns: `((), false)` not covered