+// 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);
+// 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);
--- /dev/null
+// error-pattern: the evaluated program aborted execution: attempted to instantiate uninhabited type `!`
+#![feature(never_type)]
+
+#[allow(deprecated, invalid_value)]
+fn main() {
+ unsafe { std::mem::uninitialized::<!>() };
+}
--- /dev/null
+// 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()>() };
+}
// 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) };
// 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());
// 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
--- /dev/null
+// 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
+}
+++ /dev/null
- // 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()>() };
-}
+// 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 {
+++ /dev/null
- // error-pattern: the evaluated program aborted execution: attempted to instantiate uninhabited type `!`
-#![feature(never_type)]
-
-#[allow(deprecated, invalid_value)]
-fn main() {
- unsafe { std::mem::uninitialized::<!>() };
-}