check for unstable options

This commit is contained in:
Jane Lusby 2020-03-27 12:47:57 -07:00
parent 7c479fd8a7
commit df2d3c82df

View File

@ -58,18 +58,36 @@ where
{
let mut args = vec!["check".to_owned()];
let mut fix = false;
let mut unstable_options = false;
for arg in old_args.by_ref() {
if arg == "--fix" {
args[0] = "fix".to_owned();
continue;
match arg {
"--fix" => {
fix = true;
continue;
},
"--" => break,
// Cover -Zunstable-options and -Z unstable-options
s if s.ends_with("unstable-options") => unstable_options = true,
_ => {},
}
if arg == "--" {
break;
}
args.push(arg);
}
if fix && !unstable_options {
panic!("Usage of `--fix` requires `-Z unstable-options`");
} else {
args[0] = "fix".to_owned();
}
let env_name = if unstable_options {
"RUSTC_WORKSPACE_WRAPPER"
} else {
"RUSTC_WRAPPER"
};
let clippy_args: String = old_args.map(|arg| format!("{}__CLIPPY_HACKERY__", arg)).collect();
let mut path = std::env::current_exe()