about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src/solve/delegate.rs
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2025-06-13 18:05:11 +0000
committerMichael Goulet <michael@errs.io>2025-06-24 01:42:28 +0000
commitb8ef88517d84f25fbf5adec9e6573dbfd170b2e9 (patch)
treef698432b2ac20053ec540f124ae996277a4cd265 /compiler/rustc_trait_selection/src/solve/delegate.rs
parent706f244db581212cabf2e619e0113d70999b2bbe (diff)
downloadrust-b8ef88517d84f25fbf5adec9e6573dbfd170b2e9.tar.gz
rust-b8ef88517d84f25fbf5adec9e6573dbfd170b2e9.zip
Introduce trivial WF functions, use it in fast path
Diffstat (limited to 'compiler/rustc_trait_selection/src/solve/delegate.rs')
-rw-r--r--compiler/rustc_trait_selection/src/solve/delegate.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/compiler/rustc_trait_selection/src/solve/delegate.rs b/compiler/rustc_trait_selection/src/solve/delegate.rs
index b247c2c2968..f20e5d2aef6 100644
--- a/compiler/rustc_trait_selection/src/solve/delegate.rs
+++ b/compiler/rustc_trait_selection/src/solve/delegate.rs
@@ -143,6 +143,16 @@ impl<'tcx> rustc_next_trait_solver::delegate::SolverDelegate for SolverDelegate<
                     None
                 }
             }
+            ty::PredicateKind::Clause(ty::ClauseKind::WellFormed(arg)) => {
+                let arg = self.shallow_resolve_term(arg);
+                if arg.is_trivially_wf(self.tcx) {
+                    Some(Certainty::Yes)
+                } else if arg.is_infer() {
+                    Some(Certainty::AMBIGUOUS)
+                } else {
+                    None
+                }
+            }
             _ => None,
         }
     }