Skip to content

Commit 85310c4

Browse files
authored
Merge pull request #18890 from Veykril/push-nwnozlyppvzo
minor: Fixup macro error kinds
2 parents 547a12e + cd60477 commit 85310c4

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/tools/rust-analyzer/crates/hir-expand/src/lib.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,8 @@ impl fmt::Display for RenderedExpandError {
188188

189189
impl RenderedExpandError {
190190
const GENERAL_KIND: &str = "macro-error";
191+
const DISABLED: &str = "proc-macro-disabled";
192+
const ATTR_EXP_DISABLED: &str = "attribute-expansion-disabled";
191193
}
192194

193195
impl ExpandErrorKind {
@@ -196,12 +198,12 @@ impl ExpandErrorKind {
196198
ExpandErrorKind::ProcMacroAttrExpansionDisabled => RenderedExpandError {
197199
message: "procedural attribute macro expansion is disabled".to_owned(),
198200
error: false,
199-
kind: "proc-macros-disabled",
201+
kind: RenderedExpandError::ATTR_EXP_DISABLED,
200202
},
201203
ExpandErrorKind::MacroDisabled => RenderedExpandError {
202204
message: "proc-macro is explicitly disabled".to_owned(),
203205
error: false,
204-
kind: "proc-macro-disabled",
206+
kind: RenderedExpandError::DISABLED,
205207
},
206208
&ExpandErrorKind::MissingProcMacroExpander(def_crate) => {
207209
match db.proc_macros().get_error_for_crate(def_crate) {

src/tools/rust-analyzer/crates/ide-diagnostics/src/handlers/macro_error.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ use crate::{Diagnostic, DiagnosticCode, DiagnosticsContext, Severity};
44
//
55
// This diagnostic is shown for macro expansion errors.
66

7-
// Diagnostic: proc-macros-disabled
7+
// Diagnostic: attribute-expansion-disabled
88
//
9-
// This diagnostic is shown for proc macros where proc macros have been disabled.
9+
// This diagnostic is shown for attribute proc macros when attribute expansions have been disabled.
1010

1111
// Diagnostic: proc-macro-disabled
1212
//
13-
// This diagnostic is shown for proc macros that has been specifically disabled via `rust-analyzer.procMacro.ignored`.
13+
// This diagnostic is shown for proc macros that have been specifically disabled via `rust-analyzer.procMacro.ignored`.
1414
pub(crate) fn macro_error(ctx: &DiagnosticsContext<'_>, d: &hir::MacroError) -> Diagnostic {
1515
// Use more accurate position if available.
1616
let display_range = ctx.resolve_precise_location(&d.node, d.precise_location);

0 commit comments

Comments
 (0)