blob: c4630f76b3a1341bf5e8c2abe0902bc58339562c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
// run-pass
#![allow(dead_code)]
enum OpenResult {
Ok(()),
Err(()),
TransportErr(TransportErr),
}
#[repr(i32)]
enum TransportErr {
UnknownMethod = -2,
}
#[inline(never)]
fn some_match(result: OpenResult) -> u8 {
match result {
OpenResult::Ok(()) => 0,
_ => 1,
}
}
fn main() {
let result = OpenResult::Ok(());
assert_eq!(some_match(result), 0);
let result = OpenResult::Ok(());
match result {
OpenResult::Ok(()) => (),
_ => unreachable!("message a"),
}
match result {
OpenResult::Ok(()) => (),
_ => unreachable!("message b"),
}
}
|