2018-08-30 07:18:55 -05:00
|
|
|
// run-pass
|
2018-09-25 16:51:35 -05:00
|
|
|
#![allow(dead_code)]
|
2018-02-23 18:12:35 -06:00
|
|
|
|
|
|
|
enum E {
|
|
|
|
V(u8),
|
|
|
|
U(u8),
|
|
|
|
W,
|
|
|
|
}
|
|
|
|
use E::*;
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let mut e = V(10);
|
|
|
|
|
|
|
|
if let V(x) | U(x) = e {
|
|
|
|
assert_eq!(x, 10);
|
|
|
|
}
|
|
|
|
while let V(x) | U(x) = e {
|
|
|
|
assert_eq!(x, 10);
|
|
|
|
e = W;
|
|
|
|
}
|
2019-01-11 16:57:04 -06:00
|
|
|
|
|
|
|
// Accept leading `|`:
|
|
|
|
|
|
|
|
let mut e = V(10);
|
|
|
|
|
|
|
|
if let | V(x) | U(x) = e {
|
|
|
|
assert_eq!(x, 10);
|
|
|
|
}
|
|
|
|
while let | V(x) | U(x) = e {
|
|
|
|
assert_eq!(x, 10);
|
|
|
|
e = W;
|
|
|
|
}
|
2018-02-23 18:12:35 -06:00
|
|
|
}
|