Skip to content

Commit e030aa8

Browse files
committed
Revert "fix stupid bug"
This reverts commit 6e4b2b3.
1 parent 391a7eb commit e030aa8

File tree

1 file changed

+38
-48
lines changed

1 file changed

+38
-48
lines changed

src/librustc_typeck/coherence/inherent_impls_overlap.rs

Lines changed: 38 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -88,38 +88,12 @@ impl<'a, 'tcx> InherentOverlapChecker<'a, 'tcx> {
8888

8989
for (i, &impl1_def_id) in impls.iter().enumerate() {
9090
for &impl2_def_id in &impls[(i + 1)..] {
91-
// First, check if the impl was forbidden under the
92-
// old rules. In that case, just have an error.
93-
let used_to_be_allowed = traits::overlapping_impls(
91+
let mut used_to_be_allowed = traits::overlapping_impls(
9492
self.tcx,
9593
impl1_def_id,
9694
impl2_def_id,
9795
IntercrateMode::Issue43355,
9896
TraitObjectMode::NoSquash,
99-
|overlap| {
100-
self.check_for_common_items_in_impls(
101-
impl1_def_id,
102-
impl2_def_id,
103-
overlap,
104-
None,
105-
);
106-
false
107-
},
108-
|| true,
109-
);
110-
111-
if !used_to_be_allowed {
112-
continue;
113-
}
114-
115-
// Then, check if the impl was forbidden under only
116-
// #43355. In that case, emit an #43355 error.
117-
let used_to_be_allowed = traits::overlapping_impls(
118-
self.tcx,
119-
impl1_def_id,
120-
impl2_def_id,
121-
IntercrateMode::Fixed,
122-
TraitObjectMode::NoSquash,
12397
|overlap| {
12498
self.check_for_common_items_in_impls(
12599
impl1_def_id,
@@ -132,29 +106,45 @@ impl<'a, 'tcx> InherentOverlapChecker<'a, 'tcx> {
132106
|| true,
133107
);
134108

135-
if !used_to_be_allowed {
136-
continue;
109+
if used_to_be_allowed {
110+
used_to_be_allowed = traits::overlapping_impls(
111+
self.tcx,
112+
impl1_def_id,
113+
impl2_def_id,
114+
IntercrateMode::Fixed,
115+
TraitObjectMode::NoSquash,
116+
|overlap| {
117+
self.check_for_common_items_in_impls(
118+
impl1_def_id,
119+
impl2_def_id,
120+
overlap,
121+
None,
122+
);
123+
false
124+
},
125+
|| true,
126+
);
137127
}
138128

139-
// Then, check if the impl was forbidden under
140-
// #33140. In that case, emit a #33140 error.
141-
traits::overlapping_impls(
142-
self.tcx,
143-
impl1_def_id,
144-
impl2_def_id,
145-
IntercrateMode::Fixed,
146-
TraitObjectMode::SquashAutoTraitsIssue33140,
147-
|overlap| {
148-
self.check_for_common_items_in_impls(
149-
impl1_def_id,
150-
impl2_def_id,
151-
overlap,
152-
Some(FutureCompatOverlapErrorKind::Issue33140),
153-
);
154-
false
155-
},
156-
|| true,
157-
);
129+
if used_to_be_allowed {
130+
traits::overlapping_impls(
131+
self.tcx,
132+
impl1_def_id,
133+
impl2_def_id,
134+
IntercrateMode::Fixed,
135+
TraitObjectMode::SquashAutoTraitsIssue33140,
136+
|overlap| {
137+
self.check_for_common_items_in_impls(
138+
impl1_def_id,
139+
impl2_def_id,
140+
overlap,
141+
Some(FutureCompatOverlapErrorKind::Issue33140),
142+
);
143+
false
144+
},
145+
|| true,
146+
);
147+
}
158148
}
159149
}
160150
}

0 commit comments

Comments
 (0)