Skip to content

Commit ce04386

Browse files
committed
consistently rename (old) attribute groups
1 parent 34241e5 commit ce04386

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

compiler/rustc_attr_parsing/src/attributes/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
//! - [`CombineAttributeParser`]: makes it easy to implement an attribute which should combine the
1313
//! contents of attributes, if an attribute appear multiple times in a list
1414
//!
15-
//! Attributes should be added to [`ATTRIBUTE_MAPPING`](crate::context::ATTRIBUTE_MAPPING) to be parsed.
15+
//! Attributes should be added to [`ATTRIBUTE_PARSERS`](crate::context::ATTRIBUTE_PARSERS) to be parsed.
1616
1717
use std::marker::PhantomData;
1818

compiler/rustc_attr_parsing/src/context.rs

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use crate::attributes::transparency::TransparencyParser;
2222
use crate::attributes::{AttributeParser as _, Combine, Single};
2323
use crate::parser::{ArgParser, MetaItemParser};
2424

25-
macro_rules! attribute_groups {
25+
macro_rules! attribute_parsers {
2626
(
2727
pub(crate) static $name: ident = [$($names: ty),* $(,)?];
2828
) => {
@@ -63,8 +63,8 @@ macro_rules! attribute_groups {
6363
};
6464
}
6565

66-
attribute_groups!(
67-
pub(crate) static ATTRIBUTE_MAPPING = [
66+
attribute_parsers!(
67+
pub(crate) static ATTRIBUTE_PARSERS = [
6868
// tidy-alphabetical-start
6969
BodyStabilityParser,
7070
ConfusablesParser,
@@ -90,7 +90,7 @@ attribute_groups!(
9090
///
9191
/// Gives [`AttributeParser`]s enough information to create errors, for example.
9292
pub(crate) struct AcceptContext<'a> {
93-
pub(crate) group_cx: &'a FinalizeContext<'a>,
93+
pub(crate) finalize_cx: &'a FinalizeContext<'a>,
9494
/// The span of the attribute currently being parsed
9595
pub(crate) attr_span: Span,
9696
}
@@ -109,7 +109,7 @@ impl<'a> Deref for AcceptContext<'a> {
109109
type Target = FinalizeContext<'a>;
110110

111111
fn deref(&self) -> &Self::Target {
112-
&self.group_cx
112+
&self.finalize_cx
113113
}
114114
}
115115

@@ -219,7 +219,7 @@ impl<'sess> AttributeParser<'sess> {
219219
) -> Vec<Attribute> {
220220
let mut attributes = Vec::new();
221221

222-
let group_cx = FinalizeContext { cx: self, target_span };
222+
let finalize_cx = FinalizeContext { cx: self, target_span };
223223

224224
for attr in attrs {
225225
// If we're only looking for a single attribute, skip all the ones we don't care about.
@@ -268,9 +268,11 @@ impl<'sess> AttributeParser<'sess> {
268268
let args = parser.args();
269269
let parts = path.segments().map(|i| i.name).collect::<Vec<_>>();
270270

271-
if let Some(accept) = ATTRIBUTE_MAPPING.0.get(parts.as_slice()) {
272-
let cx =
273-
AcceptContext { group_cx: &group_cx, attr_span: lower_span(attr.span) };
271+
if let Some(accept) = ATTRIBUTE_PARSERS.0.get(parts.as_slice()) {
272+
let cx = AcceptContext {
273+
finalize_cx: &finalize_cx,
274+
attr_span: lower_span(attr.span),
275+
};
274276

275277
accept(&cx, &args)
276278
} else {
@@ -302,8 +304,8 @@ impl<'sess> AttributeParser<'sess> {
302304
}
303305

304306
let mut parsed_attributes = Vec::new();
305-
for f in &ATTRIBUTE_MAPPING.1 {
306-
if let Some(attr) = f(&group_cx) {
307+
for f in &ATTRIBUTE_PARSERS.1 {
308+
if let Some(attr) = f(&finalize_cx) {
307309
parsed_attributes.push(Attribute::Parsed(attr));
308310
}
309311
}

0 commit comments

Comments
 (0)