Skip to content

Commit 05b7e61

Browse files
committed
remove outdated sysroot management
1 parent 09f30ca commit 05b7e61

File tree

1 file changed

+5
-30
lines changed

1 file changed

+5
-30
lines changed

src/bin/cargo-miri.rs

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -421,38 +421,13 @@ fn in_cargo_miri() {
421421
}
422422

423423
fn inside_cargo_rustc() {
424-
let home = option_env!("RUSTUP_HOME").or(option_env!("MULTIRUST_HOME"));
425-
let toolchain = option_env!("RUSTUP_TOOLCHAIN").or(option_env!("MULTIRUST_TOOLCHAIN"));
426-
let sys_root = if let Ok(sysroot) = ::std::env::var("MIRI_SYSROOT") {
427-
sysroot
428-
} else if let (Some(home), Some(toolchain)) = (home, toolchain) {
429-
format!("{}/toolchains/{}", home, toolchain)
430-
} else {
431-
option_env!("RUST_SYSROOT")
432-
.map(|s| s.to_owned())
433-
.or_else(|| {
434-
Command::new("rustc")
435-
.arg("--print")
436-
.arg("sysroot")
437-
.output()
438-
.ok()
439-
.and_then(|out| String::from_utf8(out.stdout).ok())
440-
.map(|s| s.trim().to_owned())
441-
})
442-
.expect("need to specify `RUST_SYSROOT` env var during miri compilation, or use rustup or multirust")
443-
};
424+
let sysroot = std::env::var("MIRI_SYSROOT").expect("The wrapper should have set MIRI_SYSROOT");
444425

445-
// This conditional check for the `--sysroot` flag is there so that users can call `cargo-miri`
446-
// directly without having to pass `--sysroot` or anything.
447-
let rustc_args = std::env::args().skip(2);
448-
let mut args: Vec<String> = if std::env::args().any(|s| s == "--sysroot") {
449-
rustc_args.collect()
450-
} else {
451-
rustc_args
426+
let rustc_args = std::env::args().skip(2); // skip `cargo rustc`
427+
let mut args: Vec<String> = rustc_args
452428
.chain(Some("--sysroot".to_owned()))
453-
.chain(Some(sys_root))
454-
.collect()
455-
};
429+
.chain(Some(sysroot))
430+
.collect();
456431
args.splice(0..0, miri::miri_default_args().iter().map(ToString::to_string));
457432

458433
// See if we can find the `cargo-miri` markers. Those only get added to the binary we want to

0 commit comments

Comments
 (0)