diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-04-22 16:29:27 +1000 | 
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-05-13 10:30:30 +1000 | 
| commit | 9a63a42cb787476930f094fdbd9885251ae01de0 (patch) | |
| tree | 5e07fa7de037abee072ce2acf94ea0a730fd0a95 /compiler/rustc_expand/src/proc_macro_server.rs | |
| parent | 852a78ea8de3aa24c50457340d9560547bc67008 (diff) | |
| download | rust-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_expand/src/proc_macro_server.rs')
| -rw-r--r-- | compiler/rustc_expand/src/proc_macro_server.rs | 6 | 
1 files changed, 3 insertions, 3 deletions
| diff --git a/compiler/rustc_expand/src/proc_macro_server.rs b/compiler/rustc_expand/src/proc_macro_server.rs index 5a66b0fbdef..8cf96580161 100644 --- a/compiler/rustc_expand/src/proc_macro_server.rs +++ b/compiler/rustc_expand/src/proc_macro_server.rs @@ -259,7 +259,7 @@ impl FromInternal<(TokenStream, &mut Rustc<'_, '_>)> for Vec<TokenTree<TokenStre })); } - Interpolated(ref nt) if let NtIdent(ident, is_raw) = &nt.0 => { + Interpolated(ref nt) if let NtIdent(ident, is_raw) = &**nt => { trees.push(TokenTree::Ident(Ident { sym: ident.name, is_raw: matches!(is_raw, IdentIsRaw::Yes), @@ -268,14 +268,14 @@ impl FromInternal<(TokenStream, &mut Rustc<'_, '_>)> for Vec<TokenTree<TokenStre } Interpolated(nt) => { - let stream = TokenStream::from_nonterminal_ast(&nt.0); + let stream = TokenStream::from_nonterminal_ast(&nt); // A hack used to pass AST fragments to attribute and derive // macros as a single nonterminal token instead of a token // stream. Such token needs to be "unwrapped" and not // represented as a delimited group. // FIXME: It needs to be removed, but there are some // compatibility issues (see #73345). - if crate::base::nt_pretty_printing_compatibility_hack(&nt.0, rustc.ecx.sess) { + if crate::base::nt_pretty_printing_compatibility_hack(&nt, rustc.ecx.sess) { trees.extend(Self::from_internal((stream, rustc))); } else { trees.push(TokenTree::Group(Group { | 
