diff options
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 98479d65cbb..40c4ac9f8c0 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -1023,10 +1023,21 @@ impl<'a> Parser<'a> { self.parse_ty_bare_fn_or_ty_closure(lifetime_defs) } else if self.token == token::ModSep || self.token.is_ident() || - self.token.is_path() { + self.token.is_path() + { let trait_ref = self.parse_trait_ref(); - TyPolyTraitRef(P(PolyTraitRef { bound_lifetimes: lifetime_defs, - trait_ref: trait_ref })) + let poly_trait_ref = ast::PolyTraitRef { bound_lifetimes: lifetime_defs, + trait_ref: trait_ref }; + let other_bounds = if self.eat(&token::BinOp(token::Plus)) { + self.parse_ty_param_bounds() + } else { + OwnedSlice::empty() + }; + let all_bounds = + Some(TraitTyParamBound(poly_trait_ref)).into_iter() + .chain(other_bounds.into_vec().into_iter()) + .collect(); + ast::TyPolyTraitRef(all_bounds) } else { self.parse_ty_closure(lifetime_defs) } |
