rust/src/test/run-pass/guards-not-exhaustive.rs
2018-12-25 21:08:33 -07:00

17 lines
243 B
Rust

#![allow(non_snake_case)]
#[derive(Copy, Clone)]
enum Q { R(Option<usize>) }
fn xyzzy(q: Q) -> usize {
match q {
Q::R(S) if S.is_some() => { 0 }
_ => 1
}
}
pub fn main() {
assert_eq!(xyzzy(Q::R(Some(5))), 0);
}