diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-03-20 09:47:39 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-03-21 10:18:34 +1100 |
| commit | 82a609f9a6922a5adec4d71bff1f948d868d0384 (patch) | |
| tree | 3f325c406775d4f0837df71713c0d1e1754d0ead | |
| parent | a94bb2a0136b72d177fcd1c49d50227ded195133 (diff) | |
| download | rust-82a609f9a6922a5adec4d71bff1f948d868d0384.tar.gz rust-82a609f9a6922a5adec4d71bff1f948d868d0384.zip | |
Shrink the comment on `TokenTree`.
It uses very old language that is more confusing today than helpful, including references to `SubstNt` that no longer exists. The comment above `TokenStream` is better, and suffices for a basic understanding of these types.
| -rw-r--r-- | compiler/rustc_ast/src/tokenstream.rs | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/compiler/rustc_ast/src/tokenstream.rs b/compiler/rustc_ast/src/tokenstream.rs index adc3056cc29..239735456ad 100644 --- a/compiler/rustc_ast/src/tokenstream.rs +++ b/compiler/rustc_ast/src/tokenstream.rs @@ -28,18 +28,7 @@ use smallvec::{smallvec, SmallVec}; use std::borrow::Cow; use std::{cmp, fmt, iter}; -/// When the main Rust parser encounters a syntax-extension invocation, it -/// parses the arguments to the invocation as a token tree. This is a very -/// loose structure, such that all sorts of different AST fragments can -/// be passed to syntax extensions using a uniform type. -/// -/// If the syntax extension is an MBE macro, it will attempt to match its -/// LHS token tree against the provided token tree, and if it finds a -/// match, will transcribe the RHS token tree, splicing in any captured -/// `macro_parser::matched_nonterminals` into the `SubstNt`s it finds. -/// -/// The RHS of an MBE macro is the only place `SubstNt`s are substituted. -/// Nothing special happens to misnamed or misplaced `SubstNt`s. +/// Part of a `TokenStream`. #[derive(Debug, Clone, PartialEq, Encodable, Decodable, HashStable_Generic)] pub enum TokenTree { /// A single token. Should never be `OpenDelim` or `CloseDelim`, because |
