File tree Expand file tree Collapse file tree 6 files changed +13
-12
lines changed Expand file tree Collapse file tree 6 files changed +13
-12
lines changed Original file line number Diff line number Diff line change @@ -25,8 +25,8 @@ function run_tests {
2525 ./miri test --locked
2626 if ! [ -n " ${MIRI_TEST_TARGET+exists} " ]; then
2727 # Only for host architecture: tests with MIR optimizations
28- # FIXME:only testing level 1 because of <https://github.com/rust-lang/rust/issues/73223 >.
29- MIRI_TEST_FLAGS=" -Z mir-opt-level=1 " ./miri test --locked
28+ # FIXME: only testing level 2 because of <https://github.com/rust-lang/rust/issues/76432 >.
29+ MIRI_TEST_FLAGS=" -Z mir-opt-level=2 " ./miri test --locked
3030 fi
3131 # "miri test" has built the sysroot for us, now this should pass without
3232 # any interactive questions.
Original file line number Diff line number Diff line change 1- d2454643e137bde519786ee9e650c455d7ad6f34
1+ e114d6228b948ce056de0bcdec2603c8e89d3727
Original file line number Diff line number Diff line change 11// Validation makes this fail in the wrong place
22// Make sure we find these even with many checks disabled.
33// compile-flags: -Zmiri-disable-alignment-check -Zmiri-disable-stacked-borrows -Zmiri-disable-validation
4+ #![ feature( test) ]
45
56fn main ( ) {
67 let b = unsafe { std:: mem:: transmute :: < u8 , bool > ( 2 ) } ;
7- let _x = b == true ; //~ ERROR interpreting an invalid 8-bit value as a bool: 0x02
8+ let _x = b == std :: hint :: black_box ( true ) ; //~ ERROR interpreting an invalid 8-bit value as a bool: 0x02
89}
Original file line number Diff line number Diff line change 22// compile-flags: -Zmiri-disable-validation
33
44fn main ( ) {
5- for _ in 0 ..10 { // Try many times as this might work by chance.
6- let x = 2u8 ;
5+ for i in 0 ..10 { // Try many times as this might work by chance.
6+ let x = i as u8 ;
77 let x = & x as * const _ as * const [ u32 ; 0 ] ;
88 // This must fail because alignment is violated. Test specifically for loading ZST.
99 let _x = unsafe { * x } ; //~ERROR alignment 4 is required
Original file line number Diff line number Diff line change 1- #![ feature( stmt_expr_attributes) ]
1+ // compile-flags: -Zmir-opt-level=0
2+ // FIXME: Using opt-level 2 here makes the test take forever (https://github.com/rust-lang/rust/issues/76433).
3+ #![ feature( stmt_expr_attributes, test) ]
24use std:: fmt:: Debug ;
5+ use std:: hint:: black_box;
36
47// Helper function to avoid promotion so that this tests "run-time" casts, not CTFE.
58// Doesn't make a big difference when running this in Miri, but it means we can compare this
@@ -339,10 +342,6 @@ fn ops() {
339342/// Tests taken from rustc test suite.
340343///
341344
342- // Poor-man's black-box
343- #[ inline( never) ]
344- fn black_box < T > ( x : T ) -> T { x }
345-
346345macro_rules! test {
347346 ( $val: expr, $src_ty: ident -> $dest_ty: ident, $expected: expr) => (
348347 // black_box disables constant evaluation to test run-time conversions:
Original file line number Diff line number Diff line change 1- fn b < T > ( t : T ) -> T { t }
1+ #![ feature( test) ]
2+ use std:: hint:: black_box as b;
23
34fn main ( ) {
45 let x: u128 = 0xFFFF_FFFF_FFFF_FFFF__FFFF_FFFF_FFFF_FFFF ;
You can’t perform that action at this time.
0 commit comments