struct BestObligation<'db> {
obligation: Obligation<'db, Predicate<'db>>,
consider_ambiguities: bool,
parent_trait_obligations: Vec<Predicate<'db>>,
}Fields§
§obligation: Obligation<'db, Predicate<'db>>§consider_ambiguities: bool§parent_trait_obligations: Vec<Predicate<'db>>Implementations§
Source§impl<'db> BestObligation<'db>
impl<'db> BestObligation<'db>
fn with_derived_obligation( &mut self, derived_obligation: Obligation<'db, Predicate<'db>>, and_then: impl FnOnce(&mut Self) -> <Self as ProofTreeVisitor<'db>>::Result, ) -> <Self as ProofTreeVisitor<'db>>::Result
fn break_with_current_obligation( &mut self, ) -> <Self as ProofTreeVisitor<'db>>::Result
Sourcefn non_trivial_candidates<'a>(
&self,
goal: &'a InspectGoal<'a, 'db>,
) -> Vec<InspectCandidate<'a, 'db>>
fn non_trivial_candidates<'a>( &self, goal: &'a InspectGoal<'a, 'db>, ) -> Vec<InspectCandidate<'a, 'db>>
Filter out the candidates that aren’t interesting to visit for the purposes of reporting errors. For ambiguities, we only consider candidates that may hold. For errors, we only consider candidates that don’t hold and which have impl-where clauses that also don’t hold.
Sourcefn visit_well_formed_goal(
&mut self,
candidate: &InspectCandidate<'_, 'db>,
term: Term<'db>,
) -> <Self as ProofTreeVisitor<'db>>::Result
fn visit_well_formed_goal( &mut self, candidate: &InspectCandidate<'_, 'db>, term: Term<'db>, ) -> <Self as ProofTreeVisitor<'db>>::Result
HACK: We walk the nested obligations for a well-formed arg manually,
since there’s nontrivial logic in wf.rs to set up an obligation cause.
Ideally we’d be able to track this better.
Sourcefn detect_error_in_self_ty_normalization(
&mut self,
goal: &InspectGoal<'_, 'db>,
self_ty: Ty<'db>,
) -> <Self as ProofTreeVisitor<'db>>::Result
fn detect_error_in_self_ty_normalization( &mut self, goal: &InspectGoal<'_, 'db>, self_ty: Ty<'db>, ) -> <Self as ProofTreeVisitor<'db>>::Result
If a normalization of an associated item or a trait goal fails without trying any candidates it’s likely that normalizing its self type failed. We manually detect such cases here.
Sourcefn detect_trait_error_in_higher_ranked_projection(
&mut self,
goal: &InspectGoal<'_, 'db>,
) -> <Self as ProofTreeVisitor<'db>>::Result
fn detect_trait_error_in_higher_ranked_projection( &mut self, goal: &InspectGoal<'_, 'db>, ) -> <Self as ProofTreeVisitor<'db>>::Result
When a higher-ranked projection goal fails, check that the corresponding
higher-ranked trait goal holds or not. This is because the process of
instantiating and then re-canonicalizing the binder of the projection goal
forces us to be unable to see that the leak check failed in the nested
NormalizesTo goal, so we don’t fall back to the rigid projection check
that should catch when a projection goal fails due to an unsatisfied trait
goal.
Sourcefn detect_non_well_formed_assoc_item(
&mut self,
goal: &InspectGoal<'_, 'db>,
alias: AliasTerm<'db>,
) -> <Self as ProofTreeVisitor<'db>>::Result
fn detect_non_well_formed_assoc_item( &mut self, goal: &InspectGoal<'_, 'db>, alias: AliasTerm<'db>, ) -> <Self as ProofTreeVisitor<'db>>::Result
It is likely that NormalizesTo failed without any applicable candidates
because the alias is not well-formed.
As we only enter RigidAlias candidates if the trait bound of the associated type
holds, we discard these candidates in non_trivial_candidates and always manually
check this here.
Sourcefn detect_error_from_empty_candidates(
&mut self,
goal: &InspectGoal<'_, 'db>,
) -> <Self as ProofTreeVisitor<'db>>::Result
fn detect_error_from_empty_candidates( &mut self, goal: &InspectGoal<'_, 'db>, ) -> <Self as ProofTreeVisitor<'db>>::Result
If we have no candidates, then it’s likely that there is a non-well-formed alias in the goal.
Trait Implementations§
Source§impl<'db> ProofTreeVisitor<'db> for BestObligation<'db>
impl<'db> ProofTreeVisitor<'db> for BestObligation<'db>
type Result = ControlFlow<(Obligation<'db, Predicate<'db>>, Vec<Predicate<'db>>)>
fn span(&self) -> Span
fn visit_goal(&mut self, goal: &InspectGoal<'_, 'db>) -> Self::Result
fn config(&self) -> InspectConfig
fn on_recursion_limit(&mut self) -> Self::Result
Auto Trait Implementations§
impl<'db> Freeze for BestObligation<'db>
impl<'db> RefUnwindSafe for BestObligation<'db>
impl<'db> Send for BestObligation<'db>
impl<'db> Sync for BestObligation<'db>
impl<'db> Unpin for BestObligation<'db>
impl<'db> UnsafeUnpin for BestObligation<'db>
impl<'db> UnwindSafe for BestObligation<'db>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more