pub enum Outcome {
Changed,
Unchanged,
}Expand description
Whether a pass changed the unit on a given run.
A pass returns Outcome::Changed when it modified the unit and
Outcome::Unchanged when it left it untouched. The
PassManager uses this signal to decide whether a
fixpoint loop has settled (a full sweep with no Changed is a fixpoint) and
to build the Report. Reporting Unchanged after mutating
the unit breaks fixpoint termination, so the value is taken at its word — keep
it honest.
Variants§
Implementations§
Source§impl Outcome
impl Outcome
Sourcepub fn changed(self) -> bool
pub fn changed(self) -> bool
True if this is Outcome::Changed.
§Examples
use pass_lang::Outcome;
assert!(Outcome::Changed.changed());
assert!(!Outcome::Unchanged.changed());Sourcepub fn from_changed(changed: bool) -> Self
pub fn from_changed(changed: bool) -> Self
Build an outcome from a “did it change?” flag.
The common shape of a Pass::run body: compute the transform, then
report whether it actually altered the unit.
§Examples
use pass_lang::Outcome;
assert_eq!(Outcome::from_changed(true), Outcome::Changed);
assert_eq!(Outcome::from_changed(false), Outcome::Unchanged);Trait Implementations§
impl Copy for Outcome
impl Eq for Outcome
impl StructuralPartialEq for Outcome
Auto Trait Implementations§
impl Freeze for Outcome
impl RefUnwindSafe for Outcome
impl Send for Outcome
impl Sync for Outcome
impl Unpin for Outcome
impl UnsafeUnpin for Outcome
impl UnwindSafe for Outcome
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more