Skip to content

Commit 9450e7d

Browse files
committed
syntax: Fix spans for boolean literals passed to proc macros
1 parent 694f76d commit 9450e7d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/libsyntax/parse/literal.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use crate::ast::{self, Ident, Lit, LitKind};
44
use crate::parse::parser::Parser;
55
use crate::parse::PResult;
6-
use crate::parse::token::{self, Token};
6+
use crate::parse::token;
77
use crate::parse::unescape::{unescape_str, unescape_char, unescape_byte_str, unescape_byte};
88
use crate::print::pprust;
99
use crate::symbol::{kw, Symbol};
@@ -117,9 +117,9 @@ impl LitKind {
117117

118118
token::Str_(mut sym) => {
119119
// 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
121121
// new symbol because the string in the LitKind is different to the
122-
// string in the Token.
122+
// string in the token.
123123
let mut error = None;
124124
let s = &sym.as_str();
125125
if s.as_bytes().iter().any(|&c| c == b'\\' || c == b'\r') {
@@ -262,8 +262,8 @@ impl Lit {
262262
/// Losslessly convert an AST literal into a token stream.
263263
crate fn tokens(&self) -> TokenStream {
264264
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),
267267
};
268268
TokenTree::Token(self.span, token).into()
269269
}

0 commit comments

Comments
 (0)