aboutsummaryrefslogtreecommitdiff
path: root/crates/hir
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir')
-rw-r--r--crates/hir/src/diagnostics.rs30
-rw-r--r--crates/hir/src/lib.rs8
2 files changed, 12 insertions, 26 deletions
diff --git a/crates/hir/src/diagnostics.rs b/crates/hir/src/diagnostics.rs
index 28580eeb4..3908e67a2 100644
--- a/crates/hir/src/diagnostics.rs
+++ b/crates/hir/src/diagnostics.rs
@@ -32,14 +32,15 @@ macro_rules! diagnostics {
32} 32}
33 33
34diagnostics![ 34diagnostics![
35 UnresolvedModule, 35 InactiveCode,
36 MacroError,
37 MissingFields,
38 UnimplementedBuiltinMacro,
36 UnresolvedExternCrate, 39 UnresolvedExternCrate,
37 UnresolvedImport, 40 UnresolvedImport,
38 UnresolvedMacroCall, 41 UnresolvedMacroCall,
42 UnresolvedModule,
39 UnresolvedProcMacro, 43 UnresolvedProcMacro,
40 MacroError,
41 MissingFields,
42 InactiveCode,
43]; 44];
44 45
45#[derive(Debug)] 46#[derive(Debug)]
@@ -88,26 +89,7 @@ pub struct MacroError {
88 89
89#[derive(Debug)] 90#[derive(Debug)]
90pub struct UnimplementedBuiltinMacro { 91pub struct UnimplementedBuiltinMacro {
91 pub file: HirFileId, 92 pub node: InFile<SyntaxNodePtr>,
92 pub node: SyntaxNodePtr,
93}
94
95impl Diagnostic for UnimplementedBuiltinMacro {
96 fn code(&self) -> DiagnosticCode {
97 DiagnosticCode("unimplemented-builtin-macro")
98 }
99
100 fn message(&self) -> String {
101 "unimplemented built-in macro".to_string()
102 }
103
104 fn display_source(&self) -> InFile<SyntaxNodePtr> {
105 InFile::new(self.file, self.node.clone())
106 }
107
108 fn as_any(&self) -> &(dyn Any + Send + 'static) {
109 self
110 }
111} 93}
112 94
113// Diagnostic: no-such-field 95// Diagnostic: no-such-field
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs
index d891d0ec1..a361158e0 100644
--- a/crates/hir/src/lib.rs
+++ b/crates/hir/src/lib.rs
@@ -606,8 +606,12 @@ impl Module {
606 let node = ast.to_node(db.upcast()); 606 let node = ast.to_node(db.upcast());
607 // Must have a name, otherwise we wouldn't emit it. 607 // Must have a name, otherwise we wouldn't emit it.
608 let name = node.name().expect("unimplemented builtin macro with no name"); 608 let name = node.name().expect("unimplemented builtin macro with no name");
609 let ptr = SyntaxNodePtr::from(AstPtr::new(&name)); 609 acc.push(
610 sink.push(UnimplementedBuiltinMacro { file: ast.file_id, node: ptr }); 610 UnimplementedBuiltinMacro {
611 node: ast.with_value(SyntaxNodePtr::from(AstPtr::new(&name))),
612 }
613 .into(),
614 );
611 } 615 }
612 } 616 }
613 } 617 }