|
1 | 1 | #![feature(inner_deref)]
|
2 | 2 |
|
3 | 3 | use std::env;
|
| 4 | +use std::ffi::OsString; |
4 | 5 | use std::fs::{self, File};
|
5 | 6 | use std::io::{self, BufRead, Write};
|
6 | 7 | use std::ops::Not;
|
7 | 8 | use std::path::{Path, PathBuf};
|
8 | 9 | use std::process::Command;
|
9 |
| -use std::ffi::OsString; |
10 | 10 |
|
11 | 11 | use rustc_version::VersionMeta;
|
12 | 12 |
|
@@ -265,7 +265,8 @@ fn setup(subcommand: MiriCommand) {
|
265 | 265 | let sysroot = std::str::from_utf8(&sysroot).unwrap();
|
266 | 266 | let sysroot = Path::new(sysroot.trim_end_matches('\n'));
|
267 | 267 | // Check for `$SYSROOT/lib/rustlib/src/rust/src`; test if that contains `libstd/lib.rs`.
|
268 |
| - let rustup_src = sysroot.join("lib").join("rustlib").join("src").join("rust").join("src"); |
| 268 | + let rustup_src = |
| 269 | + sysroot.join("lib").join("rustlib").join("src").join("rust").join("src"); |
269 | 270 | if !rustup_src.join("libstd").join("lib.rs").exists() {
|
270 | 271 | // Ask the user to install the `rust-src` component, and use that.
|
271 | 272 | let mut cmd = Command::new("rustup");
|
@@ -363,8 +364,7 @@ path = "lib.rs"
|
363 | 364 | let sysroot = if target == &host { dir.join("HOST") } else { PathBuf::from(dir) };
|
364 | 365 | std::env::set_var("MIRI_SYSROOT", &sysroot); // pass the env var to the processes we spawn, which will turn it into "--sysroot" flags
|
365 | 366 | // Figure out what to print.
|
366 |
| - let print_sysroot = subcommand == MiriCommand::Setup |
367 |
| - && has_arg_flag("--print-sysroot"); // whether we just print the sysroot path |
| 367 | + let print_sysroot = subcommand == MiriCommand::Setup && has_arg_flag("--print-sysroot"); // whether we just print the sysroot path |
368 | 368 | if print_sysroot {
|
369 | 369 | // Print just the sysroot and nothing else; this way we do not need any escaping.
|
370 | 370 | println!("{}", sysroot.display());
|
@@ -564,6 +564,8 @@ fn main() {
|
564 | 564 | // dependencies get dispatched to `rustc`, the final test/binary to `miri`.
|
565 | 565 | inside_cargo_rustc();
|
566 | 566 | } else {
|
567 |
| - show_error(format!("`cargo-miri` must be called with either `miri` or `rustc` as first argument.")) |
| 567 | + show_error(format!( |
| 568 | + "`cargo-miri` must be called with either `miri` or `rustc` as first argument." |
| 569 | + )) |
568 | 570 | }
|
569 | 571 | }
|
0 commit comments