Commit 9d864c8
committed
macros: add diagnostic derive for lints
`SessionDiagnostic` isn't suitable for use on lints as whether or not it
creates an error or a warning is decided at compile-time by the macro,
whereas lints decide this at runtime based on the location of the lint
being reported (as it will depend on the user's `allow`/`deny`
attributes, etc). Re-using most of the machinery for
`SessionDiagnostic`, this macro introduces a `LintDiagnostic` derive
which implements a `DecorateLint` trait, taking a
`LintDiagnosticBuilder` and adding to the lint according to the
diagnostic struct.1 parent 7f9d848 commit 9d864c8
File tree
12 files changed
+845
-612
lines changed- compiler
- rustc_lint
- src
- rustc_macros/src
- diagnostics
- src/test/ui-fulldeps/session-diagnostic
12 files changed
+845
-612
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4009 | 4009 | | |
4010 | 4010 | | |
4011 | 4011 | | |
| 4012 | + | |
4012 | 4013 | | |
4013 | 4014 | | |
4014 | 4015 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
1553 | 1554 | | |
1554 | 1555 | | |
1555 | 1556 | | |
1556 | | - | |
1557 | | - | |
1558 | | - | |
1559 | | - | |
1560 | | - | |
1561 | | - | |
1562 | | - | |
| 1557 | + | |
| 1558 | + | |
| 1559 | + | |
| 1560 | + | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
| 1564 | + | |
| 1565 | + | |
| 1566 | + | |
| 1567 | + | |
| 1568 | + | |
| 1569 | + | |
| 1570 | + | |
1563 | 1571 | | |
1564 | 1572 | | |
1565 | 1573 | | |
| |||
Large diffs are not rendered by default.
0 commit comments