@@ -28,7 +28,7 @@ macro_rules! attribute_groups {
28
28
) => {
29
29
type Accepts = BTreeMap <
30
30
& ' static [ Symbol ] ,
31
- Vec < Box <dyn Send + Sync + Fn ( & AcceptContext <' _>, & ArgParser <' _>) > >
31
+ Box <dyn Send + Sync + Fn ( & AcceptContext <' _>, & ArgParser <' _>) >
32
32
>;
33
33
type Finalizes = Vec <
34
34
Box <dyn Send + Sync + Fn ( & FinalizeContext <' _>) -> Option <AttributeKind >>
@@ -43,11 +43,12 @@ macro_rules! attribute_groups {
43
43
} ;
44
44
45
45
for ( k, v) in <$names>:: ATTRIBUTES {
46
- accepts. entry ( * k) . or_default ( ) . push ( Box :: new( |cx, args| {
46
+ let old = accepts. insert ( * k, Box :: new( |cx, args| {
47
47
STATE_OBJECT . with_borrow_mut( |s| {
48
48
v( s, cx, args)
49
49
} )
50
50
} ) ) ;
51
+ assert!( old. is_none( ) ) ;
51
52
}
52
53
53
54
finalizes. push( Box :: new( |cx| {
@@ -267,15 +268,11 @@ impl<'sess> AttributeParser<'sess> {
267
268
let ( path, args) = parser. deconstruct ( ) ;
268
269
let parts = path. segments ( ) . map ( |i| i. name ) . collect :: < Vec < _ > > ( ) ;
269
270
270
- if let Some ( accepts) = ATTRIBUTE_MAPPING . 0 . get ( parts. as_slice ( ) ) {
271
- for f in accepts {
272
- let cx = AcceptContext {
273
- group_cx : & group_cx,
274
- attr_span : lower_span ( attr. span ) ,
275
- } ;
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 ) } ;
276
274
277
- f ( & cx, & args)
278
- }
275
+ accept ( & cx, & args)
279
276
} else {
280
277
// if we're here, we must be compiling a tool attribute... Or someone forgot to
281
278
// parse their fancy new attribute. Let's warn them in any case. If you are that
0 commit comments