@@ -189,26 +189,22 @@ fn fulfill_implication<'a, 'tcx>(
189
189
190
190
let selcx = & mut SelectionContext :: new ( & infcx) ;
191
191
let target_substs = infcx. fresh_substs_for_item ( DUMMY_SP , target_impl) ;
192
- let ( target_trait_ref, mut obligations) =
192
+ let ( target_trait_ref, obligations) =
193
193
impl_trait_ref_and_oblig ( selcx, param_env, target_impl, target_substs) ;
194
- debug ! (
195
- "fulfill_implication: target_trait_ref={:?}, obligations={:?}" ,
196
- target_trait_ref, obligations
197
- ) ;
198
194
199
195
// do the impls unify? If not, no specialization.
200
- match infcx . at ( & ObligationCause :: dummy ( ) , param_env ) . eq ( source_trait_ref , target_trait_ref ) {
201
- Ok ( InferOk { obligations : o , .. } ) => {
202
- obligations . extend ( o ) ;
203
- }
204
- Err ( _) => {
205
- debug ! (
206
- "fulfill_implication: {:?} does not unify with {:?}" ,
207
- source_trait_ref, target_trait_ref
208
- ) ;
209
- return Err ( ( ) ) ;
210
- }
211
- }
196
+ let more_obligations =
197
+ match infcx . at ( & ObligationCause :: dummy ( ) , param_env ) . eq ( source_trait_ref , target_trait_ref )
198
+ {
199
+ Ok ( InferOk { obligations , .. } ) => obligations ,
200
+ Err ( _) => {
201
+ debug ! (
202
+ "fulfill_implication: {:?} does not unify with {:?}" ,
203
+ source_trait_ref, target_trait_ref
204
+ ) ;
205
+ return Err ( ( ) ) ;
206
+ }
207
+ } ;
212
208
213
209
// attempt to prove all of the predicates for impl2 given those for impl1
214
210
// (which are packed up in penv)
@@ -226,7 +222,7 @@ fn fulfill_implication<'a, 'tcx>(
226
222
// we already make a mockery out of the region system, so
227
223
// why not ignore them a bit earlier?
228
224
let mut fulfill_cx = FulfillmentContext :: new_ignoring_regions ( ) ;
229
- for oblig in obligations. into_iter ( ) {
225
+ for oblig in obligations. chain ( more_obligations ) {
230
226
fulfill_cx. register_predicate_obligation ( & infcx, oblig) ;
231
227
}
232
228
match fulfill_cx. select_all_or_error ( infcx) {
@@ -261,7 +257,7 @@ pub(super) fn specialization_graph_provider(
261
257
) -> & specialization_graph:: Graph {
262
258
let mut sg = specialization_graph:: Graph :: new ( ) ;
263
259
264
- let mut trait_impls = tcx. all_impls ( trait_id) ;
260
+ let mut trait_impls: Vec < _ > = tcx. all_impls ( trait_id) . collect ( ) ;
265
261
266
262
// The coherence checking implementation seems to rely on impls being
267
263
// iterated over (roughly) in definition order, so we are sorting by
0 commit comments