about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection
diff options
context:
space:
mode:
authorlcnr <rust@lcnr.de>2025-05-21 10:02:30 +0000
committerlcnr <rust@lcnr.de>2025-05-21 11:09:48 +0000
commit196c3b3ef40a84a05d265f4ec599cbe157cc5cb6 (patch)
treefca815f558b9c48b3d638a699ac6ce2d21ac5e76 /compiler/rustc_trait_selection
parentbbd3a5ada41e0d4678de15d10404a4733dba4087 (diff)
downloadrust-196c3b3ef40a84a05d265f4ec599cbe157cc5cb6.tar.gz
rust-196c3b3ef40a84a05d265f4ec599cbe157cc5cb6.zip
eagerly check nested obligations when coercing fndefs
Diffstat (limited to 'compiler/rustc_trait_selection')
-rw-r--r--compiler/rustc_trait_selection/src/traits/engine.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/engine.rs b/compiler/rustc_trait_selection/src/traits/engine.rs
index 8d6e6b4a651..18f28d72f6f 100644
--- a/compiler/rustc_trait_selection/src/traits/engine.rs
+++ b/compiler/rustc_trait_selection/src/traits/engine.rs
@@ -188,6 +188,20 @@ where
             .map(|infer_ok| self.register_infer_ok_obligations(infer_ok))
     }
 
+    /// Computes the least-upper-bound, or mutual supertype, of two values.
+    pub fn lub<T: ToTrace<'tcx>>(
+        &self,
+        cause: &ObligationCause<'tcx>,
+        param_env: ty::ParamEnv<'tcx>,
+        expected: T,
+        actual: T,
+    ) -> Result<T, TypeError<'tcx>> {
+        self.infcx
+            .at(cause, param_env)
+            .lub(expected, actual)
+            .map(|infer_ok| self.register_infer_ok_obligations(infer_ok))
+    }
+
     #[must_use]
     pub fn select_where_possible(&self) -> Vec<E> {
         self.engine.borrow_mut().select_where_possible(self.infcx)