File tree 2 files changed +10
-9
lines changed
librustc_trait_selection/traits
2 files changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -149,21 +149,20 @@ impl Elaborator<'tcx> {
149
149
// Get predicates declared on the trait.
150
150
let predicates = tcx. super_predicates_of ( data. def_id ( ) ) ;
151
151
152
- let obligations = predicates. predicates . iter ( ) . map ( |( pred, span) | {
152
+ let obligations = predicates. predicates . into_iter ( ) . map ( |( pred, span) | {
153
153
predicate_obligation (
154
154
pred. subst_supertrait ( tcx, & data. to_poly_trait_ref ( ) ) ,
155
155
Some ( * span) ,
156
156
)
157
157
} ) ;
158
- debug ! ( "super_predicates: data={:?} predicates={:?} " , data, & obligations ) ;
158
+ debug ! ( "super_predicates: data={:?}" , data) ;
159
159
160
160
// Only keep those bounds that we haven't already seen.
161
161
// This is necessary to prevent infinite recursion in some
162
162
// cases. One common case is when people define
163
163
// `trait Sized: Sized { }` rather than `trait Sized { }`.
164
164
let visited = & mut self . visited ;
165
- let obligations =
166
- obligations. filter ( |obligation| visited. insert ( & obligation. predicate ) ) ;
165
+ let obligations = obligations. filter ( |o| visited. insert ( & o. predicate ) ) ;
167
166
168
167
self . stack . extend ( obligations) ;
169
168
}
Original file line number Diff line number Diff line change @@ -281,7 +281,7 @@ impl AutoTraitFinder<'tcx> {
281
281
} ,
282
282
} ) ) ;
283
283
284
- let mut computed_preds: FxHashSet < _ > = param_env. caller_bounds . iter ( ) . cloned ( ) . collect ( ) ;
284
+ let computed_preds = param_env. caller_bounds . iter ( ) . cloned ( ) ;
285
285
let mut user_computed_preds: FxHashSet < _ > =
286
286
user_env. caller_bounds . iter ( ) . cloned ( ) . collect ( ) ;
287
287
@@ -358,9 +358,11 @@ impl AutoTraitFinder<'tcx> {
358
358
_ => panic ! ( "Unexpected error for '{:?}': {:?}" , ty, result) ,
359
359
} ;
360
360
361
- computed_preds. extend ( user_computed_preds. iter ( ) . cloned ( ) ) ;
362
- let normalized_preds =
363
- elaborate_predicates ( tcx, computed_preds. iter ( ) . cloned ( ) ) . map ( |o| o. predicate ) ;
361
+ let normalized_preds = elaborate_predicates (
362
+ tcx,
363
+ computed_preds. clone ( ) . chain ( user_computed_preds. iter ( ) . cloned ( ) ) ,
364
+ )
365
+ . map ( |o| o. predicate ) ;
364
366
new_env =
365
367
ty:: ParamEnv :: new ( tcx. mk_predicates ( normalized_preds) , param_env. reveal , None ) ;
366
368
}
@@ -738,7 +740,7 @@ impl AutoTraitFinder<'tcx> {
738
740
if p. ty ( ) . skip_binder ( ) . has_infer_types ( ) {
739
741
if !self . evaluate_nested_obligations (
740
742
ty,
741
- v. clone ( ) . iter ( ) . cloned ( ) ,
743
+ v. into_iter ( ) ,
742
744
computed_preds,
743
745
fresh_preds,
744
746
predicates,
You can’t perform that action at this time.
0 commit comments