@@ -815,34 +815,25 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
815815 ast_bounds : & [ hir:: GenericBound < ' _ > ] ,
816816 bounds : & mut Bounds < ' tcx > ,
817817 ) {
818- let mut trait_bounds = Vec :: new ( ) ;
819- let mut region_bounds = Vec :: new ( ) ;
820-
821818 let constness = self . default_constness_for_trait_bounds ( ) ;
822819 for ast_bound in ast_bounds {
823820 match * ast_bound {
824821 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 ) ;
826823 }
827824 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 ) ;
829826 }
830827 hir:: GenericBound :: Trait ( _, hir:: TraitBoundModifier :: Maybe ) => { }
831828 hir:: GenericBound :: LangItemTrait ( lang_item, span, hir_id, args) => self
832829 . instantiate_lang_item_trait_ref (
833830 lang_item, span, hir_id, args, param_ty, bounds,
834831 ) ,
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+ }
836835 }
837836 }
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- ) ;
846837 }
847838
848839 /// Translates a list of bounds from the HIR into the `Bounds` data structure.
0 commit comments