blob: 6285427f59cbd0b5d56682be60424ee514e12b4d (
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
37
38
39
40
|
#![deny(pointer_structural_match)]
#![allow(dead_code)]
const C: *const u8 = &0;
// Make sure we also find pointers nested in other types.
const C_INNER: (*const u8, u8) = (C, 0);
fn foo(x: *const u8) {
match x {
C => {} //~ERROR: behave unpredictably
//~| previously accepted
_ => {}
}
}
fn foo2(x: *const u8) {
match (x, 1) {
C_INNER => {} //~ERROR: behave unpredictably
//~| previously accepted
_ => {}
}
}
const D: *const [u8; 4] = b"abcd";
const STR: *const str = "abcd";
fn main() {
match D {
D => {} //~ERROR: behave unpredictably
//~| previously accepted
_ => {}
}
match STR {
STR => {} //~ERROR: behave unpredictably
//~| previously accepted
_ => {}
}
}
|