@@ -815,34 +815,25 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
815
815
ast_bounds : & [ hir:: GenericBound < ' _ > ] ,
816
816
bounds : & mut Bounds < ' tcx > ,
817
817
) {
818
- let mut trait_bounds = Vec :: new ( ) ;
819
- let mut region_bounds = Vec :: new ( ) ;
820
-
821
818
let constness = self . default_constness_for_trait_bounds ( ) ;
822
819
for ast_bound in ast_bounds {
823
820
match * ast_bound {
824
821
hir:: GenericBound :: Trait ( ref b, hir:: TraitBoundModifier :: None ) => {
825
- trait_bounds . push ( ( b, constness) )
822
+ self . instantiate_poly_trait_ref ( b, constness, param_ty , bounds ) ;
826
823
}
827
824
hir:: GenericBound :: Trait ( ref b, hir:: TraitBoundModifier :: MaybeConst ) => {
828
- trait_bounds . push ( ( b, Constness :: NotConst ) )
825
+ self . instantiate_poly_trait_ref ( b, Constness :: NotConst , param_ty , bounds ) ;
829
826
}
830
827
hir:: GenericBound :: Trait ( _, hir:: TraitBoundModifier :: Maybe ) => { }
831
828
hir:: GenericBound :: LangItemTrait ( lang_item, span, hir_id, args) => self
832
829
. instantiate_lang_item_trait_ref (
833
830
lang_item, span, hir_id, args, param_ty, bounds,
834
831
) ,
835
- hir:: GenericBound :: Outlives ( ref l) => region_bounds. push ( l) ,
832
+ hir:: GenericBound :: Outlives ( ref l) => {
833
+ bounds. region_bounds . push ( ( self . ast_region_to_region ( l, None ) , l. span ) )
834
+ }
836
835
}
837
836
}
838
-
839
- for ( bound, constness) in trait_bounds {
840
- let _ = self . instantiate_poly_trait_ref ( bound, constness, param_ty, bounds) ;
841
- }
842
-
843
- bounds. region_bounds . extend (
844
- region_bounds. into_iter ( ) . map ( |r| ( self . ast_region_to_region ( r, None ) , r. span ) ) ,
845
- ) ;
846
837
}
847
838
848
839
/// Translates a list of bounds from the HIR into the `Bounds` data structure.
0 commit comments