diff options
| -rw-r--r-- | src/librustc/session/config.rs | 23 |
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"), } |
