-
Notifications
You must be signed in to change notification settings - Fork 558
Open
@jieyouxu
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