about summary refs log tree commit diff
path: root/src/libsyntax/parse/parser.rs
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2017-01-24 22:55:45 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2017-01-24 22:56:02 +0300
commit65aeafa24f1542c23643a67172b7b2fec4f290cc (patch)
tree92464a7e8ce69e08cc98ab7bb211d4ba4cda45a1 /src/libsyntax/parse/parser.rs
parent375cb2eec70f239b477c6b88852c8258765b5420 (diff)
downloadrust-65aeafa24f1542c23643a67172b7b2fec4f290cc.tar.gz
rust-65aeafa24f1542c23643a67172b7b2fec4f290cc.zip
parser: Permit trailing +'s in bound lists
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
-rw-r--r--src/libsyntax/parse/parser.rs14
1 files changed, 3 insertions, 11 deletions
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
             }
         }