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 :: * ;
@@ -1758,47 +1758,10 @@ pub enum AttrArgs {
17581758 Eq {
17591759 /// Span of the `=` token.
17601760 eq_span : Span ,
1761-
17621761 expr : P < Expr > ,
17631762 } ,
17641763}
17651764
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-
18021765impl AttrArgs {
18031766 pub fn span ( & self ) -> Option < Span > {
18041767 match self {
@@ -1819,22 +1782,6 @@ impl AttrArgs {
18191782 }
18201783}
18211784
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-
18381785/// Delimited arguments, as used in `#[attr()/[]/{}]` or `mac!()/[]/{}`.
18391786#[ derive( Clone , Encodable , Decodable , Debug ) ]
18401787pub struct DelimArgs {
@@ -3047,7 +2994,7 @@ impl NormalAttr {
30472994 }
30482995}
30492996
3050- #[ derive( Clone , Encodable , Decodable , Debug , HashStable_Generic ) ]
2997+ #[ derive( Clone , Encodable , Decodable , Debug ) ]
30512998pub struct AttrItem {
30522999 pub unsafety : Safety ,
30533000 pub path : Path ,
0 commit comments