summary refs log tree commit diff
path: root/compiler/rustc_macros/src/diagnostics/utils.rs
AgeCommit message (Collapse)AuthorLines
2022-05-12macros: spanless subdiagnostics from `()` fieldsDavid Wood-21/+33
Type attributes could previously be used to support spanless subdiagnostics but these couldn't easily be made optional in the same way that spanned subdiagnostics could by using a field attribute on a field with an `Option<Span>` type. Spanless subdiagnostics can now be specified on fields with `()` type or `Option<()>` type. Signed-off-by: David Wood <david.wood@huawei.com>
2022-05-06macros: allow `Vec` fields in diagnostic deriveDavid Wood-6/+55
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>
2022-04-29macros: allow setting applicability in attributeDavid Wood-0/+43
In the initial implementation of the `SessionSubdiagnostic`, the `Applicability` of a suggestion can be set both as a field and as part of the attribute, this commit adds the same support to the original `SessionDiagnostic` derive. Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-29macros: add more documentation commentsDavid Wood-0/+3
Documentation comments are always good. Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-29macros: split diagnostic derives into modulesDavid Wood-0/+221
Split `SessionDiagnostic` and `SessionSubdiagnostic` derives and the various helper functions into multiple modules. Signed-off-by: David Wood <david.wood@huawei.com>