about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJane Lusby <jlusby@yaah.dev>2020-03-27 12:47:57 -0700
committerJane Lusby <jlusby@yaah.dev>2020-03-27 12:48:08 -0700
commitdf2d3c82df7ed70de7aa0d8db642b4f454228c4d (patch)
treec84ab62dbc08613f9493e2161bf8872250152fa4
parent7c479fd8a7af670b8ff55f6d1d5c0d5178e6c196 (diff)
downloadrust-df2d3c82df7ed70de7aa0d8db642b4f454228c4d.tar.gz
rust-df2d3c82df7ed70de7aa0d8db642b4f454228c4d.zip
check for unstable options
-rw-r--r--src/main.rs30
1 files changed, 24 insertions, 6 deletions
diff --git a/src/main.rs b/src/main.rs
index 66c1aa4d97c..4749300c3e8 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -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()