]> git.proxmox.com Git - rustc.git/blobdiff - compiler/rustc_infer/src/infer/lub.rs
New upstream version 1.68.2+dfsg1
[rustc.git] / compiler / rustc_infer / src / infer / lub.rs
index 97ed4729bd0d9e67af8250645909cc3ba567950a..c07ac1d3ace92a4375b03797534a725c7b26911e 100644 (file)
@@ -103,6 +103,11 @@ impl<'tcx> TypeRelation<'tcx> for Lub<'_, '_, 'tcx> {
     where
         T: Relate<'tcx>,
     {
+        // LUB of a binder and itself is just itself
+        if a == b {
+            return Ok(a);
+        }
+
         debug!("binders(a={:?}, b={:?})", a, b);
         if a.skip_binder().has_escaping_bound_vars() || b.skip_binder().has_escaping_bound_vars() {
             // When higher-ranked types are involved, computing the LUB is