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: Span
The 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)
&=
operation. Read moresourceimpl BitOrAssign<Diverges> for Diverges
impl BitOrAssign<Diverges> for Diverges
sourcefn bitor_assign(&mut self, other: Self)
fn bitor_assign(&mut self, other: Self)
|=
operation. Read moresourceimpl Ord for Diverges
impl Ord for Diverges
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
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>
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moreimpl 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 Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<'a, T> Captures<'a> for Twhere
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