pub enum InhabitedPredicate<'tcx> {
    True,
    False,
    ConstIsZero(Const<'tcx>),
    NotInModule(DefId),
    GenericType(Ty<'tcx>),
    And(&'tcx [InhabitedPredicate<'tcx>; 2]),
    Or(&'tcx [InhabitedPredicate<'tcx>; 2]),
}
Expand description

Represents whether some type is inhabited in a given context. Examples of uninhabited types are !, enum Void {}, or a struct containing either of those types. A type’s inhabitedness may depend on the ParamEnv as well as what types are visible in the current module.

Variants§

§

True

Inhabited

§

False

Uninhabited

§

ConstIsZero(Const<'tcx>)

Uninhabited when a const value is non-zero. This occurs when there is an array of uninhabited items, but the array is inhabited if it is empty.

§

NotInModule(DefId)

Uninhabited if within a certain module. This occurs when an uninhabited type has restricted visibility.

§

GenericType(Ty<'tcx>)

Inhabited if some generic type is inhabited. These are replaced by calling Self::subst.

§

And(&'tcx [InhabitedPredicate<'tcx>; 2])

A AND B

§

Or(&'tcx [InhabitedPredicate<'tcx>; 2])

A OR B

Implementations§

Returns true if the corresponding type is inhabited in the given ParamEnv and module

Same as apply, but returns None if self contains a module predicate

Same as apply, but NotInModule(_) predicates yield false. That is, privately uninhabited types are considered always uninhabited.

Replaces generic types with its corresponding predicate

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. 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
This method turns the parameters of a DepNodeConstructor into an opaque Fingerprint to be used in DepNode. Not all DepNodeParams support being turned into a Fingerprint (they don’t need to if the corresponding DepNode is anonymous). Read more
This method tries to recover the query key from the given DepNode, something which is needed when forcing DepNodes during red-green evaluation. The query system will only call this method if fingerprint_style() is not FingerprintStyle::Opaque. It is always valid to return None here, in which case incremental compilation will treat the query as having changed instead of forcing it. 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 resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
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: 16 bytes

Size for each variant:

  • True: 0 bytes
  • False: 0 bytes
  • ConstIsZero: 12 bytes
  • NotInModule: 8 bytes
  • GenericType: 12 bytes
  • And: 12 bytes
  • Or: 12 bytes