mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-13 00:56:14 +00:00
29 lines
306 B
Rust
29 lines
306 B
Rust
//@ run-pass
|
|
|
|
#![allow(dead_code)]
|
|
|
|
enum Empty { }
|
|
enum Test1 {
|
|
A(u8),
|
|
B(Empty),
|
|
}
|
|
enum Test2 {
|
|
A(u8),
|
|
B(Empty),
|
|
C,
|
|
}
|
|
|
|
fn bar() -> Option<Empty> {
|
|
None
|
|
}
|
|
|
|
fn main() {
|
|
if let Some(x) = bar() {
|
|
Test1::B(x);
|
|
}
|
|
|
|
if let Some(x) = bar() {
|
|
Test2::B(x);
|
|
}
|
|
}
|