Rollup merge of #126675 - oli-obk:diagnostics_opaque, r=jackh726

Change a `DefineOpaqueTypes::No` to `Yes` in diagnostics code

Explanation in comments of the function.

r? ```@compiler-errors```

cc https://github.com/rust-lang/rust/issues/116652
This commit is contained in:
fee1-dead 2024-06-19 22:51:05 +08:00 committed by GitHub
commit e649eca1d2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1357,6 +1357,8 @@ fn select_trait_candidate(
traits::SelectionContext::new(self).select(&obligation)
}
/// Used for ambiguous method call error reporting. Uses probing that throws away the result internally,
/// so do not use to make a decision that may lead to a successful compilation.
fn candidate_source(&self, candidate: &Candidate<'tcx>, self_ty: Ty<'tcx>) -> CandidateSource {
match candidate.kind {
InherentImplCandidate(_) => {
@ -1370,8 +1372,10 @@ fn candidate_source(&self, candidate: &Candidate<'tcx>, self_ty: Ty<'tcx>) -> Ca
self.instantiate_binder_with_fresh_vars(self.span, infer::FnCall, trait_ref);
let (xform_self_ty, _) =
self.xform_self_ty(candidate.item, trait_ref.self_ty(), trait_ref.args);
// Guide the trait selection to show impls that have methods whose type matches
// up with the `self` parameter of the method.
let _ = self.at(&ObligationCause::dummy(), self.param_env).sup(
DefineOpaqueTypes::No,
DefineOpaqueTypes::Yes,
xform_self_ty,
self_ty,
);