pub enum Diverges {
Maybe,
Always {
span: Span,
custom_note: Option<&'static str>,
},
WarnedAlways,
}Expand description
Tracks whether executing a node may exit normally (versus return/break/panic, which “diverge”, leaving dead code in their wake). Tracked semi-automatically (through type variables marked as diverging), with some manual adjustments for control-flow primitives (approximating a CFG).
Variants
Maybe
Potentially unknown, some cases converge, others require a CFG to determine them.
Always
Fields
span: SpanThe Span points to the expression
that caused us to diverge
(e.g. return, break, etc).
Definitely known to diverge and therefore not reach the next sibling or its parent.
WarnedAlways
Same as Always but with a reachability
warning already emitted.
Implementations
Trait Implementations
sourceimpl BitAndAssign<Diverges> for Diverges
impl BitAndAssign<Diverges> for Diverges
sourcefn bitand_assign(&mut self, other: Self)
fn bitand_assign(&mut self, other: Self)
Performs the &= operation. Read more
sourceimpl BitOrAssign<Diverges> for Diverges
impl BitOrAssign<Diverges> for Diverges
sourcefn bitor_assign(&mut self, other: Self)
fn bitor_assign(&mut self, other: Self)
Performs the |= operation. Read more
sourceimpl Ord for Diverges
impl Ord for Diverges
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Self where
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Self where
Self: PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl PartialOrd<Diverges> for Diverges
impl PartialOrd<Diverges> for Diverges
sourcefn partial_cmp(&self, other: &Diverges) -> Option<Ordering>
fn partial_cmp(&self, other: &Diverges) -> Option<Ordering>
This method returns an ordering between self and other values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
impl Copy for Diverges
impl Eq for Diverges
impl StructuralEq for Diverges
impl StructuralPartialEq for Diverges
Auto Trait Implementations
impl RefUnwindSafe for Diverges
impl !Send for Diverges
impl !Sync for Diverges
impl Unpin for Diverges
impl UnwindSafe for Diverges
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<'a, T> Captures<'a> for T where
T: ?Sized,
Layout
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.
Size: 32 bytes
Size for each variant:
Maybe: 0 bytesAlways: 28 bytesWarnedAlways: 0 bytes