macros: allow Vec fields in diagnostic derive
Diagnostics can have multiple primary spans, or have subdiagnostics repeated at multiple locations, so support `Vec<..>` fields in the diagnostic derive which become loops in the generated code. Signed-off-by: David Wood <david.wood@huawei.com>
This commit is contained in:
parent
3dac70fcc0
commit
859079ff12
4 changed files with 93 additions and 39 deletions
|
|
@ -474,3 +474,11 @@ struct Subdiagnostic {
|
|||
#[subdiagnostic]
|
||||
note: Note,
|
||||
}
|
||||
|
||||
#[derive(SessionDiagnostic)]
|
||||
#[error(code = "E0123", slug = "foo")]
|
||||
struct VecField {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
spans: Vec<Span>,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue