aboutsummaryrefslogtreecommitdiff
path: root/crates/hir/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir/src')
-rw-r--r--crates/hir/src/lib.rs16
1 files changed, 15 insertions, 1 deletions
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs
index d3ef29db4..b43d61d0e 100644
--- a/crates/hir/src/lib.rs
+++ b/crates/hir/src/lib.rs
@@ -534,6 +534,18 @@ impl Module {
534 Some(derive_name.clone()), 534 Some(derive_name.clone()),
535 ) 535 )
536 } 536 }
537 MacroCallKind::Attr { ast_id, invoc_attr_index, attr_name, .. } => {
538 let node = ast_id.to_node(db.upcast());
539 let attr =
540 node.attrs().nth((*invoc_attr_index) as usize).unwrap_or_else(
541 || panic!("cannot find attribute #{}", invoc_attr_index),
542 );
543 (
544 ast_id.file_id,
545 SyntaxNodePtr::from(AstPtr::new(&attr)),
546 Some(attr_name.clone()),
547 )
548 }
537 }; 549 };
538 sink.push(UnresolvedProcMacro { 550 sink.push(UnresolvedProcMacro {
539 file, 551 file,
@@ -558,7 +570,9 @@ impl Module {
558 let node = ast_id.to_node(db.upcast()); 570 let node = ast_id.to_node(db.upcast());
559 (ast_id.file_id, SyntaxNodePtr::from(AstPtr::new(&node))) 571 (ast_id.file_id, SyntaxNodePtr::from(AstPtr::new(&node)))
560 } 572 }
561 MacroCallKind::Derive { ast_id, .. } => { 573 MacroCallKind::Derive { ast_id, .. }
574 | MacroCallKind::Attr { ast_id, .. } => {
575 // FIXME: point to the attribute instead, this creates very large diagnostics
562 let node = ast_id.to_node(db.upcast()); 576 let node = ast_id.to_node(db.upcast());
563 (ast_id.file_id, SyntaxNodePtr::from(AstPtr::new(&node))) 577 (ast_id.file_id, SyntaxNodePtr::from(AstPtr::new(&node)))
564 } 578 }