Enum rustc_typeck::check::diverges::Diverges [−][src]
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
Potentially unknown, some cases converge, others require a CFG to determine them.
Definitely known to diverge and therefore not reach the next sibling or its parent.
Fields of Always
span: Span
The Span
points to the expression
that caused us to diverge
(e.g. return
, break
, etc).
custom_note: Option<&'static str>
In some cases (e.g. a match
expression
where all arms diverge), we may be
able to provide a more informative
message to the user.
If this is None
, a default message
will be generated, which is suitable
for most cases.
Same as Always
but with a reachability
warning already emitted.
Implementations
Trait Implementations
Performs the &=
operation. Read more
Performs the |=
operation. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Auto Trait Implementations
impl RefUnwindSafe for Diverges
impl UnwindSafe for Diverges
Blanket Implementations
Mutably borrows from an owned value. Read more
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