diff options
| author | Nilstrieb <48135649+Nilstrieb@users.noreply.github.com> | 2023-01-18 20:04:26 +0100 |
|---|---|---|
| committer | Nilstrieb <48135649+Nilstrieb@users.noreply.github.com> | 2023-01-18 20:46:36 +0100 |
| commit | a6fda3ee7fb24c9ccf1544ec719e8db01f77f36b (patch) | |
| tree | 391aea22097d1ff89310f487f3e8000b054b67a4 /compiler/rustc_session/src | |
| parent | 1f72129ffe5e8c495113f9a2d4e1730f7fad3209 (diff) | |
| download | rust-a6fda3ee7fb24c9ccf1544ec719e8db01f77f36b.tar.gz rust-a6fda3ee7fb24c9ccf1544ec719e8db01f77f36b.zip | |
Support `true` and `false` as boolean flag params
Implements MCP 577.
Diffstat (limited to 'compiler/rustc_session/src')
| -rw-r--r-- | compiler/rustc_session/src/options.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index 7b5fd6cc2a8..b102dea570f 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -349,7 +349,7 @@ fn build_options<O: Default>( #[allow(non_upper_case_globals)] mod desc { pub const parse_no_flag: &str = "no value"; - pub const parse_bool: &str = "one of: `y`, `yes`, `on`, `n`, `no`, or `off`"; + pub const parse_bool: &str = "one of: `y`, `yes`, `on`, `true`, `n`, `no`, `off` or `false`"; pub const parse_opt_bool: &str = parse_bool; pub const parse_string: &str = "a string"; pub const parse_opt_string: &str = parse_string; @@ -432,11 +432,11 @@ mod parse { /// Use this for any boolean option that has a static default. pub(crate) fn parse_bool(slot: &mut bool, v: Option<&str>) -> bool { match v { - Some("y") | Some("yes") | Some("on") | None => { + Some("y") | Some("yes") | Some("on") | Some("true") | None => { *slot = true; true } - Some("n") | Some("no") | Some("off") => { + Some("n") | Some("no") | Some("off") | Some("false") => { *slot = false; true } @@ -449,11 +449,11 @@ mod parse { /// other factors, such as other options, or target options.) pub(crate) fn parse_opt_bool(slot: &mut Option<bool>, v: Option<&str>) -> bool { match v { - Some("y") | Some("yes") | Some("on") | None => { + Some("y") | Some("yes") | Some("on") | Some("true") | None => { *slot = Some(true); true } - Some("n") | Some("no") | Some("off") => { + Some("n") | Some("no") | Some("off") | Some("false") => { *slot = Some(false); true } |
