Make strict_disjoint use explicit_disjoint

This commit is contained in:
Santiago Pastorino 2022-01-21 15:26:05 -03:00
parent 1ec962fb34
commit 19e3c86003
No known key found for this signature in database
GPG Key ID: 8131A24E0C79EFAF

View File

@ -206,14 +206,19 @@ fn overlap_within_probe<'cx, 'tcx>(
} }
} }
OverlapMode::Strict => { OverlapMode::Strict => {
if strict_disjoint(selcx, param_env, &impl1_header, impl2_header) { if strict_disjoint(selcx, impl1_def_id, impl2_def_id) {
return None; return None;
} }
// Equate for error reporting
let _ = selcx
.infcx()
.at(&ObligationCause::dummy(), param_env)
.eq_impl_headers(&impl1_header, &impl2_header);
} }
OverlapMode::WithNegative => { OverlapMode::WithNegative => {
if stable_disjoint(selcx, param_env, &impl1_header, impl2_header) if stable_disjoint(selcx, param_env, &impl1_header, impl2_header)
|| explicit_disjoint(selcx, impl1_def_id, impl2_def_id) || strict_disjoint(selcx, impl1_def_id, impl2_def_id)
|| explicit_disjoint(selcx, impl2_def_id, impl1_def_id)
{ {
return None; return None;
} }
@ -255,13 +260,11 @@ fn stable_disjoint<'cx, 'tcx>(
fn strict_disjoint<'cx, 'tcx>( fn strict_disjoint<'cx, 'tcx>(
selcx: &mut SelectionContext<'cx, 'tcx>, selcx: &mut SelectionContext<'cx, 'tcx>,
param_env: ty::ParamEnv<'tcx>, impl1_def_id: DefId,
impl1_header: &ty::ImplHeader<'tcx>, impl2_def_id: DefId,
impl2_header: ty::ImplHeader<'tcx>,
) -> bool { ) -> bool {
disjoint_with_filter(selcx, param_env, impl1_header, impl2_header, |selcx, o| { explicit_disjoint(selcx, impl1_def_id, impl2_def_id)
strict_check(selcx, o) || explicit_disjoint(selcx, impl2_def_id, impl1_def_id)
})
} }
fn disjoint_with_filter<'cx, 'tcx>( fn disjoint_with_filter<'cx, 'tcx>(