diff --git a/compiler/rustc_ast/src/ast.rs b/compiler/rustc_ast/src/ast.rs index 3a94f8248d886..cc030fd5b94bf 100644 --- a/compiler/rustc_ast/src/ast.rs +++ b/compiler/rustc_ast/src/ast.rs @@ -19,7 +19,7 @@ //! - [`UnOp`], [`BinOp`], and [`BinOpKind`]: Unary and binary operators. use std::borrow::Cow; -use std::{cmp, fmt, mem}; +use std::{cmp, fmt}; pub use GenericArgs::*; pub use UnsafeSource::*; @@ -1734,47 +1734,10 @@ pub enum AttrArgs { Eq { /// Span of the `=` token. eq_span: Span, - expr: P, }, } -// The RHS of an `AttrArgs::Eq` starts out as an expression. Once macro -// expansion is completed, all cases end up either as a meta item literal, -// which is the form used after lowering to HIR, or as an error. -#[derive(Clone, Encodable, Decodable, Debug)] -pub enum AttrArgsEq { - Ast(P), - Hir(MetaItemLit), -} - -impl AttrArgsEq { - pub fn span(&self) -> Span { - match self { - AttrArgsEq::Ast(p) => p.span, - AttrArgsEq::Hir(lit) => lit.span, - } - } - - pub fn unwrap_ast(&self) -> &Expr { - match self { - AttrArgsEq::Ast(p) => p, - AttrArgsEq::Hir(lit) => { - unreachable!("in literal form when getting inner tokens: {lit:?}") - } - } - } - - pub fn unwrap_ast_mut(&mut self) -> &mut P { - match self { - AttrArgsEq::Ast(p) => p, - AttrArgsEq::Hir(lit) => { - unreachable!("in literal form when getting inner tokens: {lit:?}") - } - } - } -} - impl AttrArgs { pub fn span(&self) -> Option { match self { @@ -1795,22 +1758,6 @@ impl AttrArgs { } } -impl HashStable for AttrArgs -where - CTX: crate::HashStableContext, -{ - fn hash_stable(&self, ctx: &mut CTX, hasher: &mut StableHasher) { - mem::discriminant(self).hash_stable(ctx, hasher); - match self { - AttrArgs::Empty => {} - AttrArgs::Delimited(args) => args.hash_stable(ctx, hasher), - AttrArgs::Eq { expr, .. } => { - unreachable!("hash_stable {:?}", expr); - } - } - } -} - /// Delimited arguments, as used in `#[attr()/[]/{}]` or `mac!()/[]/{}`. #[derive(Clone, Encodable, Decodable, Debug)] pub struct DelimArgs { @@ -3003,7 +2950,7 @@ impl NormalAttr { } } -#[derive(Clone, Encodable, Decodable, Debug, HashStable_Generic)] +#[derive(Clone, Encodable, Decodable, Debug)] pub struct AttrItem { pub unsafety: Safety, pub path: Path,