diff options
| -rw-r--r-- | src/librustc/hir/lowering/item.rs | 9 | ||||
| -rw-r--r-- | src/librustc_resolve/lib.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/expand/mod.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax_ext/deriving/cmp/eq.rs | 3 | ||||
| -rw-r--r-- | src/libsyntax_ext/deriving/cmp/partial_eq.rs | 3 |
5 files changed, 1 insertions, 18 deletions
diff --git a/src/librustc/hir/lowering/item.rs b/src/librustc/hir/lowering/item.rs index 9da87090c79..f1b999cdd6f 100644 --- a/src/librustc/hir/lowering/item.rs +++ b/src/librustc/hir/lowering/item.rs @@ -18,7 +18,6 @@ use smallvec::SmallVec; use syntax::attr; use syntax::ast::*; use syntax::visit::{self, Visitor}; -use syntax::expand::SpecialDerives; use syntax::source_map::{respan, DesugaringKind, Spanned}; use syntax::symbol::{kw, sym}; use syntax_pos::Span; @@ -227,13 +226,7 @@ impl LoweringContext<'_> { pub fn lower_item(&mut self, i: &Item) -> Option<hir::Item> { let mut ident = i.ident; let mut vis = self.lower_visibility(&i.vis, None); - let mut attrs = self.lower_attrs_extendable(&i.attrs); - if self.resolver.has_derives(i.id, SpecialDerives::PARTIAL_EQ | SpecialDerives::EQ) { - // Add `#[structural_match]` if the item derived both `PartialEq` and `Eq`. - let ident = Ident::new(sym::structural_match, i.span); - attrs.push(attr::mk_attr_outer(attr::mk_word_item(ident))); - } - let attrs = attrs.into(); + let attrs = self.lower_attrs(&i.attrs); if let ItemKind::MacroDef(ref def) = i.kind { if !def.legacy || attr::contains_name(&i.attrs, sym::macro_export) { diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index b45eb356bdb..ca450544558 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -937,8 +937,6 @@ pub struct Resolver<'a> { /// Some built-in derives mark items they are applied to so they are treated specially later. /// Derive macros cannot modify the item themselves and have to store the markers in the global /// context, so they attach the markers to derive container IDs using this resolver table. - /// FIXME: Find a way for `PartialEq` and `Eq` to emulate `#[structural_match]` - /// by marking the produced impls rather than the original items. special_derives: FxHashMap<ExpnId, SpecialDerives>, /// Parent scopes in which the macros were invoked. /// FIXME: `derives` are missing in these parent scopes and need to be taken from elsewhere. diff --git a/src/libsyntax/expand/mod.rs b/src/libsyntax/expand/mod.rs index 038f60287be..35729508197 100644 --- a/src/libsyntax/expand/mod.rs +++ b/src/libsyntax/expand/mod.rs @@ -9,8 +9,6 @@ bitflags::bitflags! { /// Built-in derives that need some extra tracking beyond the usual macro functionality. #[derive(Default)] pub struct SpecialDerives: u8 { - const PARTIAL_EQ = 1 << 0; - const EQ = 1 << 1; const COPY = 1 << 2; } } diff --git a/src/libsyntax_ext/deriving/cmp/eq.rs b/src/libsyntax_ext/deriving/cmp/eq.rs index eddf8eea1db..41189de7fa2 100644 --- a/src/libsyntax_ext/deriving/cmp/eq.rs +++ b/src/libsyntax_ext/deriving/cmp/eq.rs @@ -3,7 +3,6 @@ use crate::deriving::generic::*; use crate::deriving::generic::ty::*; use syntax::ast::{self, Ident, Expr, MetaItem, GenericArg}; -use syntax::expand::SpecialDerives; use syntax::ptr::P; use syntax::symbol::{sym, Symbol}; use syntax_expand::base::{Annotatable, ExtCtxt}; @@ -14,8 +13,6 @@ pub fn expand_deriving_eq(cx: &mut ExtCtxt<'_>, mitem: &MetaItem, item: &Annotatable, push: &mut dyn FnMut(Annotatable)) { - cx.resolver.add_derives(cx.current_expansion.id.expn_data().parent, SpecialDerives::EQ); - let inline = cx.meta_word(span, sym::inline); let hidden = syntax::attr::mk_nested_word_item(Ident::new(sym::hidden, span)); let doc = syntax::attr::mk_list_item(Ident::new(sym::doc, span), vec![hidden]); diff --git a/src/libsyntax_ext/deriving/cmp/partial_eq.rs b/src/libsyntax_ext/deriving/cmp/partial_eq.rs index 2e2be91de8a..19562e350dd 100644 --- a/src/libsyntax_ext/deriving/cmp/partial_eq.rs +++ b/src/libsyntax_ext/deriving/cmp/partial_eq.rs @@ -3,7 +3,6 @@ use crate::deriving::generic::*; use crate::deriving::generic::ty::*; use syntax::ast::{BinOpKind, Expr, MetaItem}; -use syntax::expand::SpecialDerives; use syntax::ptr::P; use syntax::symbol::sym; use syntax_expand::base::{Annotatable, ExtCtxt}; @@ -14,8 +13,6 @@ pub fn expand_deriving_partial_eq(cx: &mut ExtCtxt<'_>, mitem: &MetaItem, item: &Annotatable, push: &mut dyn FnMut(Annotatable)) { - cx.resolver.add_derives(cx.current_expansion.id.expn_data().parent, SpecialDerives::PARTIAL_EQ); - // structures are equal if all fields are equal, and non equal, if // any fields are not equal or if the enum variants are different fn cs_op(cx: &mut ExtCtxt<'_>, |
