Skip to content

Commit 440a685

Browse files
committed
Rename TtSeq as TtSlice.
It's a better name because (a) it holds a slice, and (b) "sequence" has other meanings in this file.
1 parent f43028d commit 440a685

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

compiler/rustc_expand/src/mbe/macro_parser.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -93,28 +93,28 @@ use std::ops::{Deref, DerefMut};
9393

9494
// To avoid costly uniqueness checks, we require that `MatchSeq` always has a nonempty body.
9595

96-
/// Either a sequence of token trees or a single one. This is used as the representation of the
97-
/// sequence of tokens that make up a matcher.
96+
/// Either a slice of token trees or a single one. This is used as the representation of the
97+
/// token trees that make up a matcher.
9898
#[derive(Clone)]
9999
enum TokenTreeOrTokenTreeSlice<'tt> {
100100
Tt(TokenTree),
101-
TtSeq(&'tt [TokenTree]),
101+
TtSlice(&'tt [TokenTree]),
102102
}
103103

104104
impl<'tt> TokenTreeOrTokenTreeSlice<'tt> {
105105
/// Returns the number of constituent top-level token trees of `self` (top-level in that it
106106
/// will not recursively descend into subtrees).
107107
fn len(&self) -> usize {
108108
match *self {
109-
TtSeq(ref v) => v.len(),
109+
TtSlice(ref v) => v.len(),
110110
Tt(ref tt) => tt.len(),
111111
}
112112
}
113113

114114
/// The `index`-th token tree of `self`.
115115
fn get_tt(&self, index: usize) -> TokenTree {
116116
match *self {
117-
TtSeq(ref v) => v[index].clone(),
117+
TtSlice(ref v) => v[index].clone(),
118118
Tt(ref tt) => tt.get_tt(index),
119119
}
120120
}
@@ -154,7 +154,7 @@ type NamedMatchVec = SmallVec<[NamedMatch; 4]>;
154154
/// lifetime. By separating `'tt` from `'root`, we can show that.
155155
#[derive(Clone)]
156156
struct MatcherPos<'root, 'tt> {
157-
/// The token or sequence of tokens that make up the matcher. `elts` is short for "elements".
157+
/// The token or slice of tokens that make up the matcher. `elts` is short for "elements".
158158
top_elts: TokenTreeOrTokenTreeSlice<'tt>,
159159

160160
/// The position of the "dot" in this matcher
@@ -220,7 +220,7 @@ impl<'root, 'tt> MatcherPos<'root, 'tt> {
220220
let match_idx_hi = count_names(ms);
221221
MatcherPos {
222222
// Start with the top level matcher given to us.
223-
top_elts: TtSeq(ms),
223+
top_elts: TtSlice(ms),
224224

225225
// The "dot" is before the first token of the matcher.
226226
idx: 0,
@@ -419,7 +419,7 @@ crate enum NamedMatch {
419419
MatchedNonterminal(Lrc<Nonterminal>),
420420
}
421421

422-
/// Takes a sequence of token trees `ms` representing a matcher which successfully matched input
422+
/// Takes a slice of token trees `ms` representing a matcher which successfully matched input
423423
/// and an iterator of items that matched input and produces a `NamedParseResult`.
424424
fn nameize<I: Iterator<Item = NamedMatch>>(
425425
sess: &ParseSess,
@@ -678,8 +678,8 @@ fn parse_tt_inner<'root, 'tt>(
678678
}
679679
}
680680

681-
/// Use the given sequence of token trees (`ms`) as a matcher. Match the token
682-
/// stream from the given `parser` against it and return the match.
681+
/// Use the given slice of token trees (`ms`) as a matcher. Match the token stream from the given
682+
/// `parser` against it and return the match.
683683
pub(super) fn parse_tt(
684684
parser: &mut Cow<'_, Parser<'_>>,
685685
ms: &[TokenTree],

0 commit comments

Comments
 (0)