diff options
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/lexer.rs | 13 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 6 |
2 files changed, 10 insertions, 9 deletions
diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs index 22a999ab744..d48c1d9d8d7 100644 --- a/src/libsyntax/parse/lexer.rs +++ b/src/libsyntax/parse/lexer.rs @@ -764,14 +764,15 @@ fn next_token_inner(rdr: @mut StringReader) -> token::Token { let ident = str_to_ident(lifetime_name); let tok = &token::IDENT(ident, false); - if token::is_any_keyword(tok) - && !token::is_keyword(token::keywords::Static, tok) - && !token::is_keyword(token::keywords::Self, tok) { + if token::is_keyword(token::keywords::Self, tok) { fatal_span(rdr, start, rdr.last_pos, - ~"invalid lifetime name"); + ~"invalid lifetime name: 'self is no longer a special lifetime"); + } else if token::is_any_keyword(tok) && + !token::is_keyword(token::keywords::Static, tok) { + fatal_span(rdr, start, rdr.last_pos, ~"invalid lifetime name"); + } else { + token::LIFETIME(ident) } - - token::LIFETIME(ident) }) } diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 4270a4d0dc5..aa37d859d79 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -102,13 +102,13 @@ pub enum PathParsingMode { /// A path with no type parameters; e.g. `foo::bar::Baz` NoTypesAllowed, /// A path with a lifetime and type parameters, with no double colons - /// before the type parameters; e.g. `foo::bar<'self>::Baz<T>` + /// before the type parameters; e.g. `foo::bar<'a>::Baz<T>` LifetimeAndTypesWithoutColons, /// A path with a lifetime and type parameters with double colons before - /// the type parameters; e.g. `foo::bar::<'self>::Baz::<T>` + /// the type parameters; e.g. `foo::bar::<'a>::Baz::<T>` LifetimeAndTypesWithColons, /// A path with a lifetime and type parameters with bounds before the last - /// set of type parameters only; e.g. `foo::bar<'self>::Baz:X+Y<T>` This + /// set of type parameters only; e.g. `foo::bar<'a>::Baz:X+Y<T>` This /// form does not use extra double colons. LifetimeAndTypesAndBounds, } |
