Enum rustc_middle::traits::select::EvaluationResult
source · 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
sourceimpl EvaluationResult
impl EvaluationResult
sourcepub fn must_apply_considering_regions(self) -> bool
pub fn must_apply_considering_regions(self) -> bool
Returns true
if this evaluation result is known to apply, even
considering outlives constraints.
sourcepub fn must_apply_modulo_regions(self) -> bool
pub fn must_apply_modulo_regions(self) -> bool
Returns true
if this evaluation result is known to apply, ignoring
outlives constraints.
pub fn may_apply(self) -> bool
pub fn is_stack_dependent(self) -> bool
Trait Implementations
sourceimpl Clone for EvaluationResult
impl Clone for EvaluationResult
sourcefn clone(&self) -> EvaluationResult
fn clone(&self) -> EvaluationResult
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresourceimpl Debug for EvaluationResult
impl Debug for EvaluationResult
sourceimpl<'__ctx> HashStable<StableHashingContext<'__ctx>> for EvaluationResult
impl<'__ctx> HashStable<StableHashingContext<'__ctx>> for EvaluationResult
fn hash_stable(
&self,
__hcx: &mut StableHashingContext<'__ctx>,
__hasher: &mut StableHasher
)
sourceimpl Ord for EvaluationResult
impl Ord for EvaluationResult
sourcefn cmp(&self, other: &EvaluationResult) -> Ordering
fn cmp(&self, other: &EvaluationResult) -> Ordering
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
sourceimpl PartialEq<EvaluationResult> for EvaluationResult
impl PartialEq<EvaluationResult> for EvaluationResult
sourcefn eq(&self, other: &EvaluationResult) -> bool
fn eq(&self, other: &EvaluationResult) -> bool
sourceimpl PartialOrd<EvaluationResult> for EvaluationResult
impl PartialOrd<EvaluationResult> for EvaluationResult
sourcefn partial_cmp(&self, other: &EvaluationResult) -> Option<Ordering>
fn partial_cmp(&self, other: &EvaluationResult) -> Option<Ordering>
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moreimpl Copy for EvaluationResult
impl Eq for EvaluationResult
impl StructuralEq for EvaluationResult
impl StructuralPartialEq for EvaluationResult
Auto Trait Implementations
impl RefUnwindSafe for EvaluationResult
impl Send for EvaluationResult
impl Sync for EvaluationResult
impl Unpin for EvaluationResult
impl UnwindSafe for EvaluationResult
Blanket Implementations
sourceimpl<'tcx, T> ArenaAllocatable<'tcx, IsCopy> for Twhere
T: Copy,
impl<'tcx, T> ArenaAllocatable<'tcx, IsCopy> for Twhere
T: Copy,
fn allocate_on(self, arena: &'a Arena<'tcx>) -> &'a mut T
fn allocate_from_iter(
arena: &'a Arena<'tcx>,
iter: impl IntoIterator<Item = T>
) -> &'a mut [T]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
sourceimpl<Ctxt, T> DepNodeParams<Ctxt> for Twhere
Ctxt: DepContext,
T: for<'a> HashStable<StableHashingContext<'a>> + Debug,
impl<Ctxt, T> DepNodeParams<Ctxt> for Twhere
Ctxt: DepContext,
T: for<'a> HashStable<StableHashingContext<'a>> + Debug,
default fn fingerprint_style() -> FingerprintStyle
sourcedefault fn to_fingerprint(&self, tcx: Ctxt) -> Fingerprint
default fn to_fingerprint(&self, tcx: Ctxt) -> Fingerprint
default fn to_debug_str(&self, Ctxt) -> String
sourcedefault fn recover(Ctxt, &DepNode<<Ctxt as DepContext>::DepKind>) -> Option<T>
default fn recover(Ctxt, &DepNode<<Ctxt as DepContext>::DepKind>) -> Option<T>
DepNode
,
something which is needed when forcing DepNode
s 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. Read moresourceimpl<T, R> InternIteratorElement<T, R> for T
impl<T, R> InternIteratorElement<T, R> for T
type Output = R
fn intern_with<I, F>(iter: I, f: F) -> <T as InternIteratorElement<T, R>>::Outputwhere
I: Iterator<Item = T>,
F: FnOnce(&[T]) -> R,
sourceimpl<T> MaybeResult<T> for T
impl<T> MaybeResult<T> for T
sourceimpl<CTX, T> Value<CTX> for Twhere
CTX: DepContext,
impl<CTX, T> Value<CTX> for Twhere
CTX: DepContext,
default fn from_cycle_error(tcx: CTX) -> T
impl<'a, T> Captures<'a> for Twhere
T: ?Sized,
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 bytesEvaluatedToOkModuloRegions
: 0 bytesEvaluatedToOkModuloOpaqueTypes
: 0 bytesEvaluatedToAmbig
: 0 bytesEvaluatedToUnknown
: 0 bytesEvaluatedToRecur
: 0 bytesEvaluatedToErr
: 0 bytes