Convert legitimate failing errors to the new error format

This commit is contained in:
bjorn3
2018-05-09 19:24:25 +02:00
parent 8ae66db798
commit 94754de600
5 changed files with 7 additions and 9 deletions

View File

@@ -249,6 +249,7 @@ pub fn eval_main<'a, 'tcx: 'a>(
Ok(()) => {
let leaks = ecx.memory().leak_report();
if leaks != 0 {
// TODO: Prevent leaks which aren't supposed to be there
//tcx.sess.err("the evaluated program leaked memory");
}
}

View File

@@ -1,6 +1,7 @@
fn main() {
assert!(std::char::from_u32(-1_i32 as u32).is_none());
match unsafe { std::mem::transmute::<i32, char>(-1) } { //~ERROR tried to interpret an invalid 32-bit value as a char: 4294967295
match unsafe { std::mem::transmute::<i32, char>(-1) } { //~ ERROR constant evaluation error [E0080]
//~^ NOTE tried to interpret an invalid 32-bit value as a char: 4294967295
'a' => {},
'b' => {},
_ => {},

View File

@@ -12,5 +12,6 @@
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); //~ Overflow(Shr)
let _n = 1i64 >> (u32::max_value() as i64 + 1); //~ ERROR constant evaluation error [E0080]
//~^ NOTE suiriuruihrihue
}

View File

@@ -1,6 +0,0 @@
// error-pattern the type `[u8;
fn main() {
let data: [u8; std::usize::MAX] = [42; std::usize::MAX];
assert_eq!(data.len(), 1024);
}

View File

@@ -3,7 +3,8 @@ static X: usize = 5;
#[allow(mutable_transmutes)]
fn main() {
unsafe {
*std::mem::transmute::<&usize, &mut usize>(&X) = 6; //~ ERROR: tried to modify constant memory
*std::mem::transmute::<&usize, &mut usize>(&X) = 6; //~ ERROR constant evaluation error [E0080]
//~^ NOTE tried to modify constant memory
assert_eq!(X, 6);
}
}