Skip to content

Commit 98a5162

Browse files
committed
rustc: parse -Z orbit=off.
1 parent b197a37 commit 98a5162

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

src/librustc/session/config.rs

+22-1
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,8 @@ macro_rules! options {
463463
pub const parse_bool: Option<&'static str> = None;
464464
pub const parse_opt_bool: Option<&'static str> =
465465
Some("one of: `y`, `yes`, `on`, `n`, `no`, or `off`");
466+
pub const parse_all_bool: Option<&'static str> =
467+
Some("one of: `y`, `yes`, `on`, `n`, `no`, or `off`");
466468
pub const parse_string: Option<&'static str> = Some("a string");
467469
pub const parse_opt_string: Option<&'static str> = Some("a string");
468470
pub const parse_list: Option<&'static str> = Some("a space-separated list of strings");
@@ -512,6 +514,25 @@ macro_rules! options {
512514
}
513515
}
514516

517+
fn parse_all_bool(slot: &mut bool, v: Option<&str>) -> bool {
518+
match v {
519+
Some(s) => {
520+
match s {
521+
"n" | "no" | "off" => {
522+
*slot = false;
523+
}
524+
"y" | "yes" | "on" => {
525+
*slot = true;
526+
}
527+
_ => { return false; }
528+
}
529+
530+
true
531+
},
532+
None => { *slot = true; true }
533+
}
534+
}
535+
515536
fn parse_opt_string(slot: &mut Option<String>, v: Option<&str>) -> bool {
516537
match v {
517538
Some(s) => { *slot = Some(s.to_string()); true },
@@ -756,7 +777,7 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
756777
"dump MIR state at various points in translation"),
757778
dump_mir_dir: Option<String> = (None, parse_opt_string,
758779
"the directory the MIR is dumped into"),
759-
orbit: bool = (true, parse_bool,
780+
orbit: bool = (true, parse_all_bool,
760781
"get MIR where it belongs - everywhere; most importantly, in orbit"),
761782
}
762783

0 commit comments

Comments
 (0)