@@ -316,7 +316,7 @@ impl<'a> TyLoweringContext<'a> {
316316 // place even if we encounter more opaque types while
317317 // lowering the bounds
318318 let idx = opaque_type_data. borrow_mut ( ) . alloc ( ImplTrait {
319- bounds : crate :: make_single_type_binders ( Vec :: new ( ) ) ,
319+ bounds : crate :: make_single_type_binders ( Vec :: default ( ) ) ,
320320 } ) ;
321321 // We don't want to lower the bounds inside the binders
322322 // we're currently in, because they don't end up inside
@@ -1007,11 +1007,11 @@ impl<'a> TyLoweringContext<'a> {
10071007 self . substs_from_path_segment ( segment, Some ( resolved. into ( ) ) , false , explicit_self_ty)
10081008 }
10091009
1010- pub ( crate ) fn lower_where_predicate (
1011- & self ,
1012- where_predicate : & WherePredicate ,
1010+ pub ( crate ) fn lower_where_predicate < ' b > (
1011+ & ' b self ,
1012+ where_predicate : & ' b WherePredicate ,
10131013 ignore_bindings : bool ,
1014- ) -> impl Iterator < Item = QuantifiedWhereClause > {
1014+ ) -> impl Iterator < Item = QuantifiedWhereClause > + ' b {
10151015 match where_predicate {
10161016 WherePredicate :: ForLifetime { target, bound, .. }
10171017 | WherePredicate :: TypeBound { target, bound } => {
@@ -1034,18 +1034,16 @@ impl<'a> TyLoweringContext<'a> {
10341034 . intern ( Interner )
10351035 }
10361036 } ;
1037- self . lower_type_bound ( bound, self_ty, ignore_bindings)
1038- . collect :: < Vec < _ > > ( )
1039- . into_iter ( )
1037+ Either :: Left ( self . lower_type_bound ( bound, self_ty, ignore_bindings) )
10401038 }
1041- WherePredicate :: Lifetime { bound, target } => {
1042- vec ! [ crate :: wrap_empty_binders( WhereClause :: LifetimeOutlives ( LifetimeOutlives {
1039+ WherePredicate :: Lifetime { bound, target } => Either :: Right ( iter :: once (
1040+ crate :: wrap_empty_binders ( WhereClause :: LifetimeOutlives ( LifetimeOutlives {
10431041 a : self . lower_lifetime ( bound) ,
10441042 b : self . lower_lifetime ( target) ,
1045- } ) ) ]
1046- . into_iter ( )
1047- }
1043+ } ) ) ,
1044+ ) ) ,
10481045 }
1046+ . into_iter ( )
10491047 }
10501048
10511049 pub ( crate ) fn lower_type_bound (
@@ -1380,8 +1378,8 @@ impl<'a> TyLoweringContext<'a> {
13801378 crate :: wrap_empty_binders ( clause)
13811379 } ) ;
13821380 predicates. extend ( sized_clause) ;
1383- predicates. shrink_to_fit ( ) ;
13841381 }
1382+ predicates. shrink_to_fit ( ) ;
13851383 predicates
13861384 } ) ;
13871385 ImplTrait { bounds : crate :: make_single_type_binders ( predicates) }
0 commit comments