File tree Expand file tree Collapse file tree 2 files changed +10
-9
lines changed
librustc_trait_selection/traits Expand file tree Collapse file tree 2 files changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -149,21 +149,20 @@ impl Elaborator<'tcx> {
149149 // Get predicates declared on the trait.
150150 let predicates = tcx. super_predicates_of ( data. def_id ( ) ) ;
151151
152- let obligations = predicates. predicates . iter ( ) . map ( |( pred, span) | {
152+ let obligations = predicates. predicates . into_iter ( ) . map ( |( pred, span) | {
153153 predicate_obligation (
154154 pred. subst_supertrait ( tcx, & data. to_poly_trait_ref ( ) ) ,
155155 Some ( * span) ,
156156 )
157157 } ) ;
158- debug ! ( "super_predicates: data={:?} predicates={:?} " , data, & obligations ) ;
158+ debug ! ( "super_predicates: data={:?}" , data) ;
159159
160160 // Only keep those bounds that we haven't already seen.
161161 // This is necessary to prevent infinite recursion in some
162162 // cases. One common case is when people define
163163 // `trait Sized: Sized { }` rather than `trait Sized { }`.
164164 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 ) ) ;
167166
168167 self . stack . extend ( obligations) ;
169168 }
Original file line number Diff line number Diff line change @@ -281,7 +281,7 @@ impl AutoTraitFinder<'tcx> {
281281 } ,
282282 } ) ) ;
283283
284- let mut computed_preds: FxHashSet < _ > = param_env. caller_bounds . iter ( ) . cloned ( ) . collect ( ) ;
284+ let computed_preds = param_env. caller_bounds . iter ( ) . cloned ( ) ;
285285 let mut user_computed_preds: FxHashSet < _ > =
286286 user_env. caller_bounds . iter ( ) . cloned ( ) . collect ( ) ;
287287
@@ -358,9 +358,11 @@ impl AutoTraitFinder<'tcx> {
358358 _ => panic ! ( "Unexpected error for '{:?}': {:?}" , ty, result) ,
359359 } ;
360360
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 ) ;
364366 new_env =
365367 ty:: ParamEnv :: new ( tcx. mk_predicates ( normalized_preds) , param_env. reveal , None ) ;
366368 }
@@ -738,7 +740,7 @@ impl AutoTraitFinder<'tcx> {
738740 if p. ty ( ) . skip_binder ( ) . has_infer_types ( ) {
739741 if !self . evaluate_nested_obligations (
740742 ty,
741- v. clone ( ) . iter ( ) . cloned ( ) ,
743+ v. into_iter ( ) ,
742744 computed_preds,
743745 fresh_preds,
744746 predicates,
You can’t perform that action at this time.
0 commit comments