aboutsummaryrefslogtreecommitdiff
path: root/crates/hir/src/lib.rs
diff options
context:
space:
mode:
authorJonas Schievink <[email protected]>2021-05-30 03:19:47 +0100
committerJonas Schievink <[email protected]>2021-05-30 03:19:47 +0100
commitcb5454db86bae1e97d86b05607b5c36a89fb749b (patch)
tree0705acfc61230ddc6aa8336fde920d9d49f7dbd1 /crates/hir/src/lib.rs
parent06b301e2f8a9f8607dfe3f0132dce68deae74ad5 (diff)
Diagnose unimplemented built-in macros
Diffstat (limited to 'crates/hir/src/lib.rs')
-rw-r--r--crates/hir/src/lib.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs
index 975ae4869..d3ef29db4 100644
--- a/crates/hir/src/lib.rs
+++ b/crates/hir/src/lib.rs
@@ -36,8 +36,8 @@ use std::{iter, sync::Arc};
36use arrayvec::ArrayVec; 36use arrayvec::ArrayVec;
37use base_db::{CrateDisplayName, CrateId, Edition, FileId}; 37use base_db::{CrateDisplayName, CrateId, Edition, FileId};
38use diagnostics::{ 38use diagnostics::{
39 InactiveCode, MacroError, UnresolvedExternCrate, UnresolvedImport, UnresolvedMacroCall, 39 InactiveCode, MacroError, UnimplementedBuiltinMacro, UnresolvedExternCrate, UnresolvedImport,
40 UnresolvedModule, UnresolvedProcMacro, 40 UnresolvedMacroCall, UnresolvedModule, UnresolvedProcMacro,
41}; 41};
42use either::Either; 42use either::Either;
43use hir_def::{ 43use hir_def::{
@@ -565,6 +565,14 @@ impl Module {
565 }; 565 };
566 sink.push(MacroError { file, node: ast, message: message.clone() }); 566 sink.push(MacroError { file, node: ast, message: message.clone() });
567 } 567 }
568
569 DefDiagnosticKind::UnimplementedBuiltinMacro { ast } => {
570 let node = ast.to_node(db.upcast());
571 // Must have a name, otherwise we wouldn't emit it.
572 let name = node.name().expect("unimplemented builtin macro with no name");
573 let ptr = SyntaxNodePtr::from(AstPtr::new(&name));
574 sink.push(UnimplementedBuiltinMacro { file: ast.file_id, node: ptr });
575 }
568 } 576 }
569 } 577 }
570 for decl in self.declarations(db) { 578 for decl in self.declarations(db) {