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<'tcx>),
Coerce(CoercePredicate<'tcx>),
ConstEquate(Const<'tcx>, Const<'tcx>),
Ambiguous,
NormalizesTo(NormalizesTo<'tcx>),
AliasRelate(Term<'tcx>, Term<'tcx>, AliasRelationDirection),
}
Variants§
Clause(ClauseKind<TyCtxt<'tcx>>)
Prove a clause
ObjectSafe(DefId)
Trait must be object-safe.
Subtype(SubtypePredicate<'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<'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<'tcx>)
The alias normalizes to term
. Unlike Projection
, this always fails if the alias
cannot be normalized in the current context.
Projection(<T as Trait>::Assoc, ?x)
results in ?x == <T as Trait>::Assoc
while
NormalizesTo(<T as Trait>::Assoc, ?x)
results in NoSolution
.
Only used in the new solver.
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>
impl<'tcx, E: TyEncoder<I = TyCtxt<'tcx>>> EncodableWithShorthand<E> for PredicateKind<'tcx>
source§impl<'tcx, P: PrettyPrinter<'tcx>> Print<'tcx, P> for PredicateKind<'tcx>
impl<'tcx, P: PrettyPrinter<'tcx>> Print<'tcx, P> for PredicateKind<'tcx>
source§impl<'tcx> ToPredicate<'tcx> for PredicateKind<'tcx>
impl<'tcx> ToPredicate<'tcx> for PredicateKind<'tcx>
fn to_predicate(self, tcx: TyCtxt<'tcx>) -> Predicate<'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 bytesObjectSafe
: 16 bytesSubtype
: 32 bytesCoerce
: 24 bytesConstEquate
: 24 bytesAmbiguous
: 0 bytesNormalizesTo
: 32 bytesAliasRelate
: 32 bytes