about summary refs log tree commit diff
path: root/compiler/rustc_ast/src/tokenstream.rs
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2024-04-22 16:29:27 +1000
committerNicholas Nethercote <n.nethercote@gmail.com>2024-05-13 10:30:30 +1000
commit9a63a42cb787476930f094fdbd9885251ae01de0 (patch)
tree5e07fa7de037abee072ce2acf94ea0a730fd0a95 /compiler/rustc_ast/src/tokenstream.rs
parent852a78ea8de3aa24c50457340d9560547bc67008 (diff)
downloadrust-9a63a42cb787476930f094fdbd9885251ae01de0.tar.gz
rust-9a63a42cb787476930f094fdbd9885251ae01de0.zip
Remove a `Span` from `TokenKind::Interpolated`.
This span records the declaration of the metavariable in the LHS of the macro.
It's used in a couple of error messages. Unfortunately, it gets in the way of
the long-term goal of removing `TokenKind::Interpolated`. So this commit
removes it, which degrades a couple of (obscure) error messages but makes
things simpler and enables the next commit.
Diffstat (limited to 'compiler/rustc_ast/src/tokenstream.rs')
-rw-r--r--compiler/rustc_ast/src/tokenstream.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_ast/src/tokenstream.rs b/compiler/rustc_ast/src/tokenstream.rs
index 8e80161af1b..d532a884184 100644
--- a/compiler/rustc_ast/src/tokenstream.rs
+++ b/compiler/rustc_ast/src/tokenstream.rs
@@ -490,14 +490,14 @@ impl TokenStream {
 
     fn flatten_token(token: &Token, spacing: Spacing) -> TokenTree {
         match &token.kind {
-            token::Interpolated(nt) if let token::NtIdent(ident, is_raw) = nt.0 => {
-                TokenTree::Token(Token::new(token::Ident(ident.name, is_raw), ident.span), spacing)
+            token::Interpolated(nt) if let token::NtIdent(ident, is_raw) = &**nt => {
+                TokenTree::Token(Token::new(token::Ident(ident.name, *is_raw), ident.span), spacing)
             }
             token::Interpolated(nt) => TokenTree::Delimited(
                 DelimSpan::from_single(token.span),
                 DelimSpacing::new(Spacing::JointHidden, spacing),
                 Delimiter::Invisible,
-                TokenStream::from_nonterminal_ast(&nt.0).flattened(),
+                TokenStream::from_nonterminal_ast(&nt).flattened(),
             ),
             _ => TokenTree::Token(token.clone(), spacing),
         }