File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change 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
44static mut LEAK : usize = 0 ;
55
Original file line number Diff line number Diff line change 11#[ repr( u32 ) ]
2+ #[ derive( Debug ) ]
23enum Bool { True }
34
45fn evil ( x : & mut Bool ) {
@@ -9,6 +10,7 @@ fn evil(x: &mut Bool) {
910fn 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}
You can’t perform that action at this time.
0 commit comments