Skip to content

Commit bf4dd8e

Browse files
Rollup merge of #157070 - GuillaumeGomez:rm-skip_arg, r=JonathanBrouwer
Remove `skip_arg` attribute from `Diagnostic` and `Subdiagnostic` proc-macros Instead of having users to manually add `#[skip_arg]` for each field that is not used in fluent messages, I think it's better to instead let the proc-macro only call `diag.arg("name", field)` on the fields actually used. r? @JonathanBrouwer
2 parents 1046e6c + 3a3fee0 commit bf4dd8e

1 file changed

Lines changed: 0 additions & 8 deletions

File tree

src/diagnostics/diagnostic-structs.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ translatable error messages are written and how they are generated.
4949

5050
Every field of the `Diagnostic` which does not have an annotation is
5151
available in Fluent messages as a variable, like `field_name` in the example above.
52-
Fields can be annotated `#[skip_arg]` if this is undesired.
5352

5453
Using the `#[primary_span]` attribute on a field (that has type `Span`)
5554
indicates the primary span of the diagnostic which will have the main message of the diagnostic.
@@ -172,9 +171,6 @@ tcx.dcx().emit_err(FieldAlreadyDeclared {
172171
- `#[primary_span]` (_Optional_)
173172
- _Applied to `Span` fields on `Subdiagnostic`s.
174173
- Indicates the primary span of the diagnostic.
175-
- `#[skip_arg]` (_Optional_)
176-
- _Applied to any field._
177-
- Prevents the field from being provided as a diagnostic argument.
178174

179175
## `#[derive(Subdiagnostic)]`
180176
It is common in the compiler to write a function that conditionally adds a
@@ -225,7 +221,6 @@ A primary span is only necessary for a label or suggestion, which can not be spa
225221

226222
Every field of the type/variant which does not have an annotation is available
227223
in Fluent messages as a variable.
228-
Fields can be annotated `#[skip_arg]` if this is undesired.
229224

230225
Like `Diagnostic`, `Subdiagnostic` supports `Option<T>` and `Vec<T>` fields.
231226

@@ -348,9 +343,6 @@ to multipart suggestions)
348343
- `#[applicability]` (_Optional_; only applicable to (simple and multipart) suggestions)
349344
- _Applied to `Applicability` fields._
350345
- Indicates the applicability of the suggestion.
351-
- `#[skip_arg]` (_Optional_)
352-
- _Applied to any field._
353-
- Prevents the field from being provided as a diagnostic argument.
354346

355347
[defn]: https://github.com/rust-lang/rust/blob/6201eabde85db854c1ebb57624be5ec699246b50/compiler/rustc_hir_analysis/src/errors.rs#L68-L77
356348
[use]: https://github.com/rust-lang/rust/blob/f1112099eba41abadb6f921df7edba70affe92c5/compiler/rustc_hir_analysis/src/collect.rs#L823-L827

0 commit comments

Comments
 (0)