Skip to content

Commit baa18c0

Browse files
committed
Add a comment on TokenKind::Interpolated.
1 parent 99f5945 commit baa18c0

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

compiler/rustc_ast/src/token.rs

+9
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,15 @@ pub enum TokenKind {
237237
/// treat regular and interpolated lifetime identifiers in the same way.
238238
Lifetime(Symbol),
239239

240+
/// An embedded AST node, as produced by a macro. This only exists for
241+
/// historical reasons. We'd like to get rid of it, for multiple reasons.
242+
/// - It's conceptually very strange. Saying a token can contain an AST
243+
/// node is like saying, in natural language, that a word can contain a
244+
/// sentence.
245+
/// - It requires special handling in a bunch of places in the parser.
246+
/// - It prevents `Token` from implementing `Copy`.
247+
/// It adds complexity and likely slows things down. Please don't add new
248+
/// occurrences of this token kind!
240249
Interpolated(Lrc<Nonterminal>),
241250

242251
/// A doc comment token.

0 commit comments

Comments
 (0)