@@ -636,9 +636,9 @@ macro_rules! with_exts_frame {
636
636
// When we enter a module, record it, for the sake of `module!`
637
637
pub fn expand_item ( it : P < ast:: Item > , fld : & mut MacroExpander )
638
638
-> SmallVector < P < ast:: Item > > {
639
- let it = expand_item_modifiers ( it , fld) ;
639
+ let it = expand_item_multi_modifier ( Annotatable :: Item ( it ) , fld) ;
640
640
641
- expand_annotatable ( Annotatable :: Item ( it ) , fld)
641
+ expand_annotatable ( it , fld)
642
642
. into_iter ( ) . map ( |i| i. expect_item ( ) ) . collect ( )
643
643
}
644
644
@@ -1275,11 +1275,9 @@ macro_rules! partition {
1275
1275
}
1276
1276
}
1277
1277
1278
- partition ! ( modifiers, Modifier ) ;
1279
1278
partition ! ( multi_modifiers, MultiModifier ) ;
1280
1279
1281
1280
1282
- #[ allow( deprecated) ] // The `allow` is needed because the `Decorator` variant is used.
1283
1281
fn expand_decorators ( a : Annotatable ,
1284
1282
fld : & mut MacroExpander ,
1285
1283
decorator_items : & mut SmallVector < Annotatable > ,
@@ -1289,33 +1287,6 @@ fn expand_decorators(a: Annotatable,
1289
1287
let mname = intern ( & attr. name ( ) ) ;
1290
1288
match fld. cx . syntax_env . find ( & mname) {
1291
1289
Some ( rc) => match * rc {
1292
- Decorator ( ref dec) => {
1293
- attr:: mark_used ( & attr) ;
1294
-
1295
- fld. cx . bt_push ( ExpnInfo {
1296
- call_site : attr. span ,
1297
- callee : NameAndSpan {
1298
- format : MacroAttribute ( mname) ,
1299
- span : Some ( attr. span ) ,
1300
- // attributes can do whatever they like,
1301
- // for now.
1302
- allow_internal_unstable : true ,
1303
- }
1304
- } ) ;
1305
-
1306
- // we'd ideally decorator_items.push_all(expand_item(item, fld)),
1307
- // but that double-mut-borrows fld
1308
- let mut items: SmallVector < Annotatable > = SmallVector :: zero ( ) ;
1309
- dec. expand ( fld. cx ,
1310
- attr. span ,
1311
- & attr. node . value ,
1312
- & a. clone ( ) . expect_item ( ) ,
1313
- & mut |item| items. push ( Annotatable :: Item ( item) ) ) ;
1314
- decorator_items. extend ( items. into_iter ( )
1315
- . flat_map ( |ann| expand_annotatable ( ann, fld) . into_iter ( ) ) ) ;
1316
-
1317
- fld. cx . bt_pop ( ) ;
1318
- }
1319
1290
MultiDecorator ( ref dec) => {
1320
1291
attr:: mark_used ( & attr) ;
1321
1292
@@ -1392,58 +1363,6 @@ fn expand_item_multi_modifier(mut it: Annotatable,
1392
1363
expand_item_multi_modifier ( it, fld)
1393
1364
}
1394
1365
1395
- #[ allow( deprecated) ] // This is needed because the `ItemModifier` trait is used
1396
- fn expand_item_modifiers ( mut it : P < ast:: Item > ,
1397
- fld : & mut MacroExpander )
1398
- -> P < ast:: Item > {
1399
- // partition the attributes into ItemModifiers and others
1400
- let ( modifiers, other_attrs) = modifiers ( & it. attrs , fld) ;
1401
-
1402
- // update the attrs, leave everything else alone. Is this mutation really a good idea?
1403
- it = P ( ast:: Item {
1404
- attrs : other_attrs,
1405
- ..( * it) . clone ( )
1406
- } ) ;
1407
-
1408
- if modifiers. is_empty ( ) {
1409
- let it = expand_item_multi_modifier ( Annotatable :: Item ( it) , fld) ;
1410
- return it. expect_item ( ) ;
1411
- }
1412
-
1413
- for attr in & modifiers {
1414
- let mname = intern ( & attr. name ( ) ) ;
1415
-
1416
- match fld. cx . syntax_env . find ( & mname) {
1417
- Some ( rc) => match * rc {
1418
- Modifier ( ref mac) => {
1419
- attr:: mark_used ( attr) ;
1420
- fld. cx . bt_push ( ExpnInfo {
1421
- call_site : attr. span ,
1422
- callee : NameAndSpan {
1423
- format : MacroAttribute ( mname) ,
1424
- span : Some ( attr. span ) ,
1425
- // attributes can do whatever they like,
1426
- // for now
1427
- allow_internal_unstable : true ,
1428
- }
1429
- } ) ;
1430
- it = mac. expand ( fld. cx , attr. span , & * attr. node . value , it) ;
1431
- fld. cx . bt_pop ( ) ;
1432
- }
1433
- _ => unreachable ! ( )
1434
- } ,
1435
- _ => unreachable ! ( )
1436
- }
1437
- }
1438
-
1439
- // Expansion may have added new ItemModifiers.
1440
- // It is possible, that an item modifier could expand to a multi-modifier or
1441
- // vice versa. In this case we will expand all modifiers before multi-modifiers,
1442
- // which might give an odd ordering. However, I think it is unlikely that the
1443
- // two kinds will be mixed, and old-style multi-modifiers are deprecated.
1444
- expand_item_modifiers ( it, fld)
1445
- }
1446
-
1447
1366
fn expand_impl_item ( ii : P < ast:: ImplItem > , fld : & mut MacroExpander )
1448
1367
-> SmallVector < P < ast:: ImplItem > > {
1449
1368
match ii. node {
0 commit comments