about summary refs log tree commit diff
path: root/src/libsyntax/ext
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2019-06-05 09:39:34 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2019-06-06 14:04:02 +0300
commit5e693531ffa55cfb0cececdf5d7203a6d400e828 (patch)
tree762458c4a3823ed70ae5eb01ca214a1d68858b92 /src/libsyntax/ext
parentaa6fba98ae717d6090cdd5d0569114adfc825680 (diff)
downloadrust-5e693531ffa55cfb0cececdf5d7203a6d400e828.tar.gz
rust-5e693531ffa55cfb0cececdf5d7203a6d400e828.zip
syntax: Add some helper methods to `Token`
Diffstat (limited to 'src/libsyntax/ext')
-rw-r--r--src/libsyntax/ext/tt/macro_parser.rs13
-rw-r--r--src/libsyntax/ext/tt/quoted.rs2
2 files changed, 7 insertions, 8 deletions
diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs
index 4f681a77ed3..7127acabb44 100644
--- a/src/libsyntax/ext/tt/macro_parser.rs
+++ b/src/libsyntax/ext/tt/macro_parser.rs
@@ -727,13 +727,12 @@ pub fn parse(
                     "ambiguity: multiple successful parses".to_string(),
                 );
             } else {
-                let span = if parser.span.is_dummy() {
-                    parser.span
-                } else {
-                    sess.source_map().next_point(parser.span)
-                };
                 return Failure(
-                    Token { kind: token::Eof, span },
+                    Token::new(token::Eof, if parser.span.is_dummy() {
+                        parser.span
+                    } else {
+                        sess.source_map().next_point(parser.span)
+                    }),
                     "missing tokens in macro arguments",
                 );
             }
@@ -771,7 +770,7 @@ pub fn parse(
         // then there is a syntax error.
         else if bb_items.is_empty() && next_items.is_empty() {
             return Failure(
-                parser.token.clone(),
+                parser.token.take(),
                 "no rules expected this token in macro call",
             );
         }
diff --git a/src/libsyntax/ext/tt/quoted.rs b/src/libsyntax/ext/tt/quoted.rs
index 9f4e35ad3d7..558b07af611 100644
--- a/src/libsyntax/ext/tt/quoted.rs
+++ b/src/libsyntax/ext/tt/quoted.rs
@@ -154,7 +154,7 @@ impl TokenTree {
     }
 
     crate fn token(span: Span, kind: TokenKind) -> TokenTree {
-        TokenTree::Token(Token { kind, span })
+        TokenTree::Token(Token::new(kind, span))
     }
 }