@@ -88,38 +88,12 @@ impl<'a, 'tcx> InherentOverlapChecker<'a, 'tcx> {
88
88
89
89
for ( i, & impl1_def_id) in impls. iter ( ) . enumerate ( ) {
90
90
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 (
94
92
self . tcx ,
95
93
impl1_def_id,
96
94
impl2_def_id,
97
95
IntercrateMode :: Issue43355 ,
98
96
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 ,
123
97
|overlap| {
124
98
self . check_for_common_items_in_impls (
125
99
impl1_def_id,
@@ -132,29 +106,45 @@ impl<'a, 'tcx> InherentOverlapChecker<'a, 'tcx> {
132
106
|| true ,
133
107
) ;
134
108
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
+ ) ;
137
127
}
138
128
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
+ }
158
148
}
159
149
}
160
150
}
0 commit comments