Type Alias PredicateKind

Source
pub type PredicateKind<'tcx> = PredicateKind<TyCtxt<'tcx>>;

Aliased Type§

enum PredicateKind<'tcx> {
    Clause(ClauseKind<TyCtxt<'tcx>>),
    DynCompatible(DefId),
    Subtype(SubtypePredicate<TyCtxt<'tcx>>),
    Coerce(CoercePredicate<TyCtxt<'tcx>>),
    ConstEquate(Const<'tcx>, Const<'tcx>),
    Ambiguous,
    NormalizesTo(NormalizesTo<TyCtxt<'tcx>>),
    AliasRelate(Term<'tcx>, Term<'tcx>, AliasRelationDirection),
}

Variants§

§

Clause(ClauseKind<TyCtxt<'tcx>>)

Prove a clause

§

DynCompatible(DefId)

Trait must be dyn-compatible.

§

Subtype(SubtypePredicate<TyCtxt<'tcx>>)

T1 <: T2

This obligation is created most often when we have two unresolved type variables and hence don’t have enough information to process the subtyping obligation yet.

§

Coerce(CoercePredicate<TyCtxt<'tcx>>)

T1 coerced to T2

Like a subtyping obligation, this is created most often when we have two unresolved type variables and hence don’t have enough information to process the coercion obligation yet. At the moment, we actually process coercions very much like subtyping and don’t handle the full coercion logic.

§

ConstEquate(Const<'tcx>, Const<'tcx>)

Constants must be equal. The first component is the const that is expected.

§

Ambiguous

A marker predicate that is always ambiguous. Used for coherence to mark opaque types as possibly equal to each other but ambiguous.

§

NormalizesTo(NormalizesTo<TyCtxt<'tcx>>)

This should only be used inside of the new solver for AliasRelate and expects the term to be always be an unconstrained inference variable. It is used to normalize alias as much as possible. In case the alias is rigid - i.e. it cannot be normalized in the current environment - this constrains term to be equal to the alias itself.

It is likely more useful to think of this as a function normalizes_to(alias), whose return value is written into term.

§

AliasRelate(Term<'tcx>, Term<'tcx>, AliasRelationDirection)

Separate from ClauseKind::Projection which is used for normalization in new solver. This predicate requires two terms to be equal to eachother.

Only used for new solver.

Trait Implementations§

Source§

impl<'tcx, E: TyEncoder<I = TyCtxt<'tcx>>> EncodableWithShorthand<E> for PredicateKind<'tcx>

Source§

impl<'tcx, P: PrettyPrinter<'tcx>> Print<'tcx, P> for PredicateKind<'tcx>

Source§

impl<I> Clone for PredicateKind<I>
where I: Interner,

Source§

fn clone(&self) -> PredicateKind<I>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<I> Debug for PredicateKind<I>
where I: Interner,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<I, __D> Decodable<__D> for PredicateKind<I>
where I: Interner, __D: TyDecoder<I = I>, ClauseKind<I>: Decodable<__D>, <I as Interner>::DefId: Decodable<__D>, SubtypePredicate<I>: Decodable<__D>, CoercePredicate<I>: Decodable<__D>, <I as Interner>::Const: Decodable<__D>, NormalizesTo<I>: Decodable<__D>, <I as Interner>::Term: Decodable<__D>,

Source§

impl<I, __E> Encodable<__E> for PredicateKind<I>
where I: Interner, __E: TyEncoder<I = I>, ClauseKind<I>: Encodable<__E>, <I as Interner>::DefId: Encodable<__E>, SubtypePredicate<I>: Encodable<__E>, CoercePredicate<I>: Encodable<__E>, <I as Interner>::Const: Encodable<__E>, NormalizesTo<I>: Encodable<__E>, <I as Interner>::Term: Encodable<__E>,

Source§

fn encode(&self, __encoder: &mut __E)

Source§

impl<I> Hash for PredicateKind<I>
where I: Interner,

Source§

fn hash<__H>(&self, __state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<I, __CTX> HashStable<__CTX> for PredicateKind<I>
where I: Interner, ClauseKind<I>: HashStable<__CTX>, <I as Interner>::DefId: HashStable<__CTX>, SubtypePredicate<I>: HashStable<__CTX>, CoercePredicate<I>: HashStable<__CTX>, <I as Interner>::Const: HashStable<__CTX>, NormalizesTo<I>: HashStable<__CTX>, <I as Interner>::Term: HashStable<__CTX>,

Source§

fn hash_stable( &self, __hcx: &mut __CTX, __hasher: &mut StableHasher<SipHasher128>, )

Source§

impl<I> PartialEq for PredicateKind<I>
where I: Interner,

Source§

fn eq(&self, __other: &PredicateKind<I>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<I> TypeFoldable<I> for PredicateKind<I>

Source§

fn try_fold_with<__F>( self, __folder: &mut __F, ) -> Result<PredicateKind<I>, <__F as FallibleTypeFolder<I>>::Error>
where __F: FallibleTypeFolder<I>,

The entry point for folding. To fold a value t with a folder f call: t.try_fold_with(f). Read more
Source§

fn fold_with<F>(self, folder: &mut F) -> Self
where F: TypeFolder<I>,

A convenient alternative to try_fold_with for use with infallible folders. Do not override this method, to ensure coherence with try_fold_with.
Source§

impl<I> TypeVisitable<I> for PredicateKind<I>

Source§

fn visit_with<__V>( &self, __visitor: &mut __V, ) -> <__V as TypeVisitor<I>>::Result
where __V: TypeVisitor<I>,

The entry point for visiting. To visit a value t with a visitor v call: t.visit_with(v). Read more
Source§

impl<I> Copy for PredicateKind<I>
where I: Interner,

Source§

impl<I> Eq for PredicateKind<I>
where I: Interner,

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:

  • Clause: 32 bytes
  • DynCompatible: 16 bytes
  • Subtype: 32 bytes
  • Coerce: 24 bytes
  • ConstEquate: 24 bytes
  • Ambiguous: 0 bytes
  • NormalizesTo: 32 bytes
  • AliasRelate: 32 bytes