]> git.lizzy.rs Git - rust.git/blob - src/test/ui/pattern/usefulness/non-exhaustive-match-nested.rs
slice_patterns: remove gates in tests
[rust.git] / src / test / ui / pattern / usefulness / non-exhaustive-match-nested.rs
1 enum T { A(U), B }
2 enum U { C, D }
3
4 fn match_nested_vecs<'a, T>(l1: Option<&'a [T]>, l2: Result<&'a [T], ()>) -> &'static str {
5     match (l1, l2) { //~ ERROR non-exhaustive patterns: `(Some(&[]), Err(_))` not covered
6         (Some(&[]), Ok(&[])) => "Some(empty), Ok(empty)",
7         (Some(&[_, ..]), Ok(_)) | (Some(&[_, ..]), Err(())) => "Some(non-empty), any",
8         (None, Ok(&[])) | (None, Err(())) | (None, Ok(&[_])) => "None, Ok(less than one element)",
9         (None, Ok(&[_, _, ..])) => "None, Ok(at least two elements)"
10     }
11 }
12
13 fn main() {
14     let x = T::A(U::C);
15     match x { //~ ERROR non-exhaustive patterns: `A(C)` not covered
16         T::A(U::D) => { panic!("hello"); }
17         T::B => { panic!("goodbye"); }
18     }
19 }