Skip to content

Commit f705368

Browse files
compiler: Accept -Cforce-frame-pointers=always
Also lands behind -Zunstable-options, for now. Take the opportunity to do some mild cleanup.
1 parent cb63601 commit f705368

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

compiler/rustc_session/src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2472,7 +2472,7 @@ pub fn build_session_options(early_dcx: &mut EarlyDiagCtxt, matches: &getopts::M
24722472
&& cg.force_frame_pointers == FramePointer::NonLeaf
24732473
{
24742474
early_dcx.early_fatal(
2475-
"`-Cforce-frame-pointers=non-leaf` also requires `-Zunstable-options` \
2475+
"`-Cforce-frame-pointers=non-leaf` or `always` also requires `-Zunstable-options` \
24762476
and a nightly compiler",
24772477
)
24782478
}

compiler/rustc_session/src/options.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -373,8 +373,7 @@ mod desc {
373373
pub const parse_opt_comma_list: &str = parse_comma_list;
374374
pub const parse_number: &str = "a number";
375375
pub const parse_opt_number: &str = parse_number;
376-
pub const parse_frame_pointer: &str =
377-
"one of `true`/`yes`/`on`, `false`/`no`/`off`, or (with -Zunstable-options) `non-leaf`";
376+
pub const parse_frame_pointer: &str = "one of `true`/`yes`/`on`, `false`/`no`/`off`, or (with -Zunstable-options) `non-leaf` or `always`";
378377
pub const parse_threads: &str = parse_number;
379378
pub const parse_time_passes_format: &str = "`text` (default) or `json`";
380379
pub const parse_passes: &str = "a space-separated list of passes, or `all`";
@@ -672,15 +671,15 @@ mod parse {
672671
}
673672

674673
pub(crate) fn parse_frame_pointer(slot: &mut FramePointer, v: Option<&str>) -> bool {
675-
let mut boolish = false;
676-
let mut is_parsed = parse_bool(&mut boolish, v);
677-
if boolish & is_parsed {
678-
*slot = FramePointer::Always;
679-
} else if v == Some("non-leaf") {
680-
is_parsed = true;
681-
*slot = FramePointer::NonLeaf;
674+
let mut yes = false;
675+
match v {
676+
Some(_) if parse_bool(&mut yes, v) && yes => slot.ratchet(FramePointer::Always),
677+
Some(_) if parse_bool(&mut yes, v) => slot.ratchet(FramePointer::MayOmit),
678+
Some("always") => slot.ratchet(FramePointer::Always),
679+
Some("non-leaf") => slot.ratchet(FramePointer::NonLeaf),
680+
_ => return false,
682681
};
683-
is_parsed
682+
true
684683
}
685684

686685
pub(crate) fn parse_passes(slot: &mut Passes, v: Option<&str>) -> bool {

0 commit comments

Comments
 (0)