diff --git a/ci.sh b/ci.sh index c2c36e1efc..915a4cf2fd 100755 --- a/ci.sh +++ b/ci.sh @@ -25,8 +25,8 @@ function run_tests { ./miri test --locked if ! [ -n "${MIRI_TEST_TARGET+exists}" ]; then # Only for host architecture: tests with MIR optimizations - # FIXME:only testing level 1 because of . - MIRI_TEST_FLAGS="-Z mir-opt-level=1" ./miri test --locked + # FIXME: only testing level 2 because of . + MIRI_TEST_FLAGS="-Z mir-opt-level=2" ./miri test --locked fi # "miri test" has built the sysroot for us, now this should pass without # any interactive questions. diff --git a/rust-version b/rust-version index 797f6e825a..d2cf18f80f 100644 --- a/rust-version +++ b/rust-version @@ -1 +1 @@ -d2454643e137bde519786ee9e650c455d7ad6f34 +e114d6228b948ce056de0bcdec2603c8e89d3727 diff --git a/tests/compile-fail/invalid_bool.rs b/tests/compile-fail/invalid_bool.rs index 6dee9ec3c9..796d8220dc 100644 --- a/tests/compile-fail/invalid_bool.rs +++ b/tests/compile-fail/invalid_bool.rs @@ -1,8 +1,9 @@ // Validation makes this fail in the wrong place // Make sure we find these even with many checks disabled. // compile-flags: -Zmiri-disable-alignment-check -Zmiri-disable-stacked-borrows -Zmiri-disable-validation +#![feature(test)] fn main() { let b = unsafe { std::mem::transmute::(2) }; - let _x = b == true; //~ ERROR interpreting an invalid 8-bit value as a bool: 0x02 + let _x = b == std::hint::black_box(true); //~ ERROR interpreting an invalid 8-bit value as a bool: 0x02 } diff --git a/tests/compile-fail/unaligned_pointers/unaligned_ptr_zst.rs b/tests/compile-fail/unaligned_pointers/unaligned_ptr_zst.rs index 169e98abf3..a9db5ff7df 100644 --- a/tests/compile-fail/unaligned_pointers/unaligned_ptr_zst.rs +++ b/tests/compile-fail/unaligned_pointers/unaligned_ptr_zst.rs @@ -2,8 +2,8 @@ // compile-flags: -Zmiri-disable-validation fn main() { - for _ in 0..10 { // Try many times as this might work by chance. - let x = 2u8; + for i in 0..10 { // Try many times as this might work by chance. + let x = i as u8; let x = &x as *const _ as *const [u32; 0]; // This must fail because alignment is violated. Test specifically for loading ZST. let _x = unsafe { *x }; //~ERROR alignment 4 is required diff --git a/tests/run-pass/float.rs b/tests/run-pass/float.rs index 0b89f11b06..327ea17731 100644 --- a/tests/run-pass/float.rs +++ b/tests/run-pass/float.rs @@ -1,5 +1,8 @@ -#![feature(stmt_expr_attributes)] +// compile-flags: -Zmir-opt-level=0 +// FIXME: Using opt-level 2 here makes the test take forever (https://github.com/rust-lang/rust/issues/76433). +#![feature(stmt_expr_attributes, test)] use std::fmt::Debug; +use std::hint::black_box; // Helper function to avoid promotion so that this tests "run-time" casts, not CTFE. // Doesn't make a big difference when running this in Miri, but it means we can compare this @@ -339,10 +342,6 @@ fn ops() { /// Tests taken from rustc test suite. /// -// Poor-man's black-box -#[inline(never)] -fn black_box(x: T) -> T { x } - macro_rules! test { ($val:expr, $src_ty:ident -> $dest_ty:ident, $expected:expr) => ( // black_box disables constant evaluation to test run-time conversions: diff --git a/tests/run-pass/u128.rs b/tests/run-pass/u128.rs index a2ca7746b1..bbc667c5dd 100644 --- a/tests/run-pass/u128.rs +++ b/tests/run-pass/u128.rs @@ -1,4 +1,5 @@ -fn b(t: T) -> T { t } +#![feature(test)] +use std::hint::black_box as b; fn main() { let x: u128 = 0xFFFF_FFFF_FFFF_FFFF__FFFF_FFFF_FFFF_FFFF;