@@ -636,9 +636,9 @@ macro_rules! with_exts_frame {
636636// When we enter a module, record it, for the sake of `module!`
637637pub fn expand_item ( it : P < ast:: Item > , fld : & mut MacroExpander )
638638 -> SmallVector < P < ast:: Item > > {
639- let it = expand_item_modifiers ( it , fld) ;
639+ let it = expand_item_multi_modifier ( Annotatable :: Item ( it ) , fld) ;
640640
641- expand_annotatable ( Annotatable :: Item ( it ) , fld)
641+ expand_annotatable ( it , fld)
642642 . into_iter ( ) . map ( |i| i. expect_item ( ) ) . collect ( )
643643}
644644
@@ -1275,11 +1275,9 @@ macro_rules! partition {
12751275 }
12761276}
12771277
1278- partition ! ( modifiers, Modifier ) ;
12791278partition ! ( multi_modifiers, MultiModifier ) ;
12801279
12811280
1282- #[ allow( deprecated) ] // The `allow` is needed because the `Decorator` variant is used.
12831281fn expand_decorators ( a : Annotatable ,
12841282 fld : & mut MacroExpander ,
12851283 decorator_items : & mut SmallVector < Annotatable > ,
@@ -1289,33 +1287,6 @@ fn expand_decorators(a: Annotatable,
12891287 let mname = intern ( & attr. name ( ) ) ;
12901288 match fld. cx . syntax_env . find ( & mname) {
12911289 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- }
13191290 MultiDecorator ( ref dec) => {
13201291 attr:: mark_used ( & attr) ;
13211292
@@ -1392,58 +1363,6 @@ fn expand_item_multi_modifier(mut it: Annotatable,
13921363 expand_item_multi_modifier ( it, fld)
13931364}
13941365
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-
14471366fn expand_impl_item ( ii : P < ast:: ImplItem > , fld : & mut MacroExpander )
14481367 -> SmallVector < P < ast:: ImplItem > > {
14491368 match ii. node {
0 commit comments