diff options
| author | bors <bors@rust-lang.org> | 2017-12-07 21:05:49 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2017-12-07 21:05:49 +0000 |
| commit | c8ddf28527119a06a9f5da9bd34c97ae97afe531 (patch) | |
| tree | 458cdc07ce837e57058f2613e8e92e036d5251da /src/libsyntax/parse | |
| parent | 9c49f401fecd8c5ef42a33a070a61daa2b911b47 (diff) | |
| parent | 29e268060209765e5a9efb4c0941765d064e13ea (diff) | |
| download | rust-c8ddf28527119a06a9f5da9bd34c97ae97afe531.tar.gz rust-c8ddf28527119a06a9f5da9bd34c97ae97afe531.zip | |
Auto merge of #46497 - AgustinCB:issue-46311, r=petrochenkov
Modify message for keyword as identifier name This is a temporary solution to #46311. The message is generic enough to cover both cases and is probably a fine enough solution to the specific problem described in the task. However, the underlying reason for this to be wrong is that `next_token_inner` returns `Lifetime` even if the token is a label. That's not simple, as the syntax for both can be quite similar and it may need to take a look to the next token to make a decision. I'm not sure I have enough knowledge about the project to be able to solve that (yet!), so I thought I'll fix the immediate problem first.
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/lexer/mod.rs | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs index 6f20104dda5..d9c33fa50bd 100644 --- a/src/libsyntax/parse/lexer/mod.rs +++ b/src/libsyntax/parse/lexer/mod.rs @@ -14,7 +14,7 @@ use codemap::{CodeMap, FilePathMapping}; use errors::{FatalError, DiagnosticBuilder}; use parse::{token, ParseSess}; use str::char_at; -use symbol::{Symbol, keywords}; +use symbol::Symbol; use std_unicode::property::Pattern_White_Space; use std::borrow::Cow; @@ -1296,18 +1296,6 @@ impl<'a> StringReader<'a> { self.mk_ident(&format!("'{}", lifetime_name)) }); - // Conjure up a "keyword checking ident" to make sure that - // the lifetime name is not a keyword. - let keyword_checking_ident = self.with_str_from(start, |lifetime_name| { - self.mk_ident(lifetime_name) - }); - let keyword_checking_token = &token::Ident(keyword_checking_ident); - let last_bpos = self.pos; - if keyword_checking_token.is_reserved_ident() && - !keyword_checking_token.is_keyword(keywords::Static) { - self.err_span_(start, last_bpos, "lifetimes cannot use keyword names"); - } - return Ok(token::Lifetime(ident)); } |
