diff options
Diffstat (limited to 'crates/ide')
-rw-r--r-- | crates/ide/src/diagnostics.rs | 7 | ||||
-rw-r--r-- | crates/ide/src/diagnostics/unimplemented_builtin_macro.rs | 19 |
2 files changed, 21 insertions, 5 deletions
diff --git a/crates/ide/src/diagnostics.rs b/crates/ide/src/diagnostics.rs index aeccf1164..3fbd21c30 100644 --- a/crates/ide/src/diagnostics.rs +++ b/crates/ide/src/diagnostics.rs | |||
@@ -9,6 +9,7 @@ mod unresolved_extern_crate; | |||
9 | mod unresolved_import; | 9 | mod unresolved_import; |
10 | mod unresolved_macro_call; | 10 | mod unresolved_macro_call; |
11 | mod unresolved_proc_macro; | 11 | mod unresolved_proc_macro; |
12 | mod unimplemented_builtin_macro; | ||
12 | mod macro_error; | 13 | mod macro_error; |
13 | mod inactive_code; | 14 | mod inactive_code; |
14 | mod missing_fields; | 15 | mod missing_fields; |
@@ -185,11 +186,6 @@ pub(crate) fn diagnostics( | |||
185 | .with_code(Some(d.code())), | 186 | .with_code(Some(d.code())), |
186 | ); | 187 | ); |
187 | }) | 188 | }) |
188 | .on::<hir::diagnostics::UnimplementedBuiltinMacro, _>(|d| { | ||
189 | let display_range = sema.diagnostics_display_range(d.display_source()).range; | ||
190 | res.borrow_mut() | ||
191 | .push(Diagnostic::hint(display_range, d.message()).with_code(Some(d.code()))); | ||
192 | }) | ||
193 | // Only collect experimental diagnostics when they're enabled. | 189 | // Only collect experimental diagnostics when they're enabled. |
194 | .filter(|diag| !(diag.is_experimental() && config.disable_experimental)) | 190 | .filter(|diag| !(diag.is_experimental() && config.disable_experimental)) |
195 | .filter(|diag| !config.disabled.contains(diag.code().as_str())); | 191 | .filter(|diag| !config.disabled.contains(diag.code().as_str())); |
@@ -229,6 +225,7 @@ pub(crate) fn diagnostics( | |||
229 | AnyDiagnostic::UnresolvedImport(d) => unresolved_import::unresolved_import(&ctx, &d), | 225 | AnyDiagnostic::UnresolvedImport(d) => unresolved_import::unresolved_import(&ctx, &d), |
230 | AnyDiagnostic::UnresolvedMacroCall(d) => unresolved_macro_call::unresolved_macro_call(&ctx, &d), | 226 | AnyDiagnostic::UnresolvedMacroCall(d) => unresolved_macro_call::unresolved_macro_call(&ctx, &d), |
231 | AnyDiagnostic::UnresolvedProcMacro(d) => unresolved_proc_macro::unresolved_proc_macro(&ctx, &d), | 227 | AnyDiagnostic::UnresolvedProcMacro(d) => unresolved_proc_macro::unresolved_proc_macro(&ctx, &d), |
228 | AnyDiagnostic::UnimplementedBuiltinMacro(d) => unimplemented_builtin_macro::unimplemented_builtin_macro(&ctx, &d), | ||
232 | AnyDiagnostic::MissingFields(d) => missing_fields::missing_fields(&ctx, &d), | 229 | AnyDiagnostic::MissingFields(d) => missing_fields::missing_fields(&ctx, &d), |
233 | AnyDiagnostic::MacroError(d) => macro_error::macro_error(&ctx, &d), | 230 | AnyDiagnostic::MacroError(d) => macro_error::macro_error(&ctx, &d), |
234 | 231 | ||
diff --git a/crates/ide/src/diagnostics/unimplemented_builtin_macro.rs b/crates/ide/src/diagnostics/unimplemented_builtin_macro.rs new file mode 100644 index 000000000..09faa3bbc --- /dev/null +++ b/crates/ide/src/diagnostics/unimplemented_builtin_macro.rs | |||
@@ -0,0 +1,19 @@ | |||
1 | use crate::{ | ||
2 | diagnostics::{Diagnostic, DiagnosticsContext}, | ||
3 | Severity, | ||
4 | }; | ||
5 | |||
6 | // Diagnostic: unimplemented-builtin-macro | ||
7 | // | ||
8 | // This diagnostic is shown for builtin macros which are not yet implemented by rust-analyzer | ||
9 | pub(super) fn unimplemented_builtin_macro( | ||
10 | ctx: &DiagnosticsContext<'_>, | ||
11 | d: &hir::UnimplementedBuiltinMacro, | ||
12 | ) -> Diagnostic { | ||
13 | Diagnostic::new( | ||
14 | "unimplemented-builtin-macro", | ||
15 | "unimplemented built-in macro".to_string(), | ||
16 | ctx.sema.diagnostics_display_range(d.node.clone()).range, | ||
17 | ) | ||
18 | .severity(Severity::WeakWarning) | ||
19 | } | ||