2018-09-25 21:51:35 +00:00
|
|
|
#![allow(dead_code)]
|
2023-10-20 06:35:36 +00:00
|
|
|
|
2018-07-20 02:41:09 +00:00
|
|
|
const C: *const u8 = &0;
|
2023-10-20 06:35:36 +00:00
|
|
|
// Make sure we also find pointers nested in other types.
|
|
|
|
const C_INNER: (*const u8, u8) = (C, 0);
|
2018-07-20 02:41:09 +00:00
|
|
|
|
|
|
|
fn foo(x: *const u8) {
|
|
|
|
match x {
|
2023-10-19 06:36:24 +00:00
|
|
|
C => {} //~ERROR: behave unpredictably
|
2018-07-20 02:41:09 +00:00
|
|
|
_ => {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-10-20 06:35:36 +00:00
|
|
|
fn foo2(x: *const u8) {
|
|
|
|
match (x, 1) {
|
|
|
|
C_INNER => {} //~ERROR: behave unpredictably
|
|
|
|
_ => {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-20 02:41:09 +00:00
|
|
|
const D: *const [u8; 4] = b"abcd";
|
|
|
|
|
2023-11-11 10:12:09 +00:00
|
|
|
const STR: *const str = "abcd";
|
|
|
|
|
2018-07-20 02:41:09 +00:00
|
|
|
fn main() {
|
|
|
|
match D {
|
2023-10-19 06:36:24 +00:00
|
|
|
D => {} //~ERROR: behave unpredictably
|
2018-07-20 02:41:09 +00:00
|
|
|
_ => {}
|
|
|
|
}
|
2023-11-11 10:12:09 +00:00
|
|
|
|
|
|
|
match STR {
|
|
|
|
STR => {} //~ERROR: behave unpredictably
|
|
|
|
_ => {}
|
|
|
|
}
|
2018-07-20 02:41:09 +00:00
|
|
|
}
|