about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSantiago Pastorino <spastorino@gmail.com>2022-01-21 15:26:05 -0300
committerSantiago Pastorino <spastorino@gmail.com>2022-01-21 18:23:22 -0300
commit19e3c860037a8bb01157aa9da291003c8b69e18c (patch)
tree41472f8e3ce1e37d2b3444ffccb2344a1196651c
parent1ec962fb349f0d4a010af81e7ae0d53fec4e2bb2 (diff)
downloadrust-19e3c860037a8bb01157aa9da291003c8b69e18c.tar.gz
rust-19e3c860037a8bb01157aa9da291003c8b69e18c.zip
Make strict_disjoint use explicit_disjoint
-rw-r--r--compiler/rustc_trait_selection/src/traits/coherence.rs21
1 files changed, 12 insertions, 9 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/coherence.rs b/compiler/rustc_trait_selection/src/traits/coherence.rs
index f6101d78f41..178cff9501d 100644
--- a/compiler/rustc_trait_selection/src/traits/coherence.rs
+++ b/compiler/rustc_trait_selection/src/traits/coherence.rs
@@ -206,14 +206,19 @@ fn overlap_within_probe<'cx, 'tcx>(
             }
         }
         OverlapMode::Strict => {
-            if strict_disjoint(selcx, param_env, &impl1_header, impl2_header) {
+            if strict_disjoint(selcx, impl1_def_id, impl2_def_id) {
                 return None;
             }
+
+            // Equate for error reporting
+            let _ = selcx
+                .infcx()
+                .at(&ObligationCause::dummy(), param_env)
+                .eq_impl_headers(&impl1_header, &impl2_header);
         }
         OverlapMode::WithNegative => {
             if stable_disjoint(selcx, param_env, &impl1_header, impl2_header)
-                || explicit_disjoint(selcx, impl1_def_id, impl2_def_id)
-                || explicit_disjoint(selcx, impl2_def_id, impl1_def_id)
+                || strict_disjoint(selcx, impl1_def_id, impl2_def_id)
             {
                 return None;
             }
@@ -255,13 +260,11 @@ fn stable_disjoint<'cx, 'tcx>(
 
 fn strict_disjoint<'cx, 'tcx>(
     selcx: &mut SelectionContext<'cx, 'tcx>,
-    param_env: ty::ParamEnv<'tcx>,
-    impl1_header: &ty::ImplHeader<'tcx>,
-    impl2_header: ty::ImplHeader<'tcx>,
+    impl1_def_id: DefId,
+    impl2_def_id: DefId,
 ) -> bool {
-    disjoint_with_filter(selcx, param_env, impl1_header, impl2_header, |selcx, o| {
-        strict_check(selcx, o)
-    })
+    explicit_disjoint(selcx, impl1_def_id, impl2_def_id)
+        || explicit_disjoint(selcx, impl2_def_id, impl1_def_id)
 }
 
 fn disjoint_with_filter<'cx, 'tcx>(