self ty infer ambiguity: add proof tree cand
This commit is contained in:
parent
46ecc10c69
commit
97043c2381
3 changed files with 16 additions and 16 deletions
|
@ -263,7 +263,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
|
|||
) -> Vec<Candidate<'tcx>> {
|
||||
debug_assert_eq!(goal, self.resolve_vars_if_possible(goal));
|
||||
if let Some(ambig) = self.assemble_self_ty_infer_ambiguity_response(goal) {
|
||||
return ambig;
|
||||
return vec![ambig];
|
||||
}
|
||||
|
||||
let mut candidates = self.assemble_candidates_via_self_ty(goal, 0);
|
||||
|
@ -288,15 +288,20 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
|
|||
fn assemble_self_ty_infer_ambiguity_response<G: GoalKind<'tcx>>(
|
||||
&mut self,
|
||||
goal: Goal<'tcx, G>,
|
||||
) -> Option<Vec<Candidate<'tcx>>> {
|
||||
goal.predicate.self_ty().is_ty_var().then(|| {
|
||||
vec![Candidate {
|
||||
source: CandidateSource::BuiltinImpl(BuiltinImplSource::Misc),
|
||||
result: self
|
||||
.evaluate_added_goals_and_make_canonical_response(Certainty::AMBIGUOUS)
|
||||
.unwrap(),
|
||||
}]
|
||||
})
|
||||
) -> Option<Candidate<'tcx>> {
|
||||
if goal.predicate.self_ty().is_ty_var() {
|
||||
debug!("adding self_ty_infer_ambiguity_response");
|
||||
let source = CandidateSource::BuiltinImpl(BuiltinImplSource::Misc);
|
||||
let result = self
|
||||
.evaluate_added_goals_and_make_canonical_response(Certainty::AMBIGUOUS)
|
||||
.unwrap();
|
||||
let mut dummy_probe = self.inspect.new_probe();
|
||||
dummy_probe.probe_kind(ProbeKind::TraitCandidate { source, result: Ok(result) });
|
||||
self.inspect.finish_probe(dummy_probe);
|
||||
Some(Candidate { source, result })
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
/// Assemble candidates which apply to the self type. This only looks at candidate which
|
||||
|
@ -310,7 +315,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
|
|||
) -> Vec<Candidate<'tcx>> {
|
||||
debug_assert_eq!(goal, self.resolve_vars_if_possible(goal));
|
||||
if let Some(ambig) = self.assemble_self_ty_infer_ambiguity_response(goal) {
|
||||
return ambig;
|
||||
return vec![ambig];
|
||||
}
|
||||
|
||||
let mut candidates = Vec::new();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue