about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEduard Burtescu <edy.burt@gmail.com>2016-08-02 05:18:23 +0300
committerEduard Burtescu <edy.burt@gmail.com>2016-08-02 09:01:48 +0300
commit98a516274a7f512b051c5725fdfee641281ebe0d (patch)
tree054cb2de8b59e689a874d262afc7b540adf67ce2
parentb197a375c000a8d66dbeb1b511bd39fe8186f50b (diff)
downloadrust-98a516274a7f512b051c5725fdfee641281ebe0d.tar.gz
rust-98a516274a7f512b051c5725fdfee641281ebe0d.zip
rustc: parse -Z orbit=off.
-rw-r--r--src/librustc/session/config.rs23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs
index b92fd440a22..1d839be9f53 100644
--- a/src/librustc/session/config.rs
+++ b/src/librustc/session/config.rs
@@ -463,6 +463,8 @@ macro_rules! options {
         pub const parse_bool: Option<&'static str> = None;
         pub const parse_opt_bool: Option<&'static str> =
             Some("one of: `y`, `yes`, `on`, `n`, `no`, or `off`");
+        pub const parse_all_bool: Option<&'static str> =
+            Some("one of: `y`, `yes`, `on`, `n`, `no`, or `off`");
         pub const parse_string: Option<&'static str> = Some("a string");
         pub const parse_opt_string: Option<&'static str> = Some("a string");
         pub const parse_list: Option<&'static str> = Some("a space-separated list of strings");
@@ -512,6 +514,25 @@ macro_rules! options {
             }
         }
 
+        fn parse_all_bool(slot: &mut bool, v: Option<&str>) -> bool {
+            match v {
+                Some(s) => {
+                    match s {
+                        "n" | "no" | "off" => {
+                            *slot = false;
+                        }
+                        "y" | "yes" | "on" => {
+                            *slot = true;
+                        }
+                        _ => { return false; }
+                    }
+
+                    true
+                },
+                None => { *slot = true; true }
+            }
+        }
+
         fn parse_opt_string(slot: &mut Option<String>, v: Option<&str>) -> bool {
             match v {
                 Some(s) => { *slot = Some(s.to_string()); true },
@@ -756,7 +777,7 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
           "dump MIR state at various points in translation"),
     dump_mir_dir: Option<String> = (None, parse_opt_string,
           "the directory the MIR is dumped into"),
-    orbit: bool = (true, parse_bool,
+    orbit: bool = (true, parse_all_bool,
           "get MIR where it belongs - everywhere; most importantly, in orbit"),
 }