@@ -28,7 +28,7 @@ macro_rules! attribute_groups {
28
28
) => {
29
29
type Accepts = BTreeMap <
30
30
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| {
@@ -268,16 +269,12 @@ impl<'sess> AttributeParser<'sess> {
268
269
let parts = path. segments ( ) . map ( |i| i. name ) . collect :: < Vec < _ > > ( ) ;
269
270
270
271
if let [ part] = & parts[ ..]
271
- && let Some ( accepts ) = ATTRIBUTE_MAPPING . 0 . get ( part)
272
+ && let Some ( accept ) = ATTRIBUTE_MAPPING . 0 . get ( part)
272
273
{
273
- for f in accepts {
274
- let cx = AcceptContext {
275
- group_cx : & group_cx,
276
- attr_span : lower_span ( attr. span ) ,
277
- } ;
278
-
279
- f ( & cx, & args)
280
- }
274
+ let cx =
275
+ AcceptContext { group_cx : & group_cx, attr_span : lower_span ( attr. span ) } ;
276
+
277
+ accept ( & cx, & args)
281
278
} else {
282
279
// if we're here, we must be compiling a tool attribute... Or someone forgot to
283
280
// parse their fancy new attribute. Let's warn them in any case. If you are that
0 commit comments