From 8ea9d939d2c44feb71e2d1c8ec390a9471b75e57 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Mon, 10 May 2021 22:54:17 +0200 Subject: Rewrite `#[derive]` removal to be based on AST --- crates/hir_expand/src/lib.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (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 57e08eeb0..5df11856e 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; @@ -292,8 +293,19 @@ pub struct MacroCallLoc { #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum MacroCallKind { - FnLike { ast_id: AstId, fragment: FragmentKind }, - Derive { ast_id: AstId, derive_name: String, derive_attr_index: u32 }, + FnLike { + ast_id: AstId, + fragment: FragmentKind, + }, + Derive { + ast_id: AstId, + derive_name: String, + /// Syntactical index of the invoking `#[derive]` attribute. + /// + /// Outer attributes are counted first, then inner attributes. This does not support + /// out-of-line modules, which may have attributes spread across 2 files! + derive_attr_index: u32, + }, } impl MacroCallKind { -- cgit v1.2.3