From 3fcdd1bcdf8a93769f74b7b4ca5ba043ad316e46 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Thu, 8 Apr 2021 19:44:21 +0200 Subject: Add `AttrId` to track attribute sources --- crates/hir_expand/src/lib.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'crates/hir_expand/src/lib.rs') diff --git a/crates/hir_expand/src/lib.rs b/crates/hir_expand/src/lib.rs index a179102f0..8637abc6a 100644 --- a/crates/hir_expand/src/lib.rs +++ b/crates/hir_expand/src/lib.rs @@ -294,6 +294,9 @@ pub enum MacroCallKind { Derive { ast_id: AstId, derive_name: String }, } +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] +pub struct AttrId(pub u32); + impl MacroCallKind { fn file_id(&self) -> HirFileId { match self { -- cgit v1.2.3 From c0dd36fd425416f5465abf7f12f5d3a14b35751d Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Fri, 9 Apr 2021 13:38:01 +0200 Subject: Store `#[derive]` attribute ID along macro invoc --- crates/hir_expand/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crates/hir_expand/src/lib.rs') diff --git a/crates/hir_expand/src/lib.rs b/crates/hir_expand/src/lib.rs index 8637abc6a..a0e6aec62 100644 --- a/crates/hir_expand/src/lib.rs +++ b/crates/hir_expand/src/lib.rs @@ -291,7 +291,7 @@ pub struct MacroCallLoc { #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum MacroCallKind { FnLike { ast_id: AstId }, - Derive { ast_id: AstId, derive_name: String }, + Derive { ast_id: AstId, derive_name: String, derive_attr: AttrId }, } #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] -- cgit v1.2.3 From 7e78aebc8fbbb4043d62949681e4d700f1a2ec46 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Fri, 9 Apr 2021 14:10:54 +0200 Subject: Rewrite `#[derive]` removal to be based on AST --- crates/hir_expand/src/lib.rs | 1 + 1 file changed, 1 insertion(+) (limited to 'crates/hir_expand/src/lib.rs') diff --git a/crates/hir_expand/src/lib.rs b/crates/hir_expand/src/lib.rs index a0e6aec62..7349fdfe4 100644 --- a/crates/hir_expand/src/lib.rs +++ b/crates/hir_expand/src/lib.rs @@ -14,6 +14,7 @@ pub mod builtin_macro; pub mod proc_macro; pub mod quote; pub mod eager; +mod input; use either::Either; pub use mbe::{ExpandError, ExpandResult}; -- cgit v1.2.3