Clear nested candidates in select if certainty is yes
This commit is contained in:
@@ -10,6 +10,7 @@ use rustc_infer::traits::{
|
|||||||
use rustc_macros::extension;
|
use rustc_macros::extension;
|
||||||
use rustc_middle::{bug, span_bug};
|
use rustc_middle::{bug, span_bug};
|
||||||
use rustc_span::Span;
|
use rustc_span::Span;
|
||||||
|
use thin_vec::ThinVec;
|
||||||
|
|
||||||
use crate::solve::inspect::{self, ProofTreeInferCtxtExt};
|
use crate::solve::inspect::{self, ProofTreeInferCtxtExt};
|
||||||
|
|
||||||
@@ -147,7 +148,7 @@ fn to_selection<'tcx>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
let (nested, impl_args) = cand.instantiate_nested_goals_and_opt_impl_args(span);
|
let (nested, impl_args) = cand.instantiate_nested_goals_and_opt_impl_args(span);
|
||||||
let nested = nested
|
let mut nested: ThinVec<_> = nested
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|nested| {
|
.map(|nested| {
|
||||||
Obligation::new(
|
Obligation::new(
|
||||||
@@ -159,6 +160,10 @@ fn to_selection<'tcx>(
|
|||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
|
if let Ok(Certainty::Yes) = cand.result() {
|
||||||
|
nested.clear();
|
||||||
|
}
|
||||||
|
|
||||||
Some(match cand.kind() {
|
Some(match cand.kind() {
|
||||||
ProbeKind::TraitCandidate { source, result: _ } => match source {
|
ProbeKind::TraitCandidate { source, result: _ } => match source {
|
||||||
CandidateSource::Impl(impl_def_id) => {
|
CandidateSource::Impl(impl_def_id) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user