about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2022-05-04 16:12:09 +1000
committerNicholas Nethercote <n.nethercote@gmail.com>2022-05-05 07:06:57 +1000
commitbaa18c027a9f001a560d3b9537528cf8d9a53a05 (patch)
treee5de3400d546224d8bd688be18b781afaae9551a
parent99f5945f85342e1eff8d31507410ddd66ea94d64 (diff)
downloadrust-baa18c027a9f001a560d3b9537528cf8d9a53a05.tar.gz
rust-baa18c027a9f001a560d3b9537528cf8d9a53a05.zip
Add a comment on `TokenKind::Interpolated`.
-rw-r--r--compiler/rustc_ast/src/token.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/compiler/rustc_ast/src/token.rs b/compiler/rustc_ast/src/token.rs
index 1589a882f08..b335fc0e71f 100644
--- a/compiler/rustc_ast/src/token.rs
+++ b/compiler/rustc_ast/src/token.rs
@@ -237,6 +237,15 @@ pub enum TokenKind {
     /// treat regular and interpolated lifetime identifiers in the same way.
     Lifetime(Symbol),
 
+    /// An embedded AST node, as produced by a macro. This only exists for
+    /// historical reasons. We'd like to get rid of it, for multiple reasons.
+    /// - It's conceptually very strange. Saying a token can contain an AST
+    ///   node is like saying, in natural language, that a word can contain a
+    ///   sentence.
+    /// - It requires special handling in a bunch of places in the parser.
+    /// - It prevents `Token` from implementing `Copy`.
+    /// It adds complexity and likely slows things down. Please don't add new
+    /// occurrences of this token kind!
     Interpolated(Lrc<Nonterminal>),
 
     /// A doc comment token.