aboutsummaryrefslogtreecommitdiff
path: root/crates/hir/src/diagnostics.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir/src/diagnostics.rs')
-rw-r--r--crates/hir/src/diagnostics.rs26
1 files changed, 2 insertions, 24 deletions
diff --git a/crates/hir/src/diagnostics.rs b/crates/hir/src/diagnostics.rs
index 2039d2b43..28580eeb4 100644
--- a/crates/hir/src/diagnostics.rs
+++ b/crates/hir/src/diagnostics.rs
@@ -37,6 +37,7 @@ diagnostics![
37 UnresolvedImport, 37 UnresolvedImport,
38 UnresolvedMacroCall, 38 UnresolvedMacroCall,
39 UnresolvedProcMacro, 39 UnresolvedProcMacro,
40 MacroError,
40 MissingFields, 41 MissingFields,
41 InactiveCode, 42 InactiveCode,
42]; 43];
@@ -79,35 +80,12 @@ pub struct UnresolvedProcMacro {
79 pub macro_name: Option<String>, 80 pub macro_name: Option<String>,
80} 81}
81 82
82// Diagnostic: macro-error
83//
84// This diagnostic is shown for macro expansion errors.
85#[derive(Debug, Clone, Eq, PartialEq)] 83#[derive(Debug, Clone, Eq, PartialEq)]
86pub struct MacroError { 84pub struct MacroError {
87 pub file: HirFileId, 85 pub node: InFile<SyntaxNodePtr>,
88 pub node: SyntaxNodePtr,
89 pub message: String, 86 pub message: String,
90} 87}
91 88
92impl Diagnostic for MacroError {
93 fn code(&self) -> DiagnosticCode {
94 DiagnosticCode("macro-error")
95 }
96 fn message(&self) -> String {
97 self.message.clone()
98 }
99 fn display_source(&self) -> InFile<SyntaxNodePtr> {
100 InFile::new(self.file, self.node.clone())
101 }
102 fn as_any(&self) -> &(dyn Any + Send + 'static) {
103 self
104 }
105 fn is_experimental(&self) -> bool {
106 // Newly added and not very well-tested, might contain false positives.
107 true
108 }
109}
110
111#[derive(Debug)] 89#[derive(Debug)]
112pub struct UnimplementedBuiltinMacro { 90pub struct UnimplementedBuiltinMacro {
113 pub file: HirFileId, 91 pub file: HirFileId,