]> git.proxmox.com Git - rustc.git/blame - src/test/ui/pattern/usefulness/non-exhaustive-match-nested.rs
Update unsuspicious file list
[rustc.git] / src / test / ui / pattern / usefulness / non-exhaustive-match-nested.rs
CommitLineData
0731742a
XL
1enum T { A(U), B }
2enum U { C, D }
223e47cc 3
1a4d82fc 4fn match_nested_vecs<'a, T>(l1: Option<&'a [T]>, l2: Result<&'a [T], ()>) -> &'static str {
3157f602
XL
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)"
1a4d82fc
JJ
10 }
11}
12
223e47cc 13fn main() {
0731742a 14 let x = T::A(U::C);
f2b60f7d 15 match x { //~ ERROR non-exhaustive patterns: `T::A(U::C)` not covered
0731742a
XL
16 T::A(U::D) => { panic!("hello"); }
17 T::B => { panic!("goodbye"); }
223e47cc
LB
18 }
19}