diff options
Diffstat (limited to 'crates/hir/src/diagnostics.rs')
-rw-r--r-- | crates/hir/src/diagnostics.rs | 27 |
1 files changed, 2 insertions, 25 deletions
diff --git a/crates/hir/src/diagnostics.rs b/crates/hir/src/diagnostics.rs index ec0a8fe41..70a4d000d 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 | ||
35 | diagnostics![UnresolvedModule, UnresolvedExternCrate, MissingFields]; | 35 | diagnostics![UnresolvedModule, UnresolvedExternCrate, UnresolvedImport, MissingFields]; |
36 | 36 | ||
37 | #[derive(Debug)] | 37 | #[derive(Debug)] |
38 | pub struct UnresolvedModule { | 38 | pub struct UnresolvedModule { |
@@ -47,30 +47,7 @@ pub struct UnresolvedExternCrate { | |||
47 | 47 | ||
48 | #[derive(Debug)] | 48 | #[derive(Debug)] |
49 | pub struct UnresolvedImport { | 49 | pub struct UnresolvedImport { |
50 | pub file: HirFileId, | 50 | pub decl: InFile<AstPtr<ast::UseTree>>, |
51 | pub node: AstPtr<ast::UseTree>, | ||
52 | } | ||
53 | |||
54 | impl Diagnostic for UnresolvedImport { | ||
55 | fn code(&self) -> DiagnosticCode { | ||
56 | DiagnosticCode("unresolved-import") | ||
57 | } | ||
58 | fn message(&self) -> String { | ||
59 | "unresolved import".to_string() | ||
60 | } | ||
61 | fn display_source(&self) -> InFile<SyntaxNodePtr> { | ||
62 | InFile::new(self.file, self.node.clone().into()) | ||
63 | } | ||
64 | fn as_any(&self) -> &(dyn Any + Send + 'static) { | ||
65 | self | ||
66 | } | ||
67 | fn is_experimental(&self) -> bool { | ||
68 | // This currently results in false positives in the following cases: | ||
69 | // - `cfg_if!`-generated code in libstd (we don't load the sysroot correctly) | ||
70 | // - `core::arch` (we don't handle `#[path = "../<path>"]` correctly) | ||
71 | // - proc macros and/or proc macro generated code | ||
72 | true | ||
73 | } | ||
74 | } | 51 | } |
75 | 52 | ||
76 | // Diagnostic: unresolved-macro-call | 53 | // Diagnostic: unresolved-macro-call |