Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://github.com/rust-lang/rust/issues/73223>.
MIRI_TEST_FLAGS="-Z mir-opt-level=1" ./miri test --locked
# FIXME: only testing level 2 because of <https://github.com/rust-lang/rust/issues/76432>.
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.
Expand Down
2 changes: 1 addition & 1 deletion rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
d2454643e137bde519786ee9e650c455d7ad6f34
e114d6228b948ce056de0bcdec2603c8e89d3727
3 changes: 2 additions & 1 deletion tests/compile-fail/invalid_bool.rs
Original file line number Diff line number Diff line change
@@ -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::<u8, bool>(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
}
4 changes: 2 additions & 2 deletions tests/compile-fail/unaligned_pointers/unaligned_ptr_zst.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 4 additions & 5 deletions tests/run-pass/float.rs
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -339,10 +342,6 @@ fn ops() {
/// Tests taken from rustc test suite.
///

// Poor-man's black-box
#[inline(never)]
fn black_box<T>(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:
Expand Down
3 changes: 2 additions & 1 deletion tests/run-pass/u128.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
fn b<T>(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;
Expand Down