Enum rustc::traits::select::EvaluationResult [−][src]
pub enum EvaluationResult { EvaluatedToOk, EvaluatedToAmbig, EvaluatedToUnknown, EvaluatedToRecur, EvaluatedToErr, }
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
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 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 no-ops when unioned with a definite error, and within
the categories it's easy to see that the unions are correct.
Variants
EvaluatedToOk
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Evaluation successful
EvaluatedToAmbig
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
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
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
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
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
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).
FIXME: when an EvaluatedToRecur
goes past its parent root, we
ought to convert it to an EvaluatedToErr
, because we know
there definitely isn't a proof tree for that obligation. Not
doing so is still sound - there isn't any proof tree, so the
branch still can't be a part of a minimal one - but does not
re-enable caching.
EvaluatedToErr
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Evaluation failed
Methods
impl EvaluationResult
[src]
impl EvaluationResult
pub fn may_apply(self) -> bool
[src]
pub fn may_apply(self) -> bool
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
fn is_stack_dependent(self) -> bool
[src]
fn is_stack_dependent(self) -> bool
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Trait Implementations
impl Copy for EvaluationResult
[src]
impl Copy for EvaluationResult
impl Clone for EvaluationResult
[src]
impl Clone for EvaluationResult
fn clone(&self) -> EvaluationResult
[src]
fn clone(&self) -> EvaluationResult
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for EvaluationResult
[src]
impl Debug for EvaluationResult
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl PartialOrd for EvaluationResult
[src]
impl PartialOrd for EvaluationResult
fn partial_cmp(&self, other: &EvaluationResult) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &EvaluationResult) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
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
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
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
impl Ord for EvaluationResult
[src]
impl Ord for EvaluationResult
fn cmp(&self, other: &EvaluationResult) -> Ordering
[src]
fn cmp(&self, other: &EvaluationResult) -> Ordering
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
impl PartialEq for EvaluationResult
[src]
impl PartialEq for EvaluationResult
fn eq(&self, other: &EvaluationResult) -> bool
[src]
fn eq(&self, other: &EvaluationResult) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl Eq for EvaluationResult
[src]
impl Eq for EvaluationResult
fn assert_receiver_is_total_eq(&self)
[src]
fn assert_receiver_is_total_eq(&self)
impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for EvaluationResult
[src]
impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for EvaluationResult
fn hash_stable<W: StableHasherResult>(
&self,
__ctx: &mut StableHashingContext<'a>,
__hasher: &mut StableHasher<W>
)
[src]
fn hash_stable<W: StableHasherResult>(
&self,
__ctx: &mut StableHashingContext<'a>,
__hasher: &mut StableHasher<W>
)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Auto Trait Implementations
impl Send for EvaluationResult
impl Send for EvaluationResult
impl Sync for EvaluationResult
impl Sync for EvaluationResult