Skip to content

Commit d3204f4

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

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

compiler/rustc_session/src/config.rs

+1-1
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

+10-10
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ mod desc {
374374
pub const parse_number: &str = "a number";
375375
pub const parse_opt_number: &str = parse_number;
376376
pub const parse_frame_pointer: &str =
377-
"one of `true`/`yes`/`on`, `false`/`no`/`off`, or (with -Zunstable-options) `non-leaf`";
377+
"one of `true`/`yes`/`on`, `false`/`no`/`off`, or (with -Zunstable-options) `non-leaf` or `always`";
378378
pub const parse_threads: &str = parse_number;
379379
pub const parse_time_passes_format: &str = "`text` (default) or `json`";
380380
pub const parse_passes: &str = "a space-separated list of passes, or `all`";
@@ -672,15 +672,15 @@ mod parse {
672672
}
673673

674674
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;
682-
};
683-
is_parsed
675+
let mut yes = false;
676+
match (v, was_bool) {
677+
Some(_) if parse_bool(&mut yes, v) && yes => slot.ratchet(FramePointer::Always),
678+
Some(_) if parse_bool(&mut yes, v) => slot.ratchet(FramePointer::MayOmit),
679+
Some("always") => slot.ratchet(FramePointer::Always),
680+
Some("non-leaf") => slot.ratchet(FramePointer::NonLeaf),
681+
_ => return false,
682+
}
683+
true
684684
}
685685

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

0 commit comments

Comments
 (0)