mirror of https://github.com/rust-lang/rust.git
compiler: Add FramePointer::ratchet
This commit is contained in:
parent
acb62737ac
commit
7c0b5cf99f
|
@ -1413,6 +1413,20 @@ pub enum FramePointer {
|
||||||
MayOmit,
|
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 {
|
impl FromStr for FramePointer {
|
||||||
type Err = ();
|
type Err = ();
|
||||||
fn from_str(s: &str) -> Result<Self, ()> {
|
fn from_str(s: &str) -> Result<Self, ()> {
|
||||||
|
|
Loading…
Reference in New Issue