Process alias-relate obligations when proving receiver_is_valid
This commit is contained in:
parent
11dd90f761
commit
fdde66acee
8 changed files with 38 additions and 50 deletions
|
@ -1712,7 +1712,15 @@ fn receiver_is_valid<'tcx>(
|
|||
let cause =
|
||||
ObligationCause::new(span, wfcx.body_def_id, traits::ObligationCauseCode::MethodReceiver);
|
||||
|
||||
let can_eq_self = |ty| infcx.can_eq(wfcx.param_env, self_ty, ty);
|
||||
let can_eq_self = |ty| {
|
||||
wfcx.infcx.probe(|_| {
|
||||
let ocx = ObligationCtxt::new(wfcx.infcx);
|
||||
let Ok(()) = ocx.eq(&ObligationCause::dummy(), wfcx.param_env, self_ty, ty) else {
|
||||
return false;
|
||||
};
|
||||
ocx.select_where_possible().is_empty()
|
||||
})
|
||||
};
|
||||
|
||||
// `self: Self` is always valid.
|
||||
if can_eq_self(receiver_ty) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue