Type Alias rustc_middle::ty::PredicateKind

source ·
pub type PredicateKind<'tcx> = PredicateKind<TyCtxt<'tcx>>;

Aliased Type§

enum PredicateKind<'tcx> {
    Clause(ClauseKind<TyCtxt<'tcx>>),
    ObjectSafe(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

§

ObjectSafe(DefId)

Trait must be object-safe.

§

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 an unconstrained inference variable.

The alias normalizes to term. Unlike Projection, this always fails if the alias cannot be normalized in the current context. For the rigid alias T as Trait>::Assoc, Projection(<T as Trait>::Assoc, ?x) constrains ?x to <T as Trait>::Assoc while NormalizesTo(<T as Trait>::Assoc, ?x) results in NoSolution.

§

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>

§

type Variant = PredicateKind<TyCtxt<'tcx>>

source§

fn variant(&self) -> &Self::Variant

source§

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

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
  • ObjectSafe: 16 bytes
  • Subtype: 32 bytes
  • Coerce: 24 bytes
  • ConstEquate: 24 bytes
  • Ambiguous: 0 bytes
  • NormalizesTo: 32 bytes
  • AliasRelate: 32 bytes