rustc_middle::ty

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>

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