-
Notifications
You must be signed in to change notification settings - Fork 32
/
issue-57472.rs
61 lines (56 loc) · 1.38 KB
/
issue-57472.rs
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#![crate_type = "lib"]
#![deny(unreachable_patterns)]
mod test_struct {
// Test the exact copy of the minimal example
// posted in the issue.
pub struct Punned {
foo: [u8; 1],
bar: [u8; 1],
}
pub fn test(punned: Punned) {
match punned {
Punned { foo: [_], .. } => println!("foo"),
Punned { bar: [_], .. } => println!("bar"),
//~^ ERROR unreachable pattern [unreachable_patterns]
}
}
}
mod test_union {
// Test the same thing using a union.
pub union Punned {
foo: [u8; 1],
bar: [u8; 1],
}
pub fn test(punned: Punned) {
unsafe {
match punned {
Punned { foo: [_] } => println!("foo"),
Punned { bar: [_] } => println!("bar"),
//~^ ERROR unreachable pattern [unreachable_patterns]
}
}
}
}
// ferrocene-annotations: fls_e9hwvqsib5d5
// Modules
//
// ferrocene-annotations: fls_jdknpu3kf865
// Visibility
//
// ferrocene-annotations: fls_9ucqbbd0s2yo
// Struct Types
//
// ferrocene-annotations: fls_uj0kpjwyld60
// Array Types
//
// ferrocene-annotations: fls_e5td0fa92fay
// Match Expressions
//
// ferrocene-annotations: fls_7dbd5t2750ce
// Struct Patterns
//
// ferrocene-annotations: fls_nruvg0es3kx7
// Record Struct Patterns
//
// ferrocene-annotations: fls_fmdn7n7s413d
// Union Types