diff options
author | Jonas Schievink <[email protected]> | 2021-04-09 12:38:01 +0100 |
---|---|---|
committer | Jonas Schievink <[email protected]> | 2021-04-09 12:38:01 +0100 |
commit | c0dd36fd425416f5465abf7f12f5d3a14b35751d (patch) | |
tree | 3fc19fa9306afd69bf5702919237753c94337007 /crates/hir_expand/src | |
parent | 546da15972312f62be8a64a409d39a8d96ed53a6 (diff) |
Store `#[derive]` attribute ID along macro invoc
Diffstat (limited to 'crates/hir_expand/src')
-rw-r--r-- | crates/hir_expand/src/builtin_derive.rs | 8 | ||||
-rw-r--r-- | crates/hir_expand/src/lib.rs | 2 |
2 files changed, 7 insertions, 3 deletions
diff --git a/crates/hir_expand/src/builtin_derive.rs b/crates/hir_expand/src/builtin_derive.rs index 392079ed4..537c03028 100644 --- a/crates/hir_expand/src/builtin_derive.rs +++ b/crates/hir_expand/src/builtin_derive.rs | |||
@@ -269,7 +269,7 @@ mod tests { | |||
269 | use expect_test::{expect, Expect}; | 269 | use expect_test::{expect, Expect}; |
270 | use name::AsName; | 270 | use name::AsName; |
271 | 271 | ||
272 | use crate::{test_db::TestDB, AstId, MacroCallId, MacroCallKind, MacroCallLoc}; | 272 | use crate::{test_db::TestDB, AstId, AttrId, MacroCallId, MacroCallKind, MacroCallLoc}; |
273 | 273 | ||
274 | use super::*; | 274 | use super::*; |
275 | 275 | ||
@@ -317,7 +317,11 @@ $0 | |||
317 | local_inner: false, | 317 | local_inner: false, |
318 | }, | 318 | }, |
319 | krate: CrateId(0), | 319 | krate: CrateId(0), |
320 | kind: MacroCallKind::Derive { ast_id, derive_name: name.to_string() }, | 320 | kind: MacroCallKind::Derive { |
321 | ast_id, | ||
322 | derive_name: name.to_string(), | ||
323 | derive_attr: AttrId(0), | ||
324 | }, | ||
321 | }; | 325 | }; |
322 | 326 | ||
323 | let id: MacroCallId = db.intern_macro(loc).into(); | 327 | let id: MacroCallId = db.intern_macro(loc).into(); |
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 { | |||
291 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 291 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
292 | pub enum MacroCallKind { | 292 | pub enum MacroCallKind { |
293 | FnLike { ast_id: AstId<ast::MacroCall> }, | 293 | FnLike { ast_id: AstId<ast::MacroCall> }, |
294 | Derive { ast_id: AstId<ast::Item>, derive_name: String }, | 294 | Derive { ast_id: AstId<ast::Item>, derive_name: String, derive_attr: AttrId }, |
295 | } | 295 | } |
296 | 296 | ||
297 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] | 297 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] |