diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-11-03 21:34:50 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2019-11-03 21:34:50 +0000 |
commit | 4fd742d6bc23e2f61d0980e15234f09d7e715b76 (patch) | |
tree | c37d38f9313f54ea71580f6bd005f554388a57ab /crates/ra_hir_def/src/diagnostics.rs | |
parent | f9f1effd011b906903891c09f1cb6b2a42f73e95 (diff) | |
parent | 8922a44395482896fec0c0a47a7fac4612112d45 (diff) |
Merge #2163
2163: Move CrateDefMap to hir_def r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
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 | } | ||