From fdde66acee3ba4c85798ea5120fa76f86bf697fe Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Sun, 30 Jun 2024 11:30:55 -0400 Subject: Process alias-relate obligations when proving receiver_is_valid --- compiler/rustc_hir_analysis/src/check/wfcheck.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'compiler/rustc_hir_analysis/src/check') 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) { -- cgit 1.4.1-3-g733a5