This commit is contained in:
Ralf Jung 2018-11-27 08:16:52 +01:00
parent 58982d655a
commit 07f78a37d4
2 changed files with 7 additions and 13 deletions

View File

@ -35,7 +35,7 @@ required-features = ["rustc_tests"]
[dependencies]
byteorder = { version = "1.1", features = ["i128"]}
cargo_metadata = { version = "0.6", optional = true }
dirs = { version = "1.0.4", optional = true }
directories = { version = "1.0", optional = true }
env_logger = "0.5"
log = "0.4"
@ -44,7 +44,7 @@ vergen = "3"
[features]
default = ["cargo_miri"]
cargo_miri = ["cargo_metadata", "dirs"]
cargo_miri = ["cargo_metadata", "directories"]
rustc_tests = []
[dev-dependencies]

View File

@ -65,10 +65,7 @@ fn list_targets(mut args: impl Iterator<Item=String>) -> impl Iterator<Item=carg
{
metadata
} else {
let _ = std::io::stderr().write_fmt(format_args!(
"error: Could not obtain cargo metadata."
));
std::process::exit(101);
show_error(format!("error: Could not obtain cargo metadata."));
};
let manifest_path = manifest_path_arg.map(|arg| {
@ -106,14 +103,11 @@ fn ask(question: &str) {
print!("{} [Y/n] ", question);
io::stdout().flush().unwrap();
io::stdin().read_line(&mut buf).unwrap();
let answer = match buf.trim().to_lowercase().as_ref() {
"" | "y" | "yes" => true,
"n" | "no" => false,
match buf.trim().to_lowercase().as_ref() {
"" | "y" | "yes" => {}, // proceed
"n" | "no" => show_error(format!("Aborting as per your request")),
a => show_error(format!("I do not understand `{}`", a))
};
if !answer {
show_error(format!("Aborting as per your request"))
}
}
/// Perform the setup requires to make `cargo miri` work: Getting a custom-built libstd. Then sets MIRI_SYSROOT.
@ -152,7 +146,7 @@ fn setup(ask_user: bool) {
}
// Next, we need our own libstd. We will do this work in ~/.miri.
let dir = dirs::home_dir().unwrap().join(".miri");
let dir = directories::UserDirs::new().unwrap().home_dir().join(".miri");
if !dir.exists() {
fs::create_dir(&dir).unwrap();
}