PredicateKind in rustc_middle::ty::predicate - Rust
Description: API documentation for the Rust `PredicateKind` type in crate `rustc_middle`.

Skip to main content

## PredicateKind

# Type Alias PredicateKind

Source

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

## Aliased Type§

    pub 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<'tcx>> EncodableWithShorthand<'tcx, E> for PredicateKind<'tcx>

Source§

#### type Variant = PredicateKind<TyCtxt<'tcx>>

Source§

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

Source§

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

Source§

#### fn print(&self, p: &mut P) -> Result<(), PrintError>

## Layout§

Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.