Skip to content

Commit 406244b

Browse files
committed
Rename FlatToken::AttrTarget as FlatToken::Attributes.
So it matches the closely related `AttrTokenTree::Attributes` variant.
1 parent c73191a commit 406244b

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

compiler/rustc_parse/src/parser/attr_wrapper.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ impl ToAttrTokenStream for LazyAttrTokenStreamImpl {
148148
for (range, attr_data) in replace_ranges.into_iter().rev() {
149149
assert!(!range.is_empty(), "Cannot replace an empty range: {range:?}");
150150

151-
// Replace the tokens in range with zero or one `FlatToken::AttrTarget`s, plus
151+
// Replace the tokens in range with zero or one `FlatToken::Attribute`s, plus
152152
// enough `FlatToken::Empty`s to fill up the rest of the range. This keeps the
153153
// total length of `tokens` constant throughout the replacement process, allowing
154154
// us to use all of the `ReplaceRanges` entries without adjusting indices.
@@ -157,7 +157,7 @@ impl ToAttrTokenStream for LazyAttrTokenStreamImpl {
157157
(range.start as usize)..(range.end as usize),
158158
attr_data
159159
.into_iter()
160-
.map(|attr_data| (FlatToken::AttrTarget(attr_data), Spacing::Alone))
160+
.map(|attr_data| (FlatToken::Attributes(attr_data), Spacing::Alone))
161161
.chain(
162162
iter::repeat((FlatToken::Empty, Spacing::Alone))
163163
.take(range.len() - attr_data_len),
@@ -414,7 +414,7 @@ fn make_attr_token_stream(
414414
.expect("Bottom token frame is missing!")
415415
.inner
416416
.push(AttrTokenTree::Token(token, spacing)),
417-
FlatToken::AttrTarget(data) => stack
417+
FlatToken::Attributes(data) => stack
418418
.last_mut()
419419
.expect("Bottom token frame is missing!")
420420
.inner

compiler/rustc_parse/src/parser/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ struct ClosureSpans {
209209
/// 1. During the parsing of an AST node that may have a `#[derive]`
210210
/// attribute, we parse a nested AST node that has `#[cfg]` or `#[cfg_attr]`
211211
/// In this case, we use a `ReplaceRange` to replace the entire inner AST node
212-
/// with `FlatToken::AttrTarget`, allowing us to perform eager cfg-expansion
212+
/// with `FlatToken::Attributes`, allowing us to perform eager cfg-expansion
213213
/// on an `AttrTokenStream`.
214214
///
215215
/// 2. When we parse an inner attribute while collecting tokens. We
@@ -1612,7 +1612,7 @@ enum FlatToken {
16121612
/// `AttributesData` is inserted directly into the
16131613
/// constructed `AttrTokenStream` as
16141614
/// an `AttrTokenTree::Attributes`.
1615-
AttrTarget(AttributesData),
1615+
Attributes(AttributesData),
16161616
/// A special 'empty' token that is ignored during the conversion
16171617
/// to an `AttrTokenStream`. This is used to simplify the
16181618
/// handling of replace ranges.

0 commit comments

Comments
 (0)