ensure that -Zmiri-check-number-validity detects integers with provenance
This commit is contained in:
parent
017b0fb737
commit
ede470e1fc
6
tests/compile-fail/ptr_integer_array_transmute.rs
Normal file
6
tests/compile-fail/ptr_integer_array_transmute.rs
Normal 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
|
||||
}
|
6
tests/compile-fail/ptr_integer_transmute.rs
Normal file
6
tests/compile-fail/ptr_integer_transmute.rs
Normal 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
|
||||
}
|
Loading…
Reference in New Issue
Block a user