about summary refs log tree commit diff
path: root/src/libsyntax/parse/parser.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-04-28 22:28:11 +0000
committerbors <bors@rust-lang.org>2017-04-28 22:28:11 +0000
commit810ed98d08158574e98b504c0955fce6c6a72ad9 (patch)
treeafc14f78d61b4ba2404af0b25f23dd9753a020f1 /src/libsyntax/parse/parser.rs
parent128aa262e8fe445f5c4d5c1f15dd28a2007c0234 (diff)
parentd349e87d61745d402f6e38727beb62a6525a2153 (diff)
downloadrust-810ed98d08158574e98b504c0955fce6c6a72ad9.tar.gz
rust-810ed98d08158574e98b504c0955fce6c6a72ad9.zip
Auto merge of #41542 - petrochenkov:objpars2, r=nikomatsakis
syntax: Parse trait object types starting with a lifetime bound

Fixes https://github.com/rust-lang/rust/issues/39085

This was originally implemented in https://github.com/rust-lang/rust/pull/40043, then reverted, then there was some [agreement](https://github.com/rust-lang/rust/issues/39318#issuecomment-289108720) that it should be supported.
(This is hopefully the last PR related to bound parsing.)
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
-rw-r--r--src/libsyntax/parse/parser.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index cba77335143..84d53dbef7c 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -1453,9 +1453,9 @@ impl<'a> Parser<'a> {
         } else if self.eat_keyword(keywords::Impl) {
             // FIXME: figure out priority of `+` in `impl Trait1 + Trait2` (#34511).
             TyKind::ImplTrait(self.parse_ty_param_bounds()?)
-        } else if self.check(&token::Question) {
+        } else if self.check(&token::Question) ||
+                  self.check_lifetime() && self.look_ahead(1, |t| t == &token::BinOp(token::Plus)){
             // Bound list (trait object type)
-            // Bound lists starting with `'lt` are not currently supported (#40043)
             TyKind::TraitObject(self.parse_ty_param_bounds_common(allow_plus)?)
         } else {
             let msg = format!("expected type, found {}", self.this_token_descr());