./miri run: default to edition 2021
This commit is contained in:
parent
7d0994ca2d
commit
9164cd164c
2 changed files with 13 additions and 4 deletions
|
|
@ -478,7 +478,11 @@ impl Command {
|
|||
// Scan for "--target" to overwrite the "MIRI_TEST_TARGET" env var so
|
||||
// that we set the MIRI_SYSROOT up the right way.
|
||||
use itertools::Itertools;
|
||||
let target = flags.iter().tuple_windows().find(|(first, _)| first == &"--target");
|
||||
let target = flags
|
||||
.iter()
|
||||
.take_while(|arg| *arg != "--")
|
||||
.tuple_windows()
|
||||
.find(|(first, _)| *first == "--target");
|
||||
if let Some((_, target)) = target {
|
||||
// Found it!
|
||||
e.sh.set_var("MIRI_TEST_TARGET", target);
|
||||
|
|
@ -487,6 +491,10 @@ impl Command {
|
|||
let miriflags = e.sh.var("MIRIFLAGS").unwrap_or_default();
|
||||
e.sh.set_var("MIRIFLAGS", format!("{miriflags} --target {target}"));
|
||||
}
|
||||
// Scan for "--edition" (we'll set one ourselves if that flag is not present).
|
||||
let have_edition =
|
||||
flags.iter().take_while(|arg| *arg != "--").any(|arg| *arg == "--edition");
|
||||
|
||||
// Prepare a sysroot.
|
||||
e.build_miri_sysroot(/* quiet */ true)?;
|
||||
|
||||
|
|
@ -496,15 +504,16 @@ impl Command {
|
|||
let miri_flags = flagsplit(&miri_flags);
|
||||
let toolchain = &e.toolchain;
|
||||
let extra_flags = &e.cargo_extra_flags;
|
||||
let edition_flags = (!have_edition).then_some("--edition=2021"); // keep in sync with `compiletest.rs`.`
|
||||
if dep {
|
||||
cmd!(
|
||||
e.sh,
|
||||
"cargo +{toolchain} --quiet test --test compiletest {extra_flags...} --manifest-path {miri_manifest} -- --miri-run-dep-mode {miri_flags...} {flags...}"
|
||||
"cargo +{toolchain} --quiet test --test compiletest {extra_flags...} --manifest-path {miri_manifest} -- --miri-run-dep-mode {miri_flags...} {edition_flags...} {flags...}"
|
||||
).quiet().run()?;
|
||||
} else {
|
||||
cmd!(
|
||||
e.sh,
|
||||
"cargo +{toolchain} --quiet run {extra_flags...} --manifest-path {miri_manifest} -- {miri_flags...} {flags...}"
|
||||
"cargo +{toolchain} --quiet run {extra_flags...} --manifest-path {miri_manifest} -- {miri_flags...} {edition_flags...} {flags...}"
|
||||
).quiet().run()?;
|
||||
}
|
||||
Ok(())
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ fn test_config(target: &str, path: &str, mode: Mode, with_dependencies: bool) ->
|
|||
mode,
|
||||
program,
|
||||
out_dir: PathBuf::from(std::env::var_os("CARGO_TARGET_DIR").unwrap()).join("ui"),
|
||||
edition: Some("2021".into()),
|
||||
edition: Some("2021".into()), // keep in sync with `./miri run`
|
||||
threads: std::env::var("MIRI_TEST_THREADS")
|
||||
.ok()
|
||||
.map(|threads| NonZeroUsize::new(threads.parse().unwrap()).unwrap()),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue