Skip to content

Commit 19e3c86

Browse files
committed
Make strict_disjoint use explicit_disjoint
1 parent 1ec962f commit 19e3c86

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

compiler/rustc_trait_selection/src/traits/coherence.rs

+12-9
Original file line numberDiff line numberDiff line change
@@ -206,14 +206,19 @@ fn overlap_within_probe<'cx, 'tcx>(
206206
}
207207
}
208208
OverlapMode::Strict => {
209-
if strict_disjoint(selcx, param_env, &impl1_header, impl2_header) {
209+
if strict_disjoint(selcx, impl1_def_id, impl2_def_id) {
210210
return None;
211211
}
212+
213+
// Equate for error reporting
214+
let _ = selcx
215+
.infcx()
216+
.at(&ObligationCause::dummy(), param_env)
217+
.eq_impl_headers(&impl1_header, &impl2_header);
212218
}
213219
OverlapMode::WithNegative => {
214220
if stable_disjoint(selcx, param_env, &impl1_header, impl2_header)
215-
|| explicit_disjoint(selcx, impl1_def_id, impl2_def_id)
216-
|| explicit_disjoint(selcx, impl2_def_id, impl1_def_id)
221+
|| strict_disjoint(selcx, impl1_def_id, impl2_def_id)
217222
{
218223
return None;
219224
}
@@ -255,13 +260,11 @@ fn stable_disjoint<'cx, 'tcx>(
255260

256261
fn strict_disjoint<'cx, 'tcx>(
257262
selcx: &mut SelectionContext<'cx, 'tcx>,
258-
param_env: ty::ParamEnv<'tcx>,
259-
impl1_header: &ty::ImplHeader<'tcx>,
260-
impl2_header: ty::ImplHeader<'tcx>,
263+
impl1_def_id: DefId,
264+
impl2_def_id: DefId,
261265
) -> bool {
262-
disjoint_with_filter(selcx, param_env, impl1_header, impl2_header, |selcx, o| {
263-
strict_check(selcx, o)
264-
})
266+
explicit_disjoint(selcx, impl1_def_id, impl2_def_id)
267+
|| explicit_disjoint(selcx, impl2_def_id, impl1_def_id)
265268
}
266269

267270
fn disjoint_with_filter<'cx, 'tcx>(

0 commit comments

Comments
 (0)