make sure our disable flags do not miss all bugs; move type-assert intrinsic tests to their folder
This commit is contained in:
parent
03715907f4
commit
179e78d0ad
@ -1,3 +1,6 @@
|
||||
// Make sure we find these even with many checks disabled.
|
||||
// compile-flags: -Zmiri-disable-alignment-check -Zmiri-disable-stacked-borrows -Zmiri-disable-validation
|
||||
|
||||
fn main() {
|
||||
let p = {
|
||||
let b = Box::new(42);
|
||||
|
@ -1,3 +1,6 @@
|
||||
// Make sure we find these even with many checks disabled.
|
||||
// compile-flags: -Zmiri-disable-alignment-check -Zmiri-disable-stacked-borrows -Zmiri-disable-validation
|
||||
|
||||
fn main() {
|
||||
let p = {
|
||||
let b = Box::new(42);
|
||||
|
@ -1,4 +1,4 @@
|
||||
// error-pattern: the evaluated program aborted execution: attempted to instantiate uninhabited type `!`
|
||||
// error-pattern: the evaluated program aborted execution: attempted to instantiate uninhabited type `!`
|
||||
#![feature(never_type)]
|
||||
|
||||
#[allow(deprecated, invalid_value)]
|
6
tests/compile-fail/intrinsics/zero_fn_ptr.rs
Normal file
6
tests/compile-fail/intrinsics/zero_fn_ptr.rs
Normal file
@ -0,0 +1,6 @@
|
||||
// error-pattern: the evaluated program aborted execution: attempted to zero-initialize type `fn()`, which is invalid
|
||||
|
||||
#[allow(deprecated, invalid_value)]
|
||||
fn main() {
|
||||
unsafe { std::mem::zeroed::<fn()>() };
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
// Validation makes this fail in the wrong place
|
||||
// compile-flags: -Zmiri-disable-validation
|
||||
// Make sure we find these even with many checks disabled.
|
||||
// compile-flags: -Zmiri-disable-alignment-check -Zmiri-disable-stacked-borrows -Zmiri-disable-validation
|
||||
|
||||
fn main() {
|
||||
let b = unsafe { std::mem::transmute::<u8, bool>(2) };
|
||||
|
@ -1,5 +1,6 @@
|
||||
// Validation makes this fail in the wrong place
|
||||
// compile-flags: -Zmiri-disable-validation
|
||||
// Make sure we find these even with many checks disabled.
|
||||
// compile-flags: -Zmiri-disable-alignment-check -Zmiri-disable-stacked-borrows -Zmiri-disable-validation
|
||||
|
||||
fn main() {
|
||||
assert!(std::char::from_u32(-1_i32 as u32).is_none());
|
||||
|
@ -1,5 +1,6 @@
|
||||
// Validation makes this fail in the wrong place
|
||||
// compile-flags: -Zmiri-disable-validation
|
||||
// Make sure we find these even with many checks disabled.
|
||||
// compile-flags: -Zmiri-disable-alignment-check -Zmiri-disable-stacked-borrows -Zmiri-disable-validation
|
||||
|
||||
// error-pattern: invalid enum discriminant
|
||||
|
||||
|
8
tests/compile-fail/invalid_int.rs
Normal file
8
tests/compile-fail/invalid_int.rs
Normal file
@ -0,0 +1,8 @@
|
||||
// Validation makes this fail in the wrong place
|
||||
// Make sure we find these even with many checks disabled.
|
||||
// compile-flags: -Zmiri-disable-alignment-check -Zmiri-disable-stacked-borrows -Zmiri-disable-validation
|
||||
|
||||
fn main() {
|
||||
let i = unsafe { std::mem::MaybeUninit::<i32>::uninit().assume_init() };
|
||||
let _x = i + 0; //~ ERROR this operation requires initialized memory
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
// error-pattern: the evaluated program aborted execution: attempted to zero-initialize type `fn()`, which is invalid
|
||||
|
||||
#[allow(deprecated, invalid_value)]
|
||||
fn main() {
|
||||
unsafe { std::mem::zeroed::<fn()>() };
|
||||
}
|
@ -1,3 +1,6 @@
|
||||
// Make sure we find these even with many checks disabled.
|
||||
// compile-flags: -Zmiri-disable-alignment-check -Zmiri-disable-stacked-borrows -Zmiri-disable-validation
|
||||
|
||||
fn main() {
|
||||
let mut p = &42;
|
||||
unsafe {
|
||||
|
Loading…
x
Reference in New Issue
Block a user