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.rs25
1 files changed, 2 insertions, 23 deletions
diff --git a/crates/hir/src/diagnostics.rs b/crates/hir/src/diagnostics.rs
index 3908e67a2..c7702e09f 100644
--- a/crates/hir/src/diagnostics.rs
+++ b/crates/hir/src/diagnostics.rs
@@ -35,6 +35,7 @@ diagnostics![
35 InactiveCode, 35 InactiveCode,
36 MacroError, 36 MacroError,
37 MissingFields, 37 MissingFields,
38 NoSuchField,
38 UnimplementedBuiltinMacro, 39 UnimplementedBuiltinMacro,
39 UnresolvedExternCrate, 40 UnresolvedExternCrate,
40 UnresolvedImport, 41 UnresolvedImport,
@@ -92,31 +93,9 @@ pub struct UnimplementedBuiltinMacro {
92 pub node: InFile<SyntaxNodePtr>, 93 pub node: InFile<SyntaxNodePtr>,
93} 94}
94 95
95// Diagnostic: no-such-field
96//
97// This diagnostic is triggered if created structure does not have field provided in record.
98#[derive(Debug)] 96#[derive(Debug)]
99pub struct NoSuchField { 97pub struct NoSuchField {
100 pub file: HirFileId, 98 pub field: InFile<AstPtr<ast::RecordExprField>>,
101 pub field: AstPtr<ast::RecordExprField>,
102}
103
104impl Diagnostic for NoSuchField {
105 fn code(&self) -> DiagnosticCode {
106 DiagnosticCode("no-such-field")
107 }
108
109 fn message(&self) -> String {
110 "no such field".to_string()
111 }
112
113 fn display_source(&self) -> InFile<SyntaxNodePtr> {
114 InFile::new(self.file, self.field.clone().into())
115 }
116
117 fn as_any(&self) -> &(dyn Any + Send + 'static) {
118 self
119 }
120} 99}
121 100
122// Diagnostic: break-outside-of-loop 101// Diagnostic: break-outside-of-loop