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