pub(super) struct SplitWildcard<'tcx> {
    matrix_ctors: Vec<Constructor<'tcx>>,
    all_ctors: SmallVec<[Constructor<'tcx>; 1]>,
}
Expand description

A wildcard constructor that we split relative to the constructors in the matrix, as explained at the top of the file.

A constructor that is not present in the matrix rows will only be covered by the rows that have wildcards. Thus we can group all of those constructors together; we call them “missing constructors”. Splitting a wildcard would therefore list all present constructors individually (or grouped if they are integers or slices), and then all missing constructors together as a group.

However we can go further: since any constructor will match the wildcard rows, and having more rows can only reduce the amount of usefulness witnesses, we can skip the present constructors and only try the missing ones. This will not preserve the whole list of witnesses, but will preserve whether the list is empty or not. In fact this is quite natural from the point of view of diagnostics too. This is done in to_ctors: in some cases we only return Missing.

Fields§

§matrix_ctors: Vec<Constructor<'tcx>>

Constructors seen in the matrix.

§all_ctors: SmallVec<[Constructor<'tcx>; 1]>

All the constructors for this type

Implementations§

Pass a set of constructors relative to which to split this one. Don’t call twice, it won’t do what you want.

Whether there are any value constructors for this type that are not present in the matrix.

Iterate over the constructors for this type that are not present in the matrix.

Return the set of constructors resulting from splitting the wildcard. As explained at the top of the file, if any constructors are missing we can ignore the present ones.

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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.

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: 136 bytes