19
19
//! - [`UnOp`], [`BinOp`], and [`BinOpKind`]: Unary and binary operators.
20
20
21
21
use std:: borrow:: Cow ;
22
- use std:: { cmp, fmt, mem } ;
22
+ use std:: { cmp, fmt} ;
23
23
24
24
pub use GenericArgs :: * ;
25
25
pub use UnsafeSource :: * ;
@@ -1758,47 +1758,10 @@ pub enum AttrArgs {
1758
1758
Eq {
1759
1759
/// Span of the `=` token.
1760
1760
eq_span : Span ,
1761
-
1762
1761
expr : P < Expr > ,
1763
1762
} ,
1764
1763
}
1765
1764
1766
- // The RHS of an `AttrArgs::Eq` starts out as an expression. Once macro
1767
- // expansion is completed, all cases end up either as a meta item literal,
1768
- // which is the form used after lowering to HIR, or as an error.
1769
- #[ derive( Clone , Encodable , Decodable , Debug ) ]
1770
- pub enum AttrArgsEq {
1771
- Ast ( P < Expr > ) ,
1772
- Hir ( MetaItemLit ) ,
1773
- }
1774
-
1775
- impl AttrArgsEq {
1776
- pub fn span ( & self ) -> Span {
1777
- match self {
1778
- AttrArgsEq :: Ast ( p) => p. span ,
1779
- AttrArgsEq :: Hir ( lit) => lit. span ,
1780
- }
1781
- }
1782
-
1783
- pub fn unwrap_ast ( & self ) -> & Expr {
1784
- match self {
1785
- AttrArgsEq :: Ast ( p) => p,
1786
- AttrArgsEq :: Hir ( lit) => {
1787
- unreachable ! ( "in literal form when getting inner tokens: {lit:?}" )
1788
- }
1789
- }
1790
- }
1791
-
1792
- pub fn unwrap_ast_mut ( & mut self ) -> & mut P < Expr > {
1793
- match self {
1794
- AttrArgsEq :: Ast ( p) => p,
1795
- AttrArgsEq :: Hir ( lit) => {
1796
- unreachable ! ( "in literal form when getting inner tokens: {lit:?}" )
1797
- }
1798
- }
1799
- }
1800
- }
1801
-
1802
1765
impl AttrArgs {
1803
1766
pub fn span ( & self ) -> Option < Span > {
1804
1767
match self {
@@ -1819,22 +1782,6 @@ impl AttrArgs {
1819
1782
}
1820
1783
}
1821
1784
1822
- impl < CTX > HashStable < CTX > for AttrArgs
1823
- where
1824
- CTX : crate :: HashStableContext ,
1825
- {
1826
- fn hash_stable ( & self , ctx : & mut CTX , hasher : & mut StableHasher ) {
1827
- mem:: discriminant ( self ) . hash_stable ( ctx, hasher) ;
1828
- match self {
1829
- AttrArgs :: Empty => { }
1830
- AttrArgs :: Delimited ( args) => args. hash_stable ( ctx, hasher) ,
1831
- AttrArgs :: Eq { expr, .. } => {
1832
- unreachable ! ( "hash_stable {:?}" , expr) ;
1833
- }
1834
- }
1835
- }
1836
- }
1837
-
1838
1785
/// Delimited arguments, as used in `#[attr()/[]/{}]` or `mac!()/[]/{}`.
1839
1786
#[ derive( Clone , Encodable , Decodable , Debug ) ]
1840
1787
pub struct DelimArgs {
@@ -3047,7 +2994,7 @@ impl NormalAttr {
3047
2994
}
3048
2995
}
3049
2996
3050
- #[ derive( Clone , Encodable , Decodable , Debug , HashStable_Generic ) ]
2997
+ #[ derive( Clone , Encodable , Decodable , Debug ) ]
3051
2998
pub struct AttrItem {
3052
2999
pub unsafety : Safety ,
3053
3000
pub path : Path ,
0 commit comments