Auto merge of #1538 - RalfJung:rustup, r=RalfJung
rustup: work around rustc optimizations becoming too smart
This commit is contained in:
commit
bb9db2bf8f
6 changed files with 13 additions and 12 deletions
4
ci.sh
4
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 <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.
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
d2454643e137bde519786ee9e650c455d7ad6f34
|
||||
e114d6228b948ce056de0bcdec2603c8e89d3727
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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<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:
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue