-
Notifications
You must be signed in to change notification settings - Fork 549
Open
Labels
A-diagnosticsArea: diagnosticsArea: diagnosticsA-diagnostics-infraArea: diagnostics infrastructureArea: diagnostics infrastructureA-translationArea: diagnostics translation and other translationsArea: diagnostics translation and other translationsE-mediumDifficulty: might require some prior knowledge or code readingDifficulty: might require some prior knowledge or code readingI-outdatedIssue: info is outdatedIssue: info is outdatedT-compilerRelevant to compiler teamRelevant to compiler team
Description
The example on https://rustc-dev-guide.rust-lang.org/diagnostics/diagnostic-structs.html is given as
#[derive(Diagnostic)]
#[diag(hir_analysis_field_already_declared, code = E0124)]
pub struct FieldAlreadyDeclared {
pub field_name: Ident,
#[primary_span]
#[label]
pub span: Span,
#[label(previous_decl_label)]
pub prev_span: Span,
}
but I believe this doesn't work anymore because the label
's slug needs to be prefixed by the crate name, so the example needs to become e.g.
#[derive(Diagnostic)]
#[diag(hir_analysis_field_already_declared, code = E0124)]
pub struct FieldAlreadyDeclared {
pub field_name: Ident,
#[primary_span]
#[label]
pub span: Span,
#[label(hir_analysis_previous_decl_label)]
pub prev_span: Span,
}
Probably worth mentioning more explicitly because I wasted 15 minutes trying to debug why my label slugs weren't working lol
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: diagnosticsArea: diagnosticsA-diagnostics-infraArea: diagnostics infrastructureArea: diagnostics infrastructureA-translationArea: diagnostics translation and other translationsArea: diagnostics translation and other translationsE-mediumDifficulty: might require some prior knowledge or code readingDifficulty: might require some prior knowledge or code readingI-outdatedIssue: info is outdatedIssue: info is outdatedT-compilerRelevant to compiler teamRelevant to compiler team