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
}
}
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
}
}
+++ /dev/null
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// compile-flags: -Z parse-only
-
-type A = for<,> fn(); //~ ERROR expected one of `>`, identifier, or lifetime, found `,`
-
-fn main() {}
+++ /dev/null
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// compile-flags: -Z parse-only
-
-type A where , = u8; //~ ERROR expected one of `=`, lifetime, or type, found `,`
-
-fn main() {}
type A where 'a:, = u8; // OK
type A where 'a: 'b + 'c = u8; // OK
type A where = u8; // OK
-type A where 'a: 'b + = u8; //~ ERROR expected one of `,` or `=`, found `+`
+type A where 'a: 'b + = u8; // OK
+type A where , = u8; //~ ERROR expected one of `=`, lifetime, or type, found `,`
fn main() {}
type A = for<'a:,> fn(); // OK
type A = for<'a> fn(); // OK
type A = for<> fn(); // OK
+type A = for<'a: 'b +> fn(); // OK
type A = for<'a, T> fn(); //~ ERROR only lifetime parameters can be used in this context
-type A = for<'a: 'b +> fn(); //~ ERROR expected one of `,` or `>`, found `+`
+type A = for<,> fn(); //~ ERROR expected one of `>`, identifier, or lifetime, found `,`
fn main() {}
+++ /dev/null
-// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// compile-flags: -Z parse-only
-
-type A where T, = u8;
-//~^ ERROR expected one of `!`, `(`, `+`, `::`, `:`, `<`, `==`, or `=`, found `,`
-
-fn main() {}
type A where T:, = u8; // OK
type A where T: Trait + Trait = u8; // OK
type A where = u8; // OK
-type A where T: Trait + = u8; //~ ERROR expected one of `(`, `,`, `::`, `<`, or `=`, found `+`
+type A where T: Trait + = u8; // OK
+type A where T, = u8;
+//~^ ERROR expected one of `!`, `(`, `+`, `::`, `:`, `<`, `==`, or `=`, found `,`
fn main() {}
T: 'a, // OK
T:, // OK
T: ?for<'a: 'b + 'c> Trait, // OK
+ T: Tr +, // OK
T: ?'a, //~ ERROR `?` may only modify trait bounds, not lifetime bounds
- T: Tr +, //~ ERROR expected one of `(`, `,`, `::`, `<`, `=`, or `>`, found `+`
>;
fn main() {}