Skip to content

Commit f8463bf

Browse files
Rollup merge of #153401 - GuillaumeGomez:migrate-diag, r=JonathanBrouwer
Migrationg of `LintDiagnostic` - part 7 Part of rust-lang/rust#153099. This PR removes the `LintDiagnostic` trait and proc-macro. \o/ r? @JonathanBrouwer
2 parents c296266 + c549072 commit f8463bf

2 files changed

Lines changed: 7 additions & 8 deletions

File tree

src/diagnostics/diagnostic-structs.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
# Diagnostic and subdiagnostic structs
2-
rustc has three diagnostic traits that can be used to create diagnostics:
3-
`Diagnostic`, `LintDiagnostic`, and `Subdiagnostic`.
2+
rustc has two diagnostic traits that can be used to create diagnostics:
3+
`Diagnostic` and `Subdiagnostic`.
44

55
For simple diagnostics,
66
derived impls can be used, e.g. `#[derive(Diagnostic)]`. They are only suitable for simple diagnostics that
77
don't require much logic in deciding whether or not to add additional subdiagnostics.
88

99
In cases where diagnostics require more complex or dynamic behavior, such as conditionally adding subdiagnostics,
1010
customizing the rendering logic, or selecting messages at runtime, you will need to manually implement
11-
the corresponding trait (`Diagnostic`, `LintDiagnostic`, or `Subdiagnostic`).
11+
the corresponding trait (`Diagnostic` or `Subdiagnostic`).
1212
This approach provides greater flexibility and is recommended for diagnostics that go beyond simple, static structures.
1313

1414
Diagnostic can be translated into different languages.
1515

16-
## `#[derive(Diagnostic)]` and `#[derive(LintDiagnostic)]`
16+
## `#[derive(Diagnostic)]`
1717

1818
Consider the [definition][defn] of the "field already declared" diagnostic shown below:
1919

@@ -123,8 +123,8 @@ tcx.dcx().emit_err(FieldAlreadyDeclared {
123123
});
124124
```
125125

126-
### Reference for `#[derive(Diagnostic)]` and `#[derive(LintDiagnostic)]`
127-
`#[derive(Diagnostic)]` and `#[derive(LintDiagnostic)]` support the following attributes:
126+
### Reference for `#[derive(Diagnostic)]`
127+
`#[derive(Diagnostic)]` supports the following attributes:
128128

129129
- `#[diag("message", code = "...")]`
130130
- _Applied to struct or enum variant._
@@ -171,7 +171,6 @@ tcx.dcx().emit_err(FieldAlreadyDeclared {
171171
- Adds the subdiagnostic represented by the subdiagnostic struct.
172172
- `#[primary_span]` (_Optional_)
173173
- _Applied to `Span` fields on `Subdiagnostic`s.
174-
Not used for `LintDiagnostic`s._
175174
- Indicates the primary span of the diagnostic.
176175
- `#[skip_arg]` (_Optional_)
177176
- _Applied to any field._

src/diagnostics/translation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ There are two ways of writing translatable diagnostics:
3232
deciding to emit subdiagnostics and can therefore be represented as diagnostic structs).
3333
See [the diagnostic and subdiagnostic structs documentation](./diagnostic-structs.md).
3434
2. Using typed identifiers with `Diag` APIs (in
35-
`Diagnostic` or `Subdiagnostic` or `LintDiagnostic` implementations).
35+
`Diagnostic` or `Subdiagnostic` implementations).
3636

3737
When adding or changing a translatable diagnostic,
3838
you don't need to worry about the translations.

0 commit comments

Comments
 (0)