From 65aeafa24f1542c23643a67172b7b2fec4f290cc Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Tue, 24 Jan 2017 22:55:45 +0300 Subject: parser: Permit trailing +'s in bound lists --- src/libsyntax/parse/parser.rs | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'src/libsyntax/parse/parser.rs') diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 939f126640d..9e3c1dcef8a 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -4003,14 +4003,7 @@ impl<'a> Parser<'a> { break }} - // Trailing plus is not allowed for now and we have to detect it. - let is_bound_start = |token: &token::Token| { - token == &token::Question || token.is_lifetime() || - token.is_keyword(keywords::For) || token.is_path_start() - }; - if self.check(&token::BinOp(token::Plus)) && self.look_ahead(1, is_bound_start) { - self.bump(); - } else { + if !self.eat(&token::BinOp(token::Plus)) { break } } @@ -4024,9 +4017,8 @@ impl<'a> Parser<'a> { let mut lifetimes = Vec::new(); while let Some(lifetime) = self.eat_lifetime() { lifetimes.push(lifetime); - if self.check(&token::BinOp(token::Plus)) && self.look_ahead(1, |t| t.is_lifetime()) { - self.bump(); - } else { + + if !self.eat(&token::BinOp(token::Plus)) { break } } -- cgit 1.4.1-3-g733a5