@@ -22,7 +22,7 @@ use crate::attributes::transparency::TransparencyParser;
22
22
use crate :: attributes:: { AttributeParser as _, Combine , Single } ;
23
23
use crate :: parser:: { ArgParser , MetaItemParser } ;
24
24
25
- macro_rules! attribute_groups {
25
+ macro_rules! attribute_parsers {
26
26
(
27
27
pub ( crate ) static $name: ident = [ $( $names: ty) ,* $( , ) ?] ;
28
28
) => {
@@ -63,8 +63,8 @@ macro_rules! attribute_groups {
63
63
} ;
64
64
}
65
65
66
- attribute_groups ! (
67
- pub ( crate ) static ATTRIBUTE_MAPPING = [
66
+ attribute_parsers ! (
67
+ pub ( crate ) static ATTRIBUTE_PARSERS = [
68
68
// tidy-alphabetical-start
69
69
BodyStabilityParser ,
70
70
ConfusablesParser ,
@@ -90,7 +90,7 @@ attribute_groups!(
90
90
///
91
91
/// Gives [`AttributeParser`]s enough information to create errors, for example.
92
92
pub ( crate ) struct AcceptContext < ' a > {
93
- pub ( crate ) group_cx : & ' a FinalizeContext < ' a > ,
93
+ pub ( crate ) finalize_cx : & ' a FinalizeContext < ' a > ,
94
94
/// The span of the attribute currently being parsed
95
95
pub ( crate ) attr_span : Span ,
96
96
}
@@ -109,7 +109,7 @@ impl<'a> Deref for AcceptContext<'a> {
109
109
type Target = FinalizeContext < ' a > ;
110
110
111
111
fn deref ( & self ) -> & Self :: Target {
112
- & self . group_cx
112
+ & self . finalize_cx
113
113
}
114
114
}
115
115
@@ -219,7 +219,7 @@ impl<'sess> AttributeParser<'sess> {
219
219
) -> Vec < Attribute > {
220
220
let mut attributes = Vec :: new ( ) ;
221
221
222
- let group_cx = FinalizeContext { cx : self , target_span } ;
222
+ let finalize_cx = FinalizeContext { cx : self , target_span } ;
223
223
224
224
for attr in attrs {
225
225
// 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> {
268
268
let args = parser. args ( ) ;
269
269
let parts = path. segments ( ) . map ( |i| i. name ) . collect :: < Vec < _ > > ( ) ;
270
270
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
+ } ;
274
276
275
277
accept ( & cx, & args)
276
278
} else {
@@ -302,8 +304,8 @@ impl<'sess> AttributeParser<'sess> {
302
304
}
303
305
304
306
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 ) {
307
309
parsed_attributes. push ( Attribute :: Parsed ( attr) ) ;
308
310
}
309
311
}
0 commit comments