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.rs23
1 files changed, 2 insertions, 21 deletions
diff --git a/crates/hir/src/diagnostics.rs b/crates/hir/src/diagnostics.rs
index 158626dc0..ec0a8fe41 100644
--- a/crates/hir/src/diagnostics.rs
+++ b/crates/hir/src/diagnostics.rs
@@ -32,7 +32,7 @@ macro_rules! diagnostics {
32 }; 32 };
33} 33}
34 34
35diagnostics![UnresolvedModule, MissingFields]; 35diagnostics![UnresolvedModule, UnresolvedExternCrate, MissingFields];
36 36
37#[derive(Debug)] 37#[derive(Debug)]
38pub struct UnresolvedModule { 38pub struct UnresolvedModule {
@@ -40,28 +40,9 @@ pub struct UnresolvedModule {
40 pub candidate: String, 40 pub candidate: String,
41} 41}
42 42
43// Diagnostic: unresolved-extern-crate
44//
45// This diagnostic is triggered if rust-analyzer is unable to discover referred extern crate.
46#[derive(Debug)] 43#[derive(Debug)]
47pub struct UnresolvedExternCrate { 44pub struct UnresolvedExternCrate {
48 pub file: HirFileId, 45 pub decl: InFile<AstPtr<ast::ExternCrate>>,
49 pub item: AstPtr<ast::ExternCrate>,
50}
51
52impl Diagnostic for UnresolvedExternCrate {
53 fn code(&self) -> DiagnosticCode {
54 DiagnosticCode("unresolved-extern-crate")
55 }
56 fn message(&self) -> String {
57 "unresolved extern crate".to_string()
58 }
59 fn display_source(&self) -> InFile<SyntaxNodePtr> {
60 InFile::new(self.file, self.item.clone().into())
61 }
62 fn as_any(&self) -> &(dyn Any + Send + 'static) {
63 self
64 }
65} 46}
66 47
67#[derive(Debug)] 48#[derive(Debug)]