ensure that -Zmiri-check-number-validity detects integers with provenance

This commit is contained in:
Ralf Jung 2022-03-26 13:10:20 -04:00
parent 017b0fb737
commit ede470e1fc
2 changed files with 12 additions and 0 deletions

View File

@ -0,0 +1,6 @@
// compile-flags: -Zmiri-check-number-validity
fn main() {
let r = &mut 42;
let _i: [usize; 1] = unsafe { std::mem::transmute(r) }; //~ ERROR encountered a pointer, but expected plain (non-pointer) bytes
}

View File

@ -0,0 +1,6 @@
// compile-flags: -Zmiri-check-number-validity
fn main() {
let r = &mut 42;
let _i: usize = unsafe { std::mem::transmute(r) }; //~ ERROR expected initialized plain (non-pointer) bytes
}