Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
90041fb
Rename `#[rustc_outlives]` to `#[rustc_dump_inferred_outlives]`
fmease Mar 2, 2026
6382ec0
Rename `#[rustc_variance]` to `#[rustc_dump_variances]`
fmease Mar 2, 2026
f1474c0
Rename `#[rustc_object_lifetime_default]` to `#[rustc_dump_object_lif…
fmease Mar 2, 2026
5f3040f
Auto merge of #151864 - aerooneqq:delegation-generics-propagation, r=…
bors Mar 3, 2026
c549072
Update `rustc-dev-guide` to remove mentions of `LintDiagnostic`
GuillaumeGomez Mar 4, 2026
6e0bbe6
Rollup merge of #153300 - fmease:test-attrs-tweaks, r=JonathanBrouwer
JonathanBrouwer Mar 4, 2026
c296266
Rollup merge of #153396 - folkertdev:run-make-minicore, r=jieyouxu
JonathanBrouwer Mar 4, 2026
f8463bf
Rollup merge of #153401 - GuillaumeGomez:migrate-diag, r=JonathanBrouwer
JonathanBrouwer Mar 4, 2026
f9394cd
Rollup merge of #153406 - jieyouxu:adjust-notifs, r=jieyouxu
JonathanBrouwer Mar 4, 2026
07734d9
Rollup merge of #153414 - JonathanBrouwer:translate_cleanup, r=Kivooeo
JonathanBrouwer Mar 4, 2026
5c426ba
Auto merge of #153416 - JonathanBrouwer:rollup-eezxWTV, r=JonathanBro…
bors Mar 5, 2026
aa092ca
Auto merge of #150447 - WaffleLapkin:maybe-dangling-semantics, r=Ralf…
bors Mar 5, 2026
5f4c068
Auto merge of #153429 - weihanglo:update-cargo, r=weihanglo
bors Mar 6, 2026
b8ceb2d
Auto merge of #153316 - nnethercote:rm-with_related_context, r=oli-obk
bors Mar 6, 2026
bd1fac0
Prepare for merging from rust-lang/rust
invalid-email-address Mar 9, 2026
eccd16c
Merge ref 'eda4fc7733ee' from rust-lang/rust
invalid-email-address Mar 9, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
e7d90c695a39426baf5ae705de2f9570a72229de
eda4fc7733ee89e484d7120cafbd80dcb2fce66e
6 changes: 3 additions & 3 deletions src/compiler-debugging.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,16 +275,16 @@ Here are some notable ones:
|----------------|-------------|
| `rustc_def_path` | Dumps the [`def_path_str`] of an item. |
| `rustc_dump_def_parents` | Dumps the chain of `DefId` parents of certain definitions. |
| `rustc_dump_inferred_outlives` | Dumps implied bounds of an item. More precisely, the [`inferred_outlives_of`] an item. |
| `rustc_dump_item_bounds` | Dumps the [`item_bounds`] of an item. |
| `rustc_dump_object_lifetime_defaults` | Dumps the [object lifetime defaults] of an item. |
| `rustc_dump_predicates` | Dumps the [`predicates_of`] an item. |
| `rustc_dump_variances` | Dumps the [variances] of an item. |
| `rustc_dump_vtable` | Dumps the vtable layout of an impl, or a type alias of a dyn type. |
| `rustc_hidden_type_of_opaques` | Dumps the [hidden type of each opaque types][opaq] in the crate. |
| `rustc_layout` | [See this section](#debugging-type-layouts). |
| `rustc_object_lifetime_default` | Dumps the [object lifetime defaults] of an item. |
| `rustc_outlives` | Dumps implied bounds of an item. More precisely, the [`inferred_outlives_of`] an item. |
| `rustc_regions` | Dumps NLL closure region requirements. |
| `rustc_symbol_name` | Dumps the mangled & demangled [`symbol_name`] of an item. |
| `rustc_variances` | Dumps the [variances] of an item. |

Right below you can find elaborate explainers on a selected few.

Expand Down
13 changes: 6 additions & 7 deletions src/diagnostics/diagnostic-structs.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# Diagnostic and subdiagnostic structs
rustc has three diagnostic traits that can be used to create diagnostics:
`Diagnostic`, `LintDiagnostic`, and `Subdiagnostic`.
rustc has two diagnostic traits that can be used to create diagnostics:
`Diagnostic` and `Subdiagnostic`.

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

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

Diagnostic can be translated into different languages.

## `#[derive(Diagnostic)]` and `#[derive(LintDiagnostic)]`
## `#[derive(Diagnostic)]`

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

Expand Down Expand Up @@ -123,8 +123,8 @@ tcx.dcx().emit_err(FieldAlreadyDeclared {
});
```

### Reference for `#[derive(Diagnostic)]` and `#[derive(LintDiagnostic)]`
`#[derive(Diagnostic)]` and `#[derive(LintDiagnostic)]` support the following attributes:
### Reference for `#[derive(Diagnostic)]`
`#[derive(Diagnostic)]` supports the following attributes:

- `#[diag("message", code = "...")]`
- _Applied to struct or enum variant._
Expand Down Expand Up @@ -171,7 +171,6 @@ tcx.dcx().emit_err(FieldAlreadyDeclared {
- Adds the subdiagnostic represented by the subdiagnostic struct.
- `#[primary_span]` (_Optional_)
- _Applied to `Span` fields on `Subdiagnostic`s.
Not used for `LintDiagnostic`s._
- Indicates the primary span of the diagnostic.
- `#[skip_arg]` (_Optional_)
- _Applied to any field._
Expand Down
2 changes: 1 addition & 1 deletion src/diagnostics/translation.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ There are two ways of writing translatable diagnostics:
deciding to emit subdiagnostics and can therefore be represented as diagnostic structs).
See [the diagnostic and subdiagnostic structs documentation](./diagnostic-structs.md).
2. Using typed identifiers with `Diag` APIs (in
`Diagnostic` or `Subdiagnostic` or `LintDiagnostic` implementations).
`Diagnostic` or `Subdiagnostic` implementations).

When adding or changing a translatable diagnostic,
you don't need to worry about the translations.
Expand Down
Loading