commit
59619775ee
@ -1 +1 @@
|
||||
ff4a2533a0720f9cdd86e02eafa3725f07aa7752
|
||||
033013cab3a861224fd55f494c8be1cb0349eb49
|
||||
|
@ -2,7 +2,7 @@
|
||||
// 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: enum value has invalid discriminant: 0x0000002a
|
||||
// error-pattern: enum value has invalid tag: 0x0000002a
|
||||
|
||||
use std::mem;
|
||||
|
@ -4,5 +4,5 @@ pub enum Foo {
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let _f = unsafe { std::mem::transmute::<i32, Foo>(42) }; //~ ERROR encountered 0x0000002a, but expected a valid enum discriminant
|
||||
let _f = unsafe { std::mem::transmute::<i32, Foo>(42) }; //~ ERROR encountered 0x0000002a, but expected a valid enum tag
|
||||
}
|
@ -3,12 +3,12 @@ enum Bool { True }
|
||||
|
||||
fn evil(x: &mut Bool) {
|
||||
let x = x as *mut _ as *mut u32;
|
||||
unsafe { *x = 44; } // out-of-bounds enum discriminant
|
||||
unsafe { *x = 44; } // out-of-bounds enum tag
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let mut x = Bool::True;
|
||||
evil(&mut x);
|
||||
let _y = x; // reading this ought to be enough to trigger validation
|
||||
//~^ ERROR encountered 0x0000002c, but expected a valid enum discriminant
|
||||
//~^ ERROR encountered 0x0000002c, but expected a valid enum tag
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
// ignore-windows: Unwind panicking does not currently work on Windows
|
||||
// normalize-stderr-test "[^ ]*libcore/(macros|mem)/mod.rs[0-9:]*" -> "$$LOC"
|
||||
// normalize-stderr-test "[^ ]*libcore/[a-z/]+.rs[0-9:]*" -> "$$LOC"
|
||||
#![feature(never_type)]
|
||||
#![allow(unconditional_panic)]
|
||||
use std::panic::{catch_unwind, AssertUnwindSafe};
|
||||
@ -75,7 +75,7 @@ fn main() {
|
||||
// Assertion and debug assertion
|
||||
test(None, |_old_val| { assert!(false); loop {} });
|
||||
test(None, |_old_val| { debug_assert!(false); loop {} });
|
||||
test(None, |_old_val| { unsafe { (1 as *const i32).read() }; loop {} }); // trigger debug-assertion in libstd
|
||||
test(None, |_old_val| { unsafe { std::char::from_u32_unchecked(0xFD10000); } loop {} }); // trigger debug-assertion in libstd
|
||||
|
||||
eprintln!("Success!"); // Make sure we get this in stderr
|
||||
}
|
||||
|
@ -22,6 +22,6 @@ thread 'main' panicked at 'assertion failed: false', $DIR/catch_panic.rs:76:29
|
||||
Caught panic message (&str): assertion failed: false
|
||||
thread 'main' panicked at 'assertion failed: false', $DIR/catch_panic.rs:77:29
|
||||
Caught panic message (&str): assertion failed: false
|
||||
thread 'main' panicked at 'attempt to copy from unaligned or null pointer', $LOC
|
||||
Caught panic message (String): attempt to copy from unaligned or null pointer
|
||||
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', $LOC
|
||||
Caught panic message (String): called `Option::unwrap()` on a `None` value
|
||||
Success!
|
||||
|
@ -1,3 +1,4 @@
|
||||
#![allow(incomplete_features)]
|
||||
#![feature(specialization)]
|
||||
|
||||
trait IsUnit {
|
||||
|
Loading…
Reference in New Issue
Block a user