|
3 | 3 | use crate::ast::{self, Ident, Lit, LitKind};
|
4 | 4 | use crate::parse::parser::Parser;
|
5 | 5 | use crate::parse::PResult;
|
6 |
| -use crate::parse::token::{self, Token}; |
| 6 | +use crate::parse::token; |
7 | 7 | use crate::parse::unescape::{unescape_str, unescape_char, unescape_byte_str, unescape_byte};
|
8 | 8 | use crate::print::pprust;
|
9 | 9 | use crate::symbol::{kw, Symbol};
|
@@ -117,9 +117,9 @@ impl LitKind {
|
117 | 117 |
|
118 | 118 | token::Str_(mut sym) => {
|
119 | 119 | // If there are no characters requiring special treatment we can
|
120 |
| - // reuse the symbol from the Token. Otherwise, we must generate a |
| 120 | + // reuse the symbol from the token. Otherwise, we must generate a |
121 | 121 | // new symbol because the string in the LitKind is different to the
|
122 |
| - // string in the Token. |
| 122 | + // string in the token. |
123 | 123 | let mut error = None;
|
124 | 124 | let s = &sym.as_str();
|
125 | 125 | if s.as_bytes().iter().any(|&c| c == b'\\' || c == b'\r') {
|
@@ -262,8 +262,8 @@ impl Lit {
|
262 | 262 | /// Losslessly convert an AST literal into a token stream.
|
263 | 263 | crate fn tokens(&self) -> TokenStream {
|
264 | 264 | let token = match self.token {
|
265 |
| - token::Bool(symbol) => Token::Ident(Ident::with_empty_ctxt(symbol), false), |
266 |
| - token => Token::Literal(token, self.suffix), |
| 265 | + token::Bool(symbol) => token::Ident(Ident::new(symbol, self.span), false), |
| 266 | + token => token::Literal(token, self.suffix), |
267 | 267 | };
|
268 | 268 | TokenTree::Token(self.span, token).into()
|
269 | 269 | }
|
|
0 commit comments