about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection
diff options
context:
space:
mode:
authorlcnr <rust@lcnr.de>2025-09-23 17:33:24 +0200
committerlcnr <rust@lcnr.de>2025-09-26 16:33:15 +0200
commit148fd9ad3c434c26a952e01e37c35aa26cb8315c (patch)
treece2212f59abdb0e93ca76092ab1aaabd29d4cf8d /compiler/rustc_trait_selection
parent6b379b560df483307958f2a606a1dd514fff36ca (diff)
downloadrust-148fd9ad3c434c26a952e01e37c35aa26cb8315c.tar.gz
rust-148fd9ad3c434c26a952e01e37c35aa26cb8315c.zip
allow method calls on opaques
Diffstat (limited to 'compiler/rustc_trait_selection')
-rw-r--r--compiler/rustc_trait_selection/src/traits/query/evaluate_obligation.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/query/evaluate_obligation.rs b/compiler/rustc_trait_selection/src/traits/query/evaluate_obligation.rs
index ae731505abf..34e0176d213 100644
--- a/compiler/rustc_trait_selection/src/traits/query/evaluate_obligation.rs
+++ b/compiler/rustc_trait_selection/src/traits/query/evaluate_obligation.rs
@@ -1,6 +1,6 @@
 use rustc_infer::traits::solve::Goal;
 use rustc_macros::extension;
-use rustc_middle::span_bug;
+use rustc_middle::{span_bug, ty};
 use rustc_next_trait_solver::solve::SolverDelegateEvalExt;
 
 use crate::infer::InferCtxt;
@@ -22,7 +22,7 @@ impl<'tcx> InferCtxt<'tcx> {
     /// for more details.
     fn predicate_may_hold_opaque_types_jank(&self, obligation: &PredicateObligation<'tcx>) -> bool {
         if self.next_trait_solver() {
-            <&SolverDelegate<'tcx>>::from(self).root_goal_may_hold_opaque_types_jank(Goal::new(
+            self.goal_may_hold_opaque_types_jank(Goal::new(
                 self.tcx,
                 obligation.param_env,
                 obligation.predicate,
@@ -32,6 +32,13 @@ impl<'tcx> InferCtxt<'tcx> {
         }
     }
 
+    /// See the comment on [OpaqueTypesJank](crate::solve::OpaqueTypesJank)
+    /// for more details.
+    fn goal_may_hold_opaque_types_jank(&self, goal: Goal<'tcx, ty::Predicate<'tcx>>) -> bool {
+        assert!(self.next_trait_solver());
+        <&SolverDelegate<'tcx>>::from(self).root_goal_may_hold_opaque_types_jank(goal)
+    }
+
     /// Evaluates whether the predicate can be satisfied in the given
     /// `ParamEnv`, and returns `false` if not certain. However, this is
     /// not entirely accurate if inference variables are involved.