mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 00:03:43 +00:00
compiler: Add FramePointer::ratchet
This commit is contained in:
parent
acb62737ac
commit
7c0b5cf99f
@ -1413,6 +1413,20 @@ pub enum FramePointer {
|
||||
MayOmit,
|
||||
}
|
||||
|
||||
impl FramePointer {
|
||||
/// It is intended that the "force frame pointer" transition is "one way"
|
||||
/// so this convenience assures such if used
|
||||
#[inline]
|
||||
pub fn ratchet(&mut self, rhs: FramePointer) -> FramePointer {
|
||||
*self = match (*self, rhs) {
|
||||
(FramePointer::Always, _) | (_, FramePointer::Always) => FramePointer::Always,
|
||||
(FramePointer::NonLeaf, _) | (_, FramePointer::NonLeaf) => FramePointer::NonLeaf,
|
||||
_ => FramePointer::MayOmit,
|
||||
};
|
||||
*self
|
||||
}
|
||||
}
|
||||
|
||||
impl FromStr for FramePointer {
|
||||
type Err = ();
|
||||
fn from_str(s: &str) -> Result<Self, ()> {
|
||||
|
Loading…
Reference in New Issue
Block a user