Skip to content

Commit

Permalink
Shrink the comment on TokenTree.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
nnethercote committed Mar 20, 2024
1 parent a94bb2a commit 82a609f
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions compiler/rustc_ast/src/tokenstream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 82a609f

Please sign in to comment.