Enum rustc_mir_build::thir::pattern::usefulness::Usefulness[][src]

enum Usefulness<'p, 'tcx> {
    NoWitnesses {
        useful: bool,
    WithWitnesses(Vec<Witness<'p, 'tcx>>),
Expand description

This carries the results of computing usefulness, as described at the top of the file. When checking usefulness of a match branch, we use the NoWitnesses variant, which also keeps track of potential unreachable sub-patterns (in the presence of or-patterns). When checking exhaustiveness of a whole match, we use the WithWitnesses variant, which carries a list of witnesses of non-exhaustiveness when there are any. Which variant to use is dictated by ArmType.



If we don’t care about witnesses, simply remember if the pattern was useful.

Fields of NoWitnesses

useful: bool
WithWitnesses(Vec<Witness<'p, 'tcx>>)

Carries a list of witnesses of non-exhaustiveness. If empty, indicates that the whole pattern is unreachable.

Tuple Fields of WithWitnesses

0: Vec<Witness<'p, 'tcx>>


Combine usefulnesses from two branches. This is an associative operation.

After calculating usefulness after a specialization, call this to reconstruct a usefulness that makes sense for the matrix pre-specialization. This new usefulness can then be merged with the results of specializing with the other constructors.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.


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: