Skip to content

Commit a6fda3e

Browse files
committed
Support true and false as boolean flag params
Implements MCP 577.
1 parent 1f72129 commit a6fda3e

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

compiler/rustc_session/src/options.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ fn build_options<O: Default>(
349349
#[allow(non_upper_case_globals)]
350350
mod desc {
351351
pub const parse_no_flag: &str = "no value";
352-
pub const parse_bool: &str = "one of: `y`, `yes`, `on`, `n`, `no`, or `off`";
352+
pub const parse_bool: &str = "one of: `y`, `yes`, `on`, `true`, `n`, `no`, `off` or `false`";
353353
pub const parse_opt_bool: &str = parse_bool;
354354
pub const parse_string: &str = "a string";
355355
pub const parse_opt_string: &str = parse_string;
@@ -432,11 +432,11 @@ mod parse {
432432
/// Use this for any boolean option that has a static default.
433433
pub(crate) fn parse_bool(slot: &mut bool, v: Option<&str>) -> bool {
434434
match v {
435-
Some("y") | Some("yes") | Some("on") | None => {
435+
Some("y") | Some("yes") | Some("on") | Some("true") | None => {
436436
*slot = true;
437437
true
438438
}
439-
Some("n") | Some("no") | Some("off") => {
439+
Some("n") | Some("no") | Some("off") | Some("false") => {
440440
*slot = false;
441441
true
442442
}
@@ -449,11 +449,11 @@ mod parse {
449449
/// other factors, such as other options, or target options.)
450450
pub(crate) fn parse_opt_bool(slot: &mut Option<bool>, v: Option<&str>) -> bool {
451451
match v {
452-
Some("y") | Some("yes") | Some("on") | None => {
452+
Some("y") | Some("yes") | Some("on") | Some("true") | None => {
453453
*slot = Some(true);
454454
true
455455
}
456-
Some("n") | Some("no") | Some("off") => {
456+
Some("n") | Some("no") | Some("off") | Some("false") => {
457457
*slot = Some(false);
458458
true
459459
}

tests/codegen/issue-75659.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// This test checks that the call to memchr/slice_contains is optimized away
22
// when searching in small slices.
33

4-
// compile-flags: -O -Zinline-mir=no
4+
// compile-flags: -O -Zinline-mir=false
55
// only-x86_64
66

77
#![crate_type = "lib"]

tests/ui/lint/reasons-forbidden.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
//
99
// The test is much cleaner if we deduplicate, though.
1010

11-
// compile-flags: -Z deduplicate-diagnostics=yes
11+
// compile-flags: -Z deduplicate-diagnostics=true
1212

1313
#![forbid(
1414
unsafe_code,

tests/ui/numbers-arithmetic/next-power-of-two-overflow-debug.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// run-pass
2-
// compile-flags: -C debug_assertions=yes
2+
// compile-flags: -C debug_assertions=true
33
// needs-unwind
44
// ignore-emscripten dies with an LLVM error
55

tests/ui/rfc-2091-track-caller/call-chain.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// run-pass
22
// revisions: default mir-opt
3-
//[default] compile-flags: -Zinline-mir=no
3+
//[default] compile-flags: -Zinline-mir=false
44
//[mir-opt] compile-flags: -Zmir-opt-level=4
55

66
use std::panic::Location;

0 commit comments

Comments
 (0)