Skip to content

Commit 08e076c

Browse files
committed
account for mir-opts masking more errors
1 parent 83a339e commit 08e076c

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

tests/compile-fail/storage_dead_dangling.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// This should fail even without validation
2-
// compile-flags: -Zmiri-disable-validation
1+
// This should fail even without validation, but some MIR opts mask the error
2+
// compile-flags: -Zmiri-disable-validation -Zmir-opt-level=0
33

44
static mut LEAK: usize = 0;
55

tests/compile-fail/validity/transmute_through_ptr.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#[repr(u32)]
2+
#[derive(Debug)]
23
enum Bool { True }
34

45
fn evil(x: &mut Bool) {
@@ -9,6 +10,7 @@ fn evil(x: &mut Bool) {
910
fn main() {
1011
let mut x = Bool::True;
1112
evil(&mut x);
12-
let _y = x; // reading this ought to be enough to trigger validation
13+
let y = x; // reading this ought to be enough to trigger validation
1314
//~^ ERROR encountered 0x0000002c at .<enum-tag>, but expected a valid enum tag
15+
println!("{:?}", y); // make sure it is used (and not optimized away)
1416
}

0 commit comments

Comments
 (0)