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