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 :: * ;
@@ -1734,47 +1734,10 @@ pub enum AttrArgs {
17341734 Eq {
17351735 /// Span of the `=` token.
17361736 eq_span : Span ,
1737-
17381737 expr : P < Expr > ,
17391738 } ,
17401739}
17411740
1742- // The RHS of an `AttrArgs::Eq` starts out as an expression. Once macro
1743- // expansion is completed, all cases end up either as a meta item literal,
1744- // which is the form used after lowering to HIR, or as an error.
1745- #[ derive( Clone , Encodable , Decodable , Debug ) ]
1746- pub enum AttrArgsEq {
1747- Ast ( P < Expr > ) ,
1748- Hir ( MetaItemLit ) ,
1749- }
1750-
1751- impl AttrArgsEq {
1752- pub fn span ( & self ) -> Span {
1753- match self {
1754- AttrArgsEq :: Ast ( p) => p. span ,
1755- AttrArgsEq :: Hir ( lit) => lit. span ,
1756- }
1757- }
1758-
1759- pub fn unwrap_ast ( & self ) -> & Expr {
1760- match self {
1761- AttrArgsEq :: Ast ( p) => p,
1762- AttrArgsEq :: Hir ( lit) => {
1763- unreachable ! ( "in literal form when getting inner tokens: {lit:?}" )
1764- }
1765- }
1766- }
1767-
1768- pub fn unwrap_ast_mut ( & mut self ) -> & mut P < Expr > {
1769- match self {
1770- AttrArgsEq :: Ast ( p) => p,
1771- AttrArgsEq :: Hir ( lit) => {
1772- unreachable ! ( "in literal form when getting inner tokens: {lit:?}" )
1773- }
1774- }
1775- }
1776- }
1777-
17781741impl AttrArgs {
17791742 pub fn span ( & self ) -> Option < Span > {
17801743 match self {
@@ -1795,22 +1758,6 @@ impl AttrArgs {
17951758 }
17961759}
17971760
1798- impl < CTX > HashStable < CTX > for AttrArgs
1799- where
1800- CTX : crate :: HashStableContext ,
1801- {
1802- fn hash_stable ( & self , ctx : & mut CTX , hasher : & mut StableHasher ) {
1803- mem:: discriminant ( self ) . hash_stable ( ctx, hasher) ;
1804- match self {
1805- AttrArgs :: Empty => { }
1806- AttrArgs :: Delimited ( args) => args. hash_stable ( ctx, hasher) ,
1807- AttrArgs :: Eq { expr, .. } => {
1808- unreachable ! ( "hash_stable {:?}" , expr) ;
1809- }
1810- }
1811- }
1812- }
1813-
18141761/// Delimited arguments, as used in `#[attr()/[]/{}]` or `mac!()/[]/{}`.
18151762#[ derive( Clone , Encodable , Decodable , Debug ) ]
18161763pub struct DelimArgs {
@@ -3003,7 +2950,7 @@ impl NormalAttr {
30032950 }
30042951}
30052952
3006- #[ derive( Clone , Encodable , Decodable , Debug , HashStable_Generic ) ]
2953+ #[ derive( Clone , Encodable , Decodable , Debug ) ]
30072954pub struct AttrItem {
30082955 pub unsafety : Safety ,
30092956 pub path : Path ,
0 commit comments