2018-08-30 14:18:55 +02:00
|
|
|
// run-pass
|
2018-09-25 23:51:35 +02:00
|
|
|
#![allow(dead_code)]
|
2018-02-24 03:12:35 +03: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 23:57:04 +01: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-24 03:12:35 +03:00
|
|
|
}
|