diff options
Diffstat (limited to 'crates/hir_def/src/diagnostics.rs')
-rw-r--r-- | crates/hir_def/src/diagnostics.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/crates/hir_def/src/diagnostics.rs b/crates/hir_def/src/diagnostics.rs index fcfbbbad3..c9c08b01f 100644 --- a/crates/hir_def/src/diagnostics.rs +++ b/crates/hir_def/src/diagnostics.rs | |||
@@ -86,3 +86,28 @@ impl Diagnostic for UnresolvedImport { | |||
86 | true | 86 | true |
87 | } | 87 | } |
88 | } | 88 | } |
89 | |||
90 | // Diagnostic: unconfigured-code | ||
91 | // | ||
92 | // This diagnostic is shown for code with inactive `#[cfg]` attributes. | ||
93 | #[derive(Debug)] | ||
94 | pub struct InactiveCode { | ||
95 | pub file: HirFileId, | ||
96 | pub node: SyntaxNodePtr, | ||
97 | } | ||
98 | |||
99 | impl Diagnostic for InactiveCode { | ||
100 | fn code(&self) -> DiagnosticCode { | ||
101 | DiagnosticCode("inactive-code") | ||
102 | } | ||
103 | fn message(&self) -> String { | ||
104 | // FIXME: say *why* it is configured out | ||
105 | "code is inactive due to #[cfg] directives".to_string() | ||
106 | } | ||
107 | fn display_source(&self) -> InFile<SyntaxNodePtr> { | ||
108 | InFile::new(self.file, self.node.clone()) | ||
109 | } | ||
110 | fn as_any(&self) -> &(dyn Any + Send + 'static) { | ||
111 | self | ||
112 | } | ||
113 | } | ||