1
- use std:: ops:: Deref ;
2
1
use std:: path:: PathBuf ;
3
2
use std:: rc:: Rc ;
4
3
use std:: sync:: Arc ;
@@ -1117,7 +1116,6 @@ enum AddSemicolon {
1117
1116
/// of functionality used by `InvocationCollector`.
1118
1117
trait InvocationCollectorNode : HasAttrs + HasNodeId + Sized {
1119
1118
type OutputTy = SmallVec < [ Self ; 1 ] > ;
1120
- type AttrsTy : Deref < Target = [ ast:: Attribute ] > = ast:: AttrVec ;
1121
1119
type ItemKind = ItemKind ;
1122
1120
const KIND : AstFragmentKind ;
1123
1121
fn to_annotatable ( self ) -> Annotatable ;
@@ -1134,7 +1132,7 @@ trait InvocationCollectorNode: HasAttrs + HasNodeId + Sized {
1134
1132
fn is_mac_call ( & self ) -> bool {
1135
1133
false
1136
1134
}
1137
- fn take_mac_call ( self ) -> ( P < ast:: MacCall > , Self :: AttrsTy , AddSemicolon ) {
1135
+ fn take_mac_call ( self ) -> ( P < ast:: MacCall > , ast :: AttrVec , AddSemicolon ) {
1138
1136
unreachable ! ( )
1139
1137
}
1140
1138
fn delegation ( & self ) -> Option < ( & ast:: DelegationMac , & ast:: Item < Self :: ItemKind > ) > {
@@ -1189,7 +1187,7 @@ impl InvocationCollectorNode for P<ast::Item> {
1189
1187
fn is_mac_call ( & self ) -> bool {
1190
1188
matches ! ( self . kind, ItemKind :: MacCall ( ..) )
1191
1189
}
1192
- fn take_mac_call ( self ) -> ( P < ast:: MacCall > , Self :: AttrsTy , AddSemicolon ) {
1190
+ fn take_mac_call ( self ) -> ( P < ast:: MacCall > , ast :: AttrVec , AddSemicolon ) {
1193
1191
let node = self . into_inner ( ) ;
1194
1192
match node. kind {
1195
1193
ItemKind :: MacCall ( mac) => ( mac, node. attrs , AddSemicolon :: No ) ,
@@ -1345,7 +1343,7 @@ impl InvocationCollectorNode for AstNodeWrapper<P<ast::AssocItem>, TraitItemTag>
1345
1343
fn is_mac_call ( & self ) -> bool {
1346
1344
matches ! ( self . wrapped. kind, AssocItemKind :: MacCall ( ..) )
1347
1345
}
1348
- fn take_mac_call ( self ) -> ( P < ast:: MacCall > , Self :: AttrsTy , AddSemicolon ) {
1346
+ fn take_mac_call ( self ) -> ( P < ast:: MacCall > , ast :: AttrVec , AddSemicolon ) {
1349
1347
let item = self . wrapped . into_inner ( ) ;
1350
1348
match item. kind {
1351
1349
AssocItemKind :: MacCall ( mac) => ( mac, item. attrs , AddSemicolon :: No ) ,
@@ -1386,7 +1384,7 @@ impl InvocationCollectorNode for AstNodeWrapper<P<ast::AssocItem>, ImplItemTag>
1386
1384
fn is_mac_call ( & self ) -> bool {
1387
1385
matches ! ( self . wrapped. kind, AssocItemKind :: MacCall ( ..) )
1388
1386
}
1389
- fn take_mac_call ( self ) -> ( P < ast:: MacCall > , Self :: AttrsTy , AddSemicolon ) {
1387
+ fn take_mac_call ( self ) -> ( P < ast:: MacCall > , ast :: AttrVec , AddSemicolon ) {
1390
1388
let item = self . wrapped . into_inner ( ) ;
1391
1389
match item. kind {
1392
1390
AssocItemKind :: MacCall ( mac) => ( mac, item. attrs , AddSemicolon :: No ) ,
@@ -1427,7 +1425,7 @@ impl InvocationCollectorNode for AstNodeWrapper<P<ast::AssocItem>, TraitImplItem
1427
1425
fn is_mac_call ( & self ) -> bool {
1428
1426
matches ! ( self . wrapped. kind, AssocItemKind :: MacCall ( ..) )
1429
1427
}
1430
- fn take_mac_call ( self ) -> ( P < ast:: MacCall > , Self :: AttrsTy , AddSemicolon ) {
1428
+ fn take_mac_call ( self ) -> ( P < ast:: MacCall > , ast :: AttrVec , AddSemicolon ) {
1431
1429
let item = self . wrapped . into_inner ( ) ;
1432
1430
match item. kind {
1433
1431
AssocItemKind :: MacCall ( mac) => ( mac, item. attrs , AddSemicolon :: No ) ,
@@ -1465,7 +1463,7 @@ impl InvocationCollectorNode for P<ast::ForeignItem> {
1465
1463
fn is_mac_call ( & self ) -> bool {
1466
1464
matches ! ( self . kind, ForeignItemKind :: MacCall ( ..) )
1467
1465
}
1468
- fn take_mac_call ( self ) -> ( P < ast:: MacCall > , Self :: AttrsTy , AddSemicolon ) {
1466
+ fn take_mac_call ( self ) -> ( P < ast:: MacCall > , ast :: AttrVec , AddSemicolon ) {
1469
1467
let node = self . into_inner ( ) ;
1470
1468
match node. kind {
1471
1469
ForeignItemKind :: MacCall ( mac) => ( mac, node. attrs , AddSemicolon :: No ) ,
@@ -1579,7 +1577,6 @@ impl InvocationCollectorNode for ast::Arm {
1579
1577
}
1580
1578
1581
1579
impl InvocationCollectorNode for ast:: Stmt {
1582
- type AttrsTy = ast:: AttrVec ;
1583
1580
const KIND : AstFragmentKind = AstFragmentKind :: Stmts ;
1584
1581
fn to_annotatable ( self ) -> Annotatable {
1585
1582
Annotatable :: Stmt ( P ( self ) )
@@ -1599,7 +1596,7 @@ impl InvocationCollectorNode for ast::Stmt {
1599
1596
StmtKind :: Let ( ..) | StmtKind :: Empty => false ,
1600
1597
}
1601
1598
}
1602
- fn take_mac_call ( self ) -> ( P < ast:: MacCall > , Self :: AttrsTy , AddSemicolon ) {
1599
+ fn take_mac_call ( self ) -> ( P < ast:: MacCall > , ast :: AttrVec , AddSemicolon ) {
1603
1600
// We pull macro invocations (both attributes and fn-like macro calls) out of their
1604
1601
// `StmtKind`s and treat them as statement macro invocations, not as items or expressions.
1605
1602
let ( add_semicolon, mac, attrs) = match self . kind {
@@ -1693,7 +1690,7 @@ impl InvocationCollectorNode for P<ast::Ty> {
1693
1690
fn is_mac_call ( & self ) -> bool {
1694
1691
matches ! ( self . kind, ast:: TyKind :: MacCall ( ..) )
1695
1692
}
1696
- fn take_mac_call ( self ) -> ( P < ast:: MacCall > , Self :: AttrsTy , AddSemicolon ) {
1693
+ fn take_mac_call ( self ) -> ( P < ast:: MacCall > , ast :: AttrVec , AddSemicolon ) {
1697
1694
let node = self . into_inner ( ) ;
1698
1695
match node. kind {
1699
1696
TyKind :: MacCall ( mac) => ( mac, AttrVec :: new ( ) , AddSemicolon :: No ) ,
@@ -1717,7 +1714,7 @@ impl InvocationCollectorNode for P<ast::Pat> {
1717
1714
fn is_mac_call ( & self ) -> bool {
1718
1715
matches ! ( self . kind, PatKind :: MacCall ( ..) )
1719
1716
}
1720
- fn take_mac_call ( self ) -> ( P < ast:: MacCall > , Self :: AttrsTy , AddSemicolon ) {
1717
+ fn take_mac_call ( self ) -> ( P < ast:: MacCall > , ast :: AttrVec , AddSemicolon ) {
1721
1718
let node = self . into_inner ( ) ;
1722
1719
match node. kind {
1723
1720
PatKind :: MacCall ( mac) => ( mac, AttrVec :: new ( ) , AddSemicolon :: No ) ,
@@ -1728,7 +1725,6 @@ impl InvocationCollectorNode for P<ast::Pat> {
1728
1725
1729
1726
impl InvocationCollectorNode for P < ast:: Expr > {
1730
1727
type OutputTy = P < ast:: Expr > ;
1731
- type AttrsTy = ast:: AttrVec ;
1732
1728
const KIND : AstFragmentKind = AstFragmentKind :: Expr ;
1733
1729
fn to_annotatable ( self ) -> Annotatable {
1734
1730
Annotatable :: Expr ( self )
@@ -1745,7 +1741,7 @@ impl InvocationCollectorNode for P<ast::Expr> {
1745
1741
fn is_mac_call ( & self ) -> bool {
1746
1742
matches ! ( self . kind, ExprKind :: MacCall ( ..) )
1747
1743
}
1748
- fn take_mac_call ( self ) -> ( P < ast:: MacCall > , Self :: AttrsTy , AddSemicolon ) {
1744
+ fn take_mac_call ( self ) -> ( P < ast:: MacCall > , ast :: AttrVec , AddSemicolon ) {
1749
1745
let node = self . into_inner ( ) ;
1750
1746
match node. kind {
1751
1747
ExprKind :: MacCall ( mac) => ( mac, node. attrs , AddSemicolon :: No ) ,
@@ -1757,7 +1753,6 @@ impl InvocationCollectorNode for P<ast::Expr> {
1757
1753
struct OptExprTag ;
1758
1754
impl InvocationCollectorNode for AstNodeWrapper < P < ast:: Expr > , OptExprTag > {
1759
1755
type OutputTy = Option < P < ast:: Expr > > ;
1760
- type AttrsTy = ast:: AttrVec ;
1761
1756
const KIND : AstFragmentKind = AstFragmentKind :: OptExpr ;
1762
1757
fn to_annotatable ( self ) -> Annotatable {
1763
1758
Annotatable :: Expr ( self . wrapped )
@@ -1772,7 +1767,7 @@ impl InvocationCollectorNode for AstNodeWrapper<P<ast::Expr>, OptExprTag> {
1772
1767
fn is_mac_call ( & self ) -> bool {
1773
1768
matches ! ( self . wrapped. kind, ast:: ExprKind :: MacCall ( ..) )
1774
1769
}
1775
- fn take_mac_call ( self ) -> ( P < ast:: MacCall > , Self :: AttrsTy , AddSemicolon ) {
1770
+ fn take_mac_call ( self ) -> ( P < ast:: MacCall > , ast :: AttrVec , AddSemicolon ) {
1776
1771
let node = self . wrapped . into_inner ( ) ;
1777
1772
match node. kind {
1778
1773
ExprKind :: MacCall ( mac) => ( mac, node. attrs , AddSemicolon :: No ) ,
@@ -1794,7 +1789,6 @@ impl DummyAstNode for MethodReceiverTag {
1794
1789
}
1795
1790
impl InvocationCollectorNode for AstNodeWrapper < P < ast:: Expr > , MethodReceiverTag > {
1796
1791
type OutputTy = Self ;
1797
- type AttrsTy = ast:: AttrVec ;
1798
1792
const KIND : AstFragmentKind = AstFragmentKind :: MethodReceiverExpr ;
1799
1793
fn descr ( ) -> & ' static str {
1800
1794
"an expression"
@@ -1811,7 +1805,7 @@ impl InvocationCollectorNode for AstNodeWrapper<P<ast::Expr>, MethodReceiverTag>
1811
1805
fn is_mac_call ( & self ) -> bool {
1812
1806
matches ! ( self . wrapped. kind, ast:: ExprKind :: MacCall ( ..) )
1813
1807
}
1814
- fn take_mac_call ( self ) -> ( P < ast:: MacCall > , Self :: AttrsTy , AddSemicolon ) {
1808
+ fn take_mac_call ( self ) -> ( P < ast:: MacCall > , ast :: AttrVec , AddSemicolon ) {
1815
1809
let node = self . wrapped . into_inner ( ) ;
1816
1810
match node. kind {
1817
1811
ExprKind :: MacCall ( mac) => ( mac, node. attrs , AddSemicolon :: No ) ,
0 commit comments