about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorLymia Aluysia <lymia@lymiahugs.com>2018-03-18 11:21:38 -0500
committerLymia Aluysia <lymia@lymiahugs.com>2018-03-18 11:21:38 -0500
commitd2e7953d1325b1a1fe1cef526dbe8d23fa3e00a1 (patch)
tree08deec42d6be062a0818322402dab039e985ac4e /src/libsyntax/parse
parent7d5c29b9eae5857c040bf6f1b2d729596c8af3ae (diff)
downloadrust-d2e7953d1325b1a1fe1cef526dbe8d23fa3e00a1.tar.gz
rust-d2e7953d1325b1a1fe1cef526dbe8d23fa3e00a1.zip
Move raw_identifiers check to the lexer.
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/lexer/mod.rs4
-rw-r--r--src/libsyntax/parse/parser.rs5
2 files changed, 5 insertions, 4 deletions
diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs
index 8e746ea69e7..068929c8948 100644
--- a/src/libsyntax/parse/lexer/mod.rs
+++ b/src/libsyntax/parse/lexer/mod.rs
@@ -1155,6 +1155,10 @@ impl<'a> StringReader<'a> {
                             &format!("`r#{}` is not currently supported.", ident.name)
                         ).raise();
                     }
+                    if is_raw_ident {
+                        let span = self.mk_sp(raw_start, self.pos);
+                        self.sess.raw_identifier_spans.borrow_mut().push(span);
+                    }
                     token::Ident(ident, is_raw_ident)
                 }));
             }
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index c2ee78e9e9d..4c1575cf589 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -784,7 +784,7 @@ impl<'a> Parser<'a> {
 
     fn parse_ident_common(&mut self, recover: bool) -> PResult<'a, ast::Ident> {
         match self.token {
-            token::Ident(i, is_raw) => {
+            token::Ident(i, _) => {
                 if self.token.is_reserved_ident() {
                     let mut err = self.expected_ident_found();
                     if recover {
@@ -793,9 +793,6 @@ impl<'a> Parser<'a> {
                         return Err(err);
                     }
                 }
-                if is_raw {
-                    self.sess.raw_identifier_spans.borrow_mut().push(self.span);
-                }
                 self.bump();
                 Ok(i)
             }