diff options
| author | Michael Goulet <michael@errs.io> | 2024-06-30 11:30:55 -0400 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2024-07-05 11:59:52 -0400 |
| commit | fdde66acee3ba4c85798ea5120fa76f86bf697fe (patch) | |
| tree | 241e261cb51f44d1799577a0032511651a659512 /compiler/rustc_hir_analysis/src/check | |
| parent | 11dd90f7613a4b160ed8398a3f1c7c129ad1a372 (diff) | |
| download | rust-fdde66acee3ba4c85798ea5120fa76f86bf697fe.tar.gz rust-fdde66acee3ba4c85798ea5120fa76f86bf697fe.zip | |
Process alias-relate obligations when proving receiver_is_valid
Diffstat (limited to 'compiler/rustc_hir_analysis/src/check')
| -rw-r--r-- | compiler/rustc_hir_analysis/src/check/wfcheck.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/compiler/rustc_hir_analysis/src/check/wfcheck.rs b/compiler/rustc_hir_analysis/src/check/wfcheck.rs index 2230528a5ae..279e9fc5df3 100644 --- a/compiler/rustc_hir_analysis/src/check/wfcheck.rs +++ b/compiler/rustc_hir_analysis/src/check/wfcheck.rs @@ -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) { |
