work around rustc optimizations becoming too smart
This commit is contained in:
parent
5f1182d04a
commit
210f18d6c7
2
ci.sh
2
ci.sh
@ -25,7 +25,7 @@ function run_tests {
|
|||||||
./miri test --locked
|
./miri test --locked
|
||||||
if ! [ -n "${MIRI_TEST_TARGET+exists}" ]; then
|
if ! [ -n "${MIRI_TEST_TARGET+exists}" ]; then
|
||||||
# Only for host architecture: tests with MIR optimizations
|
# Only for host architecture: tests with MIR optimizations
|
||||||
# FIXME:only testing level 1 because of <https://github.com/rust-lang/rust/issues/73223>.
|
# 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
|
MIRI_TEST_FLAGS="-Z mir-opt-level=1" ./miri test --locked
|
||||||
fi
|
fi
|
||||||
# "miri test" has built the sysroot for us, now this should pass without
|
# "miri test" has built the sysroot for us, now this should pass without
|
||||||
|
@ -1 +1 @@
|
|||||||
d2454643e137bde519786ee9e650c455d7ad6f34
|
e114d6228b948ce056de0bcdec2603c8e89d3727
|
||||||
|
@ -2,7 +2,9 @@
|
|||||||
// Make sure we find these even with many checks disabled.
|
// Make sure we find these even with many checks disabled.
|
||||||
// compile-flags: -Zmiri-disable-alignment-check -Zmiri-disable-stacked-borrows -Zmiri-disable-validation
|
// compile-flags: -Zmiri-disable-alignment-check -Zmiri-disable-stacked-borrows -Zmiri-disable-validation
|
||||||
|
|
||||||
|
fn dont_optimize<T>(x: T) -> T { x }
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let b = unsafe { std::mem::transmute::<u8, bool>(2) };
|
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 == dont_optimize(true); //~ ERROR interpreting an invalid 8-bit value as a bool: 0x02
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user