Skip to content

Commit 7d59fa3

Browse files
committed
Auto merge of rust-lang#111506 - RalfJung:miri, r=oli-obk
update Miri and run mir-opt-level=4 tests in rustc CI so issues like rust-lang#111422 are caught before they land. r? `@oli-obk` due to the bootstrap changes
2 parents 4a59ba4 + 18fd17d commit 7d59fa3

File tree

6 files changed

+26
-6
lines changed

6 files changed

+26
-6
lines changed

src/bootstrap/test.rs

+19-2
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,21 @@ impl Step for Miri {
613613
builder.run(&mut cargo);
614614
}
615615

616+
// Run it again for mir-opt-level 4 to catch some miscompilations.
617+
if builder.config.test_args().is_empty() {
618+
cargo.env("MIRIFLAGS", "-O -Zmir-opt-level=4 -Cdebug-assertions=yes");
619+
// Optimizations can change backtraces
620+
cargo.env("MIRI_SKIP_UI_CHECKS", "1");
621+
// Optimizations can change error locations and remove UB so don't run `fail` tests.
622+
cargo.args(&["tests/pass", "tests/panic"]);
623+
624+
let mut cargo = prepare_cargo_test(cargo, &[], &[], "miri", compiler, target, builder);
625+
{
626+
let _time = util::timeit(&builder);
627+
builder.run(&mut cargo);
628+
}
629+
}
630+
616631
// # Run `cargo miri test`.
617632
// This is just a smoke test (Miri's own CI invokes this in a bunch of different ways and ensures
618633
// that we get the desired output), but that is sufficient to make sure that the libtest harness
@@ -644,8 +659,10 @@ impl Step for Miri {
644659
cargo.env("RUST_BACKTRACE", "1");
645660

646661
let mut cargo = Command::from(cargo);
647-
let _time = util::timeit(&builder);
648-
builder.run(&mut cargo);
662+
{
663+
let _time = util::timeit(&builder);
664+
builder.run(&mut cargo);
665+
}
649666
}
650667
}
651668

src/tools/miri/ci.sh

+1-2
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ function run_tests {
4545
# them. Also error locations change so we don't run the failing tests.
4646
# We explicitly enable debug-assertions here, they are disabled by -O but we have tests
4747
# which exist to check that we panic on debug assertion failures.
48-
#FIXME: Disabled due to <https://github.com/rust-lang/rust/issues/111422>.
49-
#MIRIFLAGS="${MIRIFLAGS:-} -O -Zmir-opt-level=4 -Cdebug-assertions=yes" MIRI_SKIP_UI_CHECKS=1 ./miri test -- tests/{pass,panic}
48+
MIRIFLAGS="${MIRIFLAGS:-} -O -Zmir-opt-level=4 -Cdebug-assertions=yes" MIRI_SKIP_UI_CHECKS=1 ./miri test -- tests/{pass,panic}
5049

5150
# Also run some many-seeds tests. 64 seeds means this takes around a minute per test.
5251
for FILE in tests/many-seeds/*.rs; do

src/tools/miri/rust-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
65dfca8488d635552eb246eb8e15df646e987cff
1+
0b795044c6f0854445f1f2bb6443e87848e150d1

src/tools/miri/tests/compiletest.rs

+2
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ fn run_tests(mode: Mode, path: &str, target: &str, with_dependencies: bool) -> R
140140
"run".into(), // There is no `cargo miri build` so we just use `cargo miri run`.
141141
];
142142
}
143+
144+
eprintln!(" Compiler: {}", config.program.display());
143145
ui_test::run_tests_generic(
144146
config,
145147
// The files we're actually interested in (all `.rs` files).

src/tools/miri/tests/fail/intrinsics/simd-scatter.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ fn main() {
55
unsafe {
66
let mut vec: Vec<i8> = vec![10, 11, 12, 13, 14, 15, 16, 17, 18];
77
let idxs = Simd::from_array([9, 3, 0, 17]);
8-
Simd::from_array([-27, 82, -41, 124]).scatter_select_unchecked( //~ERROR: pointer to 1 byte starting at offset 9 is out-of-bounds
8+
Simd::from_array([-27, 82, -41, 124]).scatter_select_unchecked(
9+
//~^ERROR: pointer to 1 byte starting at offset 9 is out-of-bounds
910
&mut vec,
1011
Mask::splat(true),
1112
idxs,

src/tools/miri/tests/fail/intrinsics/simd-scatter.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ error: Undefined Behavior: dereferencing pointer failed: ALLOC has size 9, so po
22
--> $DIR/simd-scatter.rs:LL:CC
33
|
44
LL | / Simd::from_array([-27, 82, -41, 124]).scatter_select_unchecked(
5+
LL | |
56
LL | | &mut vec,
67
LL | | Mask::splat(true),
78
LL | | idxs,

0 commit comments

Comments
 (0)