fix stupid bug

This commit is contained in:
Ariel Ben-Yehuda 2018-12-04 00:37:06 +02:00
parent 760639635f
commit 6e4b2b3ae7

View File

@ -94,12 +94,38 @@ impl<'a, 'tcx> InherentOverlapChecker<'a, 'tcx> {
for (i, &impl1_def_id) in impls.iter().enumerate() {
for &impl2_def_id in &impls[(i + 1)..] {
let mut used_to_be_allowed = traits::overlapping_impls(
// First, check if the impl was forbidden under the
// old rules. In that case, just have an error.
let used_to_be_allowed = traits::overlapping_impls(
self.tcx,
impl1_def_id,
impl2_def_id,
IntercrateMode::Issue43355,
TraitObjectMode::NoSquash,
|overlap| {
self.check_for_common_items_in_impls(
impl1_def_id,
impl2_def_id,
overlap,
None,
);
false
},
|| true,
);
if !used_to_be_allowed {
continue;
}
// Then, check if the impl was forbidden under only
// #43355. In that case, emit an #43355 error.
let used_to_be_allowed = traits::overlapping_impls(
self.tcx,
impl1_def_id,
impl2_def_id,
IntercrateMode::Fixed,
TraitObjectMode::NoSquash,
|overlap| {
self.check_for_common_items_in_impls(
impl1_def_id,
@ -112,45 +138,29 @@ impl<'a, 'tcx> InherentOverlapChecker<'a, 'tcx> {
|| true,
);
if used_to_be_allowed {
used_to_be_allowed = traits::overlapping_impls(
self.tcx,
impl1_def_id,
impl2_def_id,
IntercrateMode::Fixed,
TraitObjectMode::NoSquash,
|overlap| {
self.check_for_common_items_in_impls(
impl1_def_id,
impl2_def_id,
overlap,
None,
);
false
},
|| true,
);
if !used_to_be_allowed {
continue;
}
if used_to_be_allowed {
traits::overlapping_impls(
self.tcx,
impl1_def_id,
impl2_def_id,
IntercrateMode::Fixed,
TraitObjectMode::SquashAutoTraitsIssue33140,
|overlap| {
self.check_for_common_items_in_impls(
impl1_def_id,
impl2_def_id,
overlap,
Some(FutureCompatOverlapErrorKind::Issue33140),
);
false
},
|| true,
);
}
// Then, check if the impl was forbidden under
// #33140. In that case, emit a #33140 error.
traits::overlapping_impls(
self.tcx,
impl1_def_id,
impl2_def_id,
IntercrateMode::Fixed,
TraitObjectMode::SquashAutoTraitsIssue33140,
|overlap| {
self.check_for_common_items_in_impls(
impl1_def_id,
impl2_def_id,
overlap,
Some(FutureCompatOverlapErrorKind::Issue33140),
);
false
},
|| true,
);
}
}
}