Skip to content

Commit 38ed191

Browse files
authored
Merge pull request #484 from RalfJung/mir-opt
Test with opt levels 0 and 1
2 parents 3247c66 + f5e3cdb commit 38ed191

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

README.md

+8
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,14 @@ miri` to run your project, if it is a bin project, or run
5555
`MIRI_SYSROOT=~/.xargo/HOST cargo +nightly miri test` to run all tests in your
5656
project through Miri.
5757

58+
## Miri `-Z` flags
59+
60+
Miri adds some extra `-Z` flags to control its behavior:
61+
62+
* `-Zmiri-start-fn`: This makes interpretation start with `lang_start` (defined
63+
in libstd) instead of starting with `main`. Requires full MIR!
64+
* `-Zmiri-disable-validation` disables enforcing the validity invariant.
65+
5866
## Development and Debugging
5967

6068
Since the heart of Miri (the main interpreter engine) lives in rustc, working on

tests/compiletest.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,11 @@ fn miri_pass(sysroot: &Path, path: &str, target: &str, host: &str, need_fullmir:
104104
flags.push("-Zmiri-start-fn".to_owned());
105105
}
106106
if opt {
107-
flags.push("-Zmir-opt-level=3".to_owned());
107+
// FIXME: Using level 1 (instead of 3) for now, as the optimizer is pretty broken
108+
// and crashes...
109+
// Level 0 and 1 are not the same, so this still gives us *some* coverage.
110+
// See https://github.com/rust-lang/rust/issues/50411
111+
flags.push("-Zmir-opt-level=1".to_owned());
108112
} else {
109113
flags.push("-Zmir-opt-level=0".to_owned());
110114
// For now, only validate without optimizations. Inlining breaks validation.
@@ -187,9 +191,7 @@ fn test() {
187191
// uses `libtest` which runs jobs in parallel.
188192

189193
run_pass_miri(false);
190-
// FIXME: Disabled for now, as the optimizer is pretty broken and crashes...
191-
// See https://github.com/rust-lang/rust/issues/50411
192-
//run_pass_miri(true);
194+
run_pass_miri(true);
193195

194196
compile_fail_miri();
195197
}

0 commit comments

Comments
 (0)