@@ -195,15 +195,6 @@ pub fn parse_substs_data<'tcx, F>(data: &[u8], crate_num: ast::CrateNum, pos: us
195195 parse_substs ( & mut st, conv)
196196}
197197
198- pub fn parse_bounds_data < ' tcx , F > ( data : & [ u8 ] , crate_num : ast:: CrateNum ,
199- pos : usize , tcx : & ty:: ctxt < ' tcx > , conv : F )
200- -> ty:: ParamBounds < ' tcx > where
201- F : FnMut ( DefIdSource , ast:: DefId ) -> ast:: DefId ,
202- {
203- let mut st = parse_state_from_data ( data, crate_num, pos, tcx) ;
204- parse_bounds ( & mut st, conv)
205- }
206-
207198pub fn parse_existential_bounds_data < ' tcx , F > ( data : & [ u8 ] , crate_num : ast:: CrateNum ,
208199 pos : usize , tcx : & ty:: ctxt < ' tcx > , conv : F )
209200 -> ty:: ExistentialBounds < ' tcx > where
@@ -879,11 +870,23 @@ fn parse_existential_bounds_<'a,'tcx, F>(st: &mut PState<'a,'tcx>,
879870 -> ty:: ExistentialBounds < ' tcx > where
880871 F : FnMut ( DefIdSource , ast:: DefId ) -> ast:: DefId ,
881872{
882- let ty:: ParamBounds { trait_bounds, mut region_bounds, builtin_bounds, projection_bounds } =
883- parse_bounds_ ( st, conv) ;
884- assert_eq ! ( region_bounds. len( ) , 1 ) ;
885- assert_eq ! ( trait_bounds. len( ) , 0 ) ;
886- let region_bound = region_bounds. pop ( ) . unwrap ( ) ;
873+ let builtin_bounds = parse_builtin_bounds_ ( st, conv) ;
874+ let region_bound = parse_region_ ( st, conv) ;
875+ let mut projection_bounds = Vec :: new ( ) ;
876+
877+ loop {
878+ match next ( st) {
879+ 'P' => {
880+ projection_bounds. push (
881+ ty:: Binder ( parse_projection_predicate_ ( st, conv) ) ) ;
882+ }
883+ '.' => { break ; }
884+ c => {
885+ panic ! ( "parse_bounds: bad bounds ('{}')" , c)
886+ }
887+ }
888+ }
889+
887890 return ty:: ExistentialBounds { region_bound : region_bound,
888891 builtin_bounds : builtin_bounds,
889892 projection_bounds : projection_bounds } ;
@@ -923,60 +926,3 @@ fn parse_builtin_bounds_<F>(st: &mut PState, _conv: &mut F) -> ty::BuiltinBounds
923926 }
924927 }
925928}
926-
927- fn parse_bounds < ' a , ' tcx , F > ( st : & mut PState < ' a , ' tcx > , mut conv : F )
928- -> ty:: ParamBounds < ' tcx > where
929- F : FnMut ( DefIdSource , ast:: DefId ) -> ast:: DefId ,
930- {
931- parse_bounds_ ( st, & mut conv)
932- }
933-
934- fn parse_bounds_ < ' a , ' tcx , F > ( st : & mut PState < ' a , ' tcx > , conv : & mut F )
935- -> ty:: ParamBounds < ' tcx > where
936- F : FnMut ( DefIdSource , ast:: DefId ) -> ast:: DefId ,
937- {
938- let builtin_bounds = parse_builtin_bounds_ ( st, conv) ;
939-
940- let region_bounds = parse_region_bounds_ ( st, conv) ;
941-
942- let mut param_bounds = ty:: ParamBounds {
943- region_bounds : region_bounds,
944- builtin_bounds : builtin_bounds,
945- trait_bounds : Vec :: new ( ) ,
946- projection_bounds : Vec :: new ( ) ,
947- } ;
948-
949-
950- loop {
951- match next ( st) {
952- 'I' => {
953- param_bounds. trait_bounds . push (
954- ty:: Binder ( parse_trait_ref_ ( st, conv) ) ) ;
955- }
956- 'P' => {
957- param_bounds. projection_bounds . push (
958- ty:: Binder ( parse_projection_predicate_ ( st, conv) ) ) ;
959- }
960- '.' => {
961- return param_bounds;
962- }
963- c => {
964- panic ! ( "parse_bounds: bad bounds ('{}')" , c)
965- }
966- }
967- }
968- }
969-
970- fn parse_region_bounds_ < ' a , ' tcx , F > ( st : & mut PState < ' a , ' tcx > , conv : & mut F )
971- -> Vec < ty:: Region > where
972- F : FnMut ( DefIdSource , ast:: DefId ) -> ast:: DefId ,
973- {
974- let mut region_bounds = Vec :: new ( ) ;
975- loop {
976- match next ( st) {
977- 'R' => { region_bounds. push ( parse_region_ ( st, conv) ) ; }
978- '.' => { return region_bounds; }
979- c => { panic ! ( "parse_bounds: bad bounds ('{}')" , c) ; }
980- }
981- }
982- }
0 commit comments