diff options
Diffstat (limited to 'crates/hir_def/src/diagnostics.rs')
-rw-r--r-- | crates/hir_def/src/diagnostics.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/crates/hir_def/src/diagnostics.rs b/crates/hir_def/src/diagnostics.rs new file mode 100644 index 000000000..2e38a978f --- /dev/null +++ b/crates/hir_def/src/diagnostics.rs | |||
@@ -0,0 +1,27 @@ | |||
1 | //! Diagnostics produced by `hir_def`. | ||
2 | |||
3 | use std::any::Any; | ||
4 | |||
5 | use hir_expand::diagnostics::Diagnostic; | ||
6 | use syntax::{ast, AstPtr, SyntaxNodePtr}; | ||
7 | |||
8 | use hir_expand::{HirFileId, InFile}; | ||
9 | |||
10 | #[derive(Debug)] | ||
11 | pub struct UnresolvedModule { | ||
12 | pub file: HirFileId, | ||
13 | pub decl: AstPtr<ast::Module>, | ||
14 | pub candidate: String, | ||
15 | } | ||
16 | |||
17 | impl Diagnostic for UnresolvedModule { | ||
18 | fn message(&self) -> String { | ||
19 | "unresolved module".to_string() | ||
20 | } | ||
21 | fn display_source(&self) -> InFile<SyntaxNodePtr> { | ||
22 | InFile::new(self.file, self.decl.clone().into()) | ||
23 | } | ||
24 | fn as_any(&self) -> &(dyn Any + Send + 'static) { | ||
25 | self | ||
26 | } | ||
27 | } | ||