1919//! - [`UnOp`], [`BinOp`], and [`BinOpKind`]: Unary and binary operators.
2020
2121use std:: borrow:: Cow ;
22- use std:: { cmp, fmt, mem } ;
22+ use std:: { cmp, fmt} ;
2323
2424pub use GenericArgs :: * ;
2525pub use UnsafeSource :: * ;
@@ -1739,47 +1739,10 @@ pub enum AttrArgs {
17391739 Eq {
17401740 /// Span of the `=` token.
17411741 eq_span : Span ,
1742-
17431742 expr : P < Expr > ,
17441743 } ,
17451744}
17461745
1747- // The RHS of an `AttrArgs::Eq` starts out as an expression. Once macro
1748- // expansion is completed, all cases end up either as a meta item literal,
1749- // which is the form used after lowering to HIR, or as an error.
1750- #[ derive( Clone , Encodable , Decodable , Debug ) ]
1751- pub enum AttrArgsEq {
1752- Ast ( P < Expr > ) ,
1753- Hir ( MetaItemLit ) ,
1754- }
1755-
1756- impl AttrArgsEq {
1757- pub fn span ( & self ) -> Span {
1758- match self {
1759- AttrArgsEq :: Ast ( p) => p. span ,
1760- AttrArgsEq :: Hir ( lit) => lit. span ,
1761- }
1762- }
1763-
1764- pub fn unwrap_ast ( & self ) -> & Expr {
1765- match self {
1766- AttrArgsEq :: Ast ( p) => p,
1767- AttrArgsEq :: Hir ( lit) => {
1768- unreachable ! ( "in literal form when getting inner tokens: {lit:?}" )
1769- }
1770- }
1771- }
1772-
1773- pub fn unwrap_ast_mut ( & mut self ) -> & mut P < Expr > {
1774- match self {
1775- AttrArgsEq :: Ast ( p) => p,
1776- AttrArgsEq :: Hir ( lit) => {
1777- unreachable ! ( "in literal form when getting inner tokens: {lit:?}" )
1778- }
1779- }
1780- }
1781- }
1782-
17831746impl AttrArgs {
17841747 pub fn span ( & self ) -> Option < Span > {
17851748 match self {
@@ -1800,22 +1763,6 @@ impl AttrArgs {
18001763 }
18011764}
18021765
1803- impl < CTX > HashStable < CTX > for AttrArgs
1804- where
1805- CTX : crate :: HashStableContext ,
1806- {
1807- fn hash_stable ( & self , ctx : & mut CTX , hasher : & mut StableHasher ) {
1808- mem:: discriminant ( self ) . hash_stable ( ctx, hasher) ;
1809- match self {
1810- AttrArgs :: Empty => { }
1811- AttrArgs :: Delimited ( args) => args. hash_stable ( ctx, hasher) ,
1812- AttrArgs :: Eq { expr, .. } => {
1813- unreachable ! ( "hash_stable {:?}" , expr) ;
1814- }
1815- }
1816- }
1817- }
1818-
18191766/// Delimited arguments, as used in `#[attr()/[]/{}]` or `mac!()/[]/{}`.
18201767#[ derive( Clone , Encodable , Decodable , Debug ) ]
18211768pub struct DelimArgs {
@@ -3020,7 +2967,7 @@ impl NormalAttr {
30202967 }
30212968}
30222969
3023- #[ derive( Clone , Encodable , Decodable , Debug , HashStable_Generic ) ]
2970+ #[ derive( Clone , Encodable , Decodable , Debug ) ]
30242971pub struct AttrItem {
30252972 pub unsafety : Safety ,
30262973 pub path : Path ,
0 commit comments