pub enum EvaluationResult {
    EvaluatedToOk,
    EvaluatedToOkModuloRegions,
    EvaluatedToOkModuloOpaqueTypes,
    EvaluatedToAmbig,
    EvaluatedToUnknown,
    EvaluatedToRecur,
    EvaluatedToErr,
}
Expand description

The result of trait evaluation. The order is important here as the evaluation of a list is the maximum of the evaluations.

The evaluation results are ordered: - EvaluatedToOk implies EvaluatedToOkModuloRegions implies EvaluatedToAmbig implies EvaluatedToUnknown - EvaluatedToErr implies EvaluatedToRecur - the “union” of evaluation results is equal to their maximum - all the “potential success” candidates can potentially succeed, so they are noops when unioned with a definite error, and within the categories it’s easy to see that the unions are correct.

Variants§

§

EvaluatedToOk

Evaluation successful.

§

EvaluatedToOkModuloRegions

Evaluation successful, but there were unevaluated region obligations.

§

EvaluatedToOkModuloOpaqueTypes

Evaluation successful, but need to rerun because opaque types got hidden types assigned without it being known whether the opaque types are within their defining scope

§

EvaluatedToAmbig

Evaluation is known to be ambiguous – it might hold for some assignment of inference variables, but it might not.

While this has the same meaning as EvaluatedToUnknown – we can’t know whether this obligation holds or not – it is the result we would get with an empty stack, and therefore is cacheable.

§

EvaluatedToUnknown

Evaluation failed because of recursion involving inference variables. We are somewhat imprecise there, so we don’t actually know the real result.

This can’t be trivially cached for the same reason as EvaluatedToRecur.

§

EvaluatedToRecur

Evaluation failed because we encountered an obligation we are already trying to prove on this branch.

We know this branch can’t be a part of a minimal proof-tree for the “root” of our cycle, because then we could cut out the recursion and maintain a valid proof tree. However, this does not mean that all the obligations on this branch do not hold – it’s possible that we entered this branch “speculatively”, and that there might be some other way to prove this obligation that does not go through this cycle – so we can’t cache this as a failure.

For example, suppose we have this:

pub trait Trait { fn xyz(); }
// This impl is "useless", but we can still have
// an `impl Trait for SomeUnsizedType` somewhere.
impl<T: Trait + Sized> Trait for T { fn xyz() {} }

pub fn foo<T: Trait + ?Sized>() {
    <T as Trait>::xyz();
}

When checking foo, we have to prove T: Trait. This basically translates into this:

(T: Trait + Sized →_\impl T: Trait), T: Trait ⊢ T: Trait

When we try to prove it, we first go the first option, which recurses. This shows us that the impl is “useless” – it won’t tell us that T: Trait unless it already implemented Trait by some other means. However, that does not prevent T: Trait does not hold, because of the bound (which can indeed be satisfied by SomeUnsizedType from another crate).

§

EvaluatedToErr

Evaluation failed.

Implementations§

source§

impl EvaluationResult

source

pub fn must_apply_considering_regions(self) -> bool

Returns true if this evaluation result is known to apply, even considering outlives constraints.

source

pub fn must_apply_modulo_regions(self) -> bool

Returns true if this evaluation result is known to apply, ignoring outlives constraints.

source

pub fn may_apply(self) -> bool

source

pub fn is_stack_dependent(self) -> bool

Trait Implementations§

source§

impl Clone for EvaluationResult

source§

fn clone(&self) -> EvaluationResult

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 Debug for EvaluationResult

source§

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

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

impl EraseType for EvaluationResult

§

type Result = [u8; 1]

source§

impl<'__ctx> HashStable<StableHashingContext<'__ctx>> for EvaluationResult

source§

fn hash_stable( &self, __hcx: &mut StableHashingContext<'__ctx>, __hasher: &mut StableHasher )

source§

impl Ord for EvaluationResult

source§

fn cmp(&self, other: &EvaluationResult) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd<Self>,

Restrict a value to a certain interval. Read more
source§

impl PartialEq<EvaluationResult> for EvaluationResult

source§

fn eq(&self, other: &EvaluationResult) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd<EvaluationResult> for EvaluationResult

source§

fn partial_cmp(&self, other: &EvaluationResult) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Copy for EvaluationResult

source§

impl Eq for EvaluationResult

source§

impl StructuralEq for EvaluationResult

source§

impl StructuralPartialEq for EvaluationResult

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Aligned for T

source§

const ALIGN: Alignment = _

Alignment of Self.
source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<'tcx, T> ArenaAllocatable<'tcx, IsCopy> for Twhere T: Copy,

source§

fn allocate_on<'a>(self, arena: &'a Arena<'tcx>) -> &'a mut T

source§

fn allocate_from_iter<'a>( arena: &'a Arena<'tcx>, iter: impl IntoIterator<Item = T> ) -> &'a mut [T]

source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T, R> CollectAndApply<T, R> for T

source§

fn collect_and_apply<I, F>(iter: I, f: F) -> Rwhere I: Iterator<Item = T>, F: FnOnce(&[T]) -> R,

Equivalent to f(&iter.collect::<Vec<_>>()).

§

type Output = R

source§

impl<Tcx, T> DepNodeParams<Tcx> for Twhere Tcx: DepContext, T: for<'a> HashStable<StableHashingContext<'a>> + Debug,

source§

default fn fingerprint_style() -> FingerprintStyle

source§

default fn to_fingerprint(&self, tcx: Tcx) -> Fingerprint

This method turns the parameters of a DepNodeConstructor into an opaque Fingerprint to be used in DepNode. Not all DepNodeParams support being turned into a Fingerprint (they don’t need to if the corresponding DepNode is anonymous).
source§

default fn to_debug_str(&self, _: Tcx) -> String

source§

default fn recover(_: Tcx, _: &DepNode) -> Option<T>

This method tries to recover the query key from the given DepNode, something which is needed when forcing DepNodes during red-green evaluation. The query system will only call this method if fingerprint_style() is not FingerprintStyle::Opaque. It is always valid to return None here, in which case incremental compilation will treat the query as having changed instead of forcing it.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<P> IntoQueryParam<P> for P

source§

impl<T> MaybeResult<T> for T

§

type Error = !

source§

fn from(_: Result<T, <T as MaybeResult<T>>::Error>) -> T

source§

fn to_result(self) -> Result<T, <T as MaybeResult<T>>::Error>

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<'tcx, T> ToPredicate<'tcx, T> for T

source§

fn to_predicate(self, _tcx: TyCtxt<'tcx>) -> T

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<Tcx, T> Value<Tcx> for Twhere Tcx: DepContext,

source§

default fn from_cycle_error( tcx: Tcx, cycle: &[QueryInfo], _guar: ErrorGuaranteed ) -> T

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: 1 byte

Size for each variant:

  • EvaluatedToOk: 0 bytes
  • EvaluatedToOkModuloRegions: 0 bytes
  • EvaluatedToOkModuloOpaqueTypes: 0 bytes
  • EvaluatedToAmbig: 0 bytes
  • EvaluatedToUnknown: 0 bytes
  • EvaluatedToRecur: 0 bytes
  • EvaluatedToErr: 0 bytes