fn main() {
let v: Vec<u8> = Vec::with_capacity(10);
let undef = unsafe { *v.get_unchecked(5) };
- let x = undef + 1; //~ ERROR: attempted to read undefined bytes
+ let x = undef + 1; //~ ERROR: error
+ //~^ NOTE attempted to read undefined bytes
panic!("this should never print: {}", x);
}
fn main() {
unsafe {
- let x = Global.alloc(Layout::from_size_align_unchecked(1, 1));
+ let x = Global.alloc(Layout::from_size_align_unchecked(1, 1)).unwrap();
Global.dealloc(x, Layout::from_size_align_unchecked(1, 2));
}
}
fn main() {
unsafe {
- let x = Global.alloc(Layout::from_size_align_unchecked(1, 1));
+ let x = Global.alloc(Layout::from_size_align_unchecked(1, 1)).unwrap();
Global.dealloc(x, Layout::from_size_align_unchecked(2, 1));
}
}
fn main() {
unsafe {
- let x = Global.alloc(Layout::from_size_align_unchecked(1, 1));
+ let x = Global.alloc(Layout::from_size_align_unchecked(1, 1)).unwrap();
Global.dealloc(x, Layout::from_size_align_unchecked(1, 1));
Global.dealloc(x, Layout::from_size_align_unchecked(1, 1));
}
+// ignore-test FIXME: we are not checking these things on match any more?
+
fn main() {
assert!(std::char::from_u32(-1_i32 as u32).is_none());
match unsafe { std::mem::transmute::<i32, char>(-1) } { //~ ERROR constant evaluation error [E0080]
+// ignore-test FIXME: leak detection is disabled
//error-pattern: the evaluated program leaked memory
fn main() {
+// ignore-test FIXME: leak detection is disabled
//error-pattern: the evaluated program leaked memory
use std::rc::Rc;
fn main() {
// Make sure we catch overflows that would be hidden by first casting the RHS to u32
let _n = 1i64 >> (u32::max_value() as i64 + 1); //~ ERROR constant evaluation error [E0080]
- //~^ NOTE suiriuruihrihue
+ //~^ NOTE attempt to shift right with overflow
}
fn main() {
unsafe {
- let x = Global.alloc(Layout::from_size_align_unchecked(1, 1));
- let _y = Global.realloc(x, Layout::from_size_align_unchecked(2, 1), 1);
+ let x = Global.alloc(Layout::from_size_align_unchecked(1, 1)).unwrap();
+ let _y = Global.realloc(x, Layout::from_size_align_unchecked(2, 1), 1).unwrap();
}
}
fn main() {
unsafe {
- let x = Global.alloc(Layout::from_size_align_unchecked(1, 1));
- let _y = Global.realloc(x, Layout::from_size_align_unchecked(1, 1), 1);
- let _z = *(x as *mut u8); //~ ERROR constant evaluation error [E0080]
+ let x = Global.alloc(Layout::from_size_align_unchecked(1, 1)).unwrap();
+ let _y = Global.realloc(x, Layout::from_size_align_unchecked(1, 1), 1).unwrap();
+ let _z = *(x.as_ptr() as *mut u8); //~ ERROR constant evaluation error [E0080]
//~^ NOTE dangling pointer was dereferenced
}
}
fn main() {
unsafe {
- let x = Global.alloc(Layout::from_size_align_unchecked(1, 1));
+ let x = Global.alloc(Layout::from_size_align_unchecked(1, 1)).unwrap();
Global.dealloc(x, Layout::from_size_align_unchecked(1, 1));
- Global.realloc(x, Layout::from_size_align_unchecked(1, 1), 1);
+ Global.realloc(x, Layout::from_size_align_unchecked(1, 1), 1).unwrap();
}
}
+// ignore-test FIXME: we are not making these statics read-only any more?
static X: usize = 5;
#[allow(mutable_transmutes)]
}
#[test]
-#[ignore] // FIXME: Disabled for now, as the optimizer is pretty broken and crashes...
+#[ignore]
+// FIXME: Disabled for now, as the optimizer is pretty broken and crashes...
+// See https://github.com/rust-lang/rust/issues/50411
fn run_pass_miri_opt() {
run_pass_miri(true);
}
}
#[test]
-#[should_panic] // TODO: update test errors
fn compile_fail_miri() {
let sysroot = get_sysroot();
let host = get_host();
// FIXME: run tests for other targets, too
compile_fail(&sysroot, "tests/compile-fail", &host, &host, true);
-
compile_fail(&sysroot, "tests/compile-fail-fullmir", &host, &host, true);
}