From 210f18d6c7962ae5125947e89d38cac34c65b6a8 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 7 Sep 2020 10:24:04 +0200 Subject: [PATCH] work around rustc optimizations becoming too smart --- ci.sh | 2 +- rust-version | 2 +- tests/compile-fail/invalid_bool.rs | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ci.sh b/ci.sh index c2c36e1efc1..a1d0a38c4fb 100755 --- a/ci.sh +++ b/ci.sh @@ -25,7 +25,7 @@ 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 . + # FIXME: only testing level 1 because of . MIRI_TEST_FLAGS="-Z mir-opt-level=1" ./miri test --locked fi # "miri test" has built the sysroot for us, now this should pass without diff --git a/rust-version b/rust-version index 797f6e825a7..d2cf18f80f1 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 6dee9ec3c91..933ee91c7d4 100644 --- a/tests/compile-fail/invalid_bool.rs +++ b/tests/compile-fail/invalid_bool.rs @@ -2,7 +2,9 @@ // Make sure we find these even with many checks disabled. // compile-flags: -Zmiri-disable-alignment-check -Zmiri-disable-stacked-borrows -Zmiri-disable-validation +fn dont_optimize(x: T) -> T { x } + 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 == dont_optimize(true); //~ ERROR interpreting an invalid 8-bit value as a bool: 0x02 }