1 error: `#[derive(SessionDiagnostic)]` can only be used on structs
2 --> $DIR/diagnostic-derive.rs:39:1
4 LL | / #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")]
6 LL | | enum SessionDiagnosticOnEnum {
12 error: `#[diag = ...]` is not a valid attribute
13 --> $DIR/diagnostic-derive.rs:48:1
15 LL | #[diag = "E0123"]
18 error: `#[nonsense(...)]` is not a valid attribute
19 --> $DIR/diagnostic-derive.rs:53:1
21 LL | #[nonsense(typeck::ambiguous_lifetime_bound, code = "E0123")]
22 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
24 = help: only `diag`, `help`, `note` and `warning` are valid attributes
26 error: diagnostic slug not specified
27 --> $DIR/diagnostic-derive.rs:53:1
29 LL | / #[nonsense(typeck::ambiguous_lifetime_bound, code = "E0123")]
33 LL | | struct InvalidStructAttr {}
34 | |___________________________^
36 = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(typeck::example_error)]`
38 error: `#[diag("...")]` is not a valid attribute
39 --> $DIR/diagnostic-derive.rs:60:8
44 = help: first argument of the attribute should be the diagnostic slug
46 error: diagnostic slug not specified
47 --> $DIR/diagnostic-derive.rs:60:1
49 LL | / #[diag("E0123")]
52 LL | | struct InvalidLitNestedAttr {}
53 | |______________________________^
55 = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(typeck::example_error)]`
57 error: `#[diag(nonsense(...))]` is not a valid attribute
58 --> $DIR/diagnostic-derive.rs:71:8
60 LL | #[diag(nonsense("foo"), code = "E0123", slug = "foo")]
63 = help: first argument of the attribute should be the diagnostic slug
65 error: diagnostic slug not specified
66 --> $DIR/diagnostic-derive.rs:71:1
68 LL | / #[diag(nonsense("foo"), code = "E0123", slug = "foo")]
71 LL | | struct InvalidNestedStructAttr1 {}
72 | |__________________________________^
74 = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(typeck::example_error)]`
76 error: `#[diag(nonsense = ...)]` is not a valid attribute
77 --> $DIR/diagnostic-derive.rs:77:8
79 LL | #[diag(nonsense = "...", code = "E0123", slug = "foo")]
82 = help: first argument of the attribute should be the diagnostic slug
84 error: diagnostic slug not specified
85 --> $DIR/diagnostic-derive.rs:77:1
87 LL | / #[diag(nonsense = "...", code = "E0123", slug = "foo")]
90 LL | | struct InvalidNestedStructAttr2 {}
91 | |__________________________________^
93 = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(typeck::example_error)]`
95 error: `#[diag(nonsense = ...)]` is not a valid attribute
96 --> $DIR/diagnostic-derive.rs:83:8
98 LL | #[diag(nonsense = 4, code = "E0123", slug = "foo")]
101 = help: first argument of the attribute should be the diagnostic slug
103 error: diagnostic slug not specified
104 --> $DIR/diagnostic-derive.rs:83:1
106 LL | / #[diag(nonsense = 4, code = "E0123", slug = "foo")]
109 LL | | struct InvalidNestedStructAttr3 {}
110 | |__________________________________^
112 = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(typeck::example_error)]`
114 error: `#[diag(slug = ...)]` is not a valid attribute
115 --> $DIR/diagnostic-derive.rs:89:58
117 LL | #[diag(typeck::ambiguous_lifetime_bound, code = "E0123", slug = "foo")]
120 = help: only `code` is a valid nested attributes following the slug
122 error: `#[suggestion = ...]` is not a valid attribute
123 --> $DIR/diagnostic-derive.rs:96:5
125 LL | #[suggestion = "bar"]
126 | ^^^^^^^^^^^^^^^^^^^^^
128 error: specified multiple times
129 --> $DIR/diagnostic-derive.rs:103:1
131 LL | #[diag(typeck::ambiguous_lifetime_bound, code = "E0456")]
132 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
134 note: previously specified here
135 --> $DIR/diagnostic-derive.rs:102:1
137 LL | #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")]
138 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
140 error: specified multiple times
141 --> $DIR/diagnostic-derive.rs:103:49
143 LL | #[diag(typeck::ambiguous_lifetime_bound, code = "E0456")]
146 note: previously specified here
147 --> $DIR/diagnostic-derive.rs:102:49
149 LL | #[diag(typeck::ambiguous_lifetime_bound, code = "E0123")]
152 error: specified multiple times
153 --> $DIR/diagnostic-derive.rs:109:65
155 LL | #[diag(typeck::ambiguous_lifetime_bound, code = "E0456", code = "E0457")]
158 note: previously specified here
159 --> $DIR/diagnostic-derive.rs:109:49
161 LL | #[diag(typeck::ambiguous_lifetime_bound, code = "E0456", code = "E0457")]
164 error: `#[diag(typeck::ambiguous_lifetime_bound)]` is not a valid attribute
165 --> $DIR/diagnostic-derive.rs:114:42
167 LL | #[diag(typeck::ambiguous_lifetime_bound, typeck::ambiguous_lifetime_bound, code = "E0456")]
168 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
170 error: diagnostic slug not specified
171 --> $DIR/diagnostic-derive.rs:119:1
173 LL | struct KindNotProvided {}
174 | ^^^^^^^^^^^^^^^^^^^^^^^^^
176 = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(typeck::example_error)]`
178 error: diagnostic slug not specified
179 --> $DIR/diagnostic-derive.rs:122:1
181 LL | / #[diag(code = "E0456")]
183 LL | | struct SlugNotProvided {}
184 | |_________________________^
186 = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(typeck::example_error)]`
188 error: the `#[primary_span]` attribute can only be applied to fields of type `Span` or `MultiSpan`
189 --> $DIR/diagnostic-derive.rs:133:5
194 error: `#[nonsense]` is not a valid attribute
195 --> $DIR/diagnostic-derive.rs:141:5
200 = help: only `skip_arg`, `primary_span`, `label`, `note`, `help` and `subdiagnostic` are valid field attributes
202 error: the `#[label(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan`
203 --> $DIR/diagnostic-derive.rs:158:5
205 LL | #[label(typeck::label)]
206 | ^^^^^^^^^^^^^^^^^^^^^^^
208 error: `name` doesn't refer to a field on this type
209 --> $DIR/diagnostic-derive.rs:166:45
211 LL | #[suggestion(typeck::suggestion, code = "{name}")]
214 error: invalid format string: expected `'}'` but string was terminated
215 --> $DIR/diagnostic-derive.rs:171:16
217 LL | #[derive(SessionDiagnostic)]
218 | - ^ expected `'}'` in format string
220 | because of this opening brace
222 = note: if you intended to print `{`, you can escape it using `{{`
223 = note: this error originates in the derive macro `SessionDiagnostic` (in Nightly builds, run with -Z macro-backtrace for more info)
225 error: invalid format string: unmatched `}` found
226 --> $DIR/diagnostic-derive.rs:181:15
228 LL | #[derive(SessionDiagnostic)]
229 | ^ unmatched `}` in format string
231 = note: if you intended to print `}`, you can escape it using `}}`
232 = note: this error originates in the derive macro `SessionDiagnostic` (in Nightly builds, run with -Z macro-backtrace for more info)
234 error: the `#[label(...)]` attribute can only be applied to fields of type `Span` or `MultiSpan`
235 --> $DIR/diagnostic-derive.rs:201:5
237 LL | #[label(typeck::label)]
238 | ^^^^^^^^^^^^^^^^^^^^^^^
240 error: `#[suggestion(nonsense = ...)]` is not a valid attribute
241 --> $DIR/diagnostic-derive.rs:226:18
243 LL | #[suggestion(nonsense = "bar")]
246 = help: only `message`, `code` and `applicability` are valid field attributes
248 error: `#[suggestion(msg = ...)]` is not a valid attribute
249 --> $DIR/diagnostic-derive.rs:234:18
251 LL | #[suggestion(msg = "bar")]
254 = help: only `message`, `code` and `applicability` are valid field attributes
256 error: wrong field type for suggestion
257 --> $DIR/diagnostic-derive.rs:256:5
259 LL | / #[suggestion(typeck::suggestion, code = "This is suggested code")]
261 LL | | suggestion: Applicability,
262 | |_____________________________^
264 = help: `#[suggestion(...)]` should be applied to fields of type `Span` or `(Span, Applicability)`
266 error: type of field annotated with `#[suggestion(...)]` contains more than one `Span`
267 --> $DIR/diagnostic-derive.rs:271:5
269 LL | / #[suggestion(typeck::suggestion, code = "This is suggested code")]
271 LL | | suggestion: (Span, Span, Applicability),
272 | |___________________________________________^
274 error: type of field annotated with `#[suggestion(...)]` contains more than one Applicability
275 --> $DIR/diagnostic-derive.rs:279:5
277 LL | / #[suggestion(typeck::suggestion, code = "This is suggested code")]
279 LL | | suggestion: (Applicability, Applicability, Span),
280 | |____________________________________________________^
282 error: `#[label = ...]` is not a valid attribute
283 --> $DIR/diagnostic-derive.rs:287:5
285 LL | #[label = "bar"]
288 error: applicability cannot be set in both the field and attribute
289 --> $DIR/diagnostic-derive.rs:438:52
291 LL | #[suggestion(typeck::suggestion, code = "...", applicability = "maybe-incorrect")]
292 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
294 error: invalid applicability
295 --> $DIR/diagnostic-derive.rs:446:52
297 LL | #[suggestion(typeck::suggestion, code = "...", applicability = "batman")]
298 | ^^^^^^^^^^^^^^^^^^^^^^^^
300 error: `#[label(...)]` is not a valid attribute
301 --> $DIR/diagnostic-derive.rs:509:5
303 LL | #[label(typeck::label, foo)]
304 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
306 error: `#[label(...)]` is not a valid attribute
307 --> $DIR/diagnostic-derive.rs:517:5
309 LL | #[label(typeck::label, foo = "...")]
310 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
312 error: `#[label(...)]` is not a valid attribute
313 --> $DIR/diagnostic-derive.rs:525:5
315 LL | #[label(typeck::label, foo("..."))]
316 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
318 error: `#[primary_span]` is not a valid attribute
319 --> $DIR/diagnostic-derive.rs:538:5
324 = help: the `primary_span` field attribute is not valid for lint diagnostics
326 error: `#[error(...)]` is not a valid attribute
327 --> $DIR/diagnostic-derive.rs:558:1
329 LL | #[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
330 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
332 = help: `error` and `lint` have been replaced by `diag`
334 error: diagnostic slug not specified
335 --> $DIR/diagnostic-derive.rs:558:1
337 LL | / #[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
341 LL | | struct ErrorAttribute {}
342 | |________________________^
344 = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(typeck::example_error)]`
346 error: `#[warn_(...)]` is not a valid attribute
347 --> $DIR/diagnostic-derive.rs:565:1
349 LL | #[warn_(typeck::ambiguous_lifetime_bound, code = "E0123")]
350 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
352 = help: `warn_` have been replaced by `warning`
354 error: diagnostic slug not specified
355 --> $DIR/diagnostic-derive.rs:565:1
357 LL | / #[warn_(typeck::ambiguous_lifetime_bound, code = "E0123")]
361 LL | | struct WarnAttribute {}
362 | |_______________________^
364 = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(typeck::example_error)]`
366 error: `#[lint(...)]` is not a valid attribute
367 --> $DIR/diagnostic-derive.rs:572:1
369 LL | #[lint(typeck::ambiguous_lifetime_bound, code = "E0123")]
370 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
372 = help: `error` and `lint` have been replaced by `diag`
374 error: diagnostic slug not specified
375 --> $DIR/diagnostic-derive.rs:572:1
377 LL | / #[lint(typeck::ambiguous_lifetime_bound, code = "E0123")]
381 LL | | struct LintAttributeOnSessionDiag {}
382 | |____________________________________^
384 = help: specify the slug as the first argument to the `#[diag(...)]` attribute, such as `#[diag(typeck::example_error)]`
386 error: `#[lint(...)]` is not a valid attribute
387 --> $DIR/diagnostic-derive.rs:579:1
389 LL | #[lint(typeck::ambiguous_lifetime_bound, code = "E0123")]
390 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
392 = help: `error` and `lint` have been replaced by `diag`
394 error: diagnostic slug not specified
395 --> $DIR/diagnostic-derive.rs:579:1
397 LL | / #[lint(typeck::ambiguous_lifetime_bound, code = "E0123")]
401 LL | | struct LintAttributeOnLintDiag {}
402 | |_________________________________^
404 = help: specify the slug as the first argument to the attribute, such as `#[diag(typeck::example_error)]`
406 error: cannot find attribute `nonsense` in this scope
407 --> $DIR/diagnostic-derive.rs:53:3
409 LL | #[nonsense(typeck::ambiguous_lifetime_bound, code = "E0123")]
412 error: cannot find attribute `nonsense` in this scope
413 --> $DIR/diagnostic-derive.rs:141:7
418 error: cannot find attribute `error` in this scope
419 --> $DIR/diagnostic-derive.rs:558:3
421 LL | #[error(typeck::ambiguous_lifetime_bound, code = "E0123")]
424 error: cannot find attribute `warn_` in this scope
425 --> $DIR/diagnostic-derive.rs:565:3
427 LL | #[warn_(typeck::ambiguous_lifetime_bound, code = "E0123")]
428 | ^^^^^ help: a built-in attribute with a similar name exists: `warn`
430 error: cannot find attribute `lint` in this scope
431 --> $DIR/diagnostic-derive.rs:572:3
433 LL | #[lint(typeck::ambiguous_lifetime_bound, code = "E0123")]
434 | ^^^^ help: a built-in attribute with a similar name exists: `link`
436 error: cannot find attribute `lint` in this scope
437 --> $DIR/diagnostic-derive.rs:579:3
439 LL | #[lint(typeck::ambiguous_lifetime_bound, code = "E0123")]
440 | ^^^^ help: a built-in attribute with a similar name exists: `link`
442 error[E0425]: cannot find value `nonsense` in module `rustc_errors::fluent`
443 --> $DIR/diagnostic-derive.rs:66:8
445 LL | #[diag(nonsense, code = "E0123")]
446 | ^^^^^^^^ not found in `rustc_errors::fluent`
448 error[E0277]: the trait bound `Hello: IntoDiagnosticArg` is not satisfied
449 --> $DIR/diagnostic-derive.rs:331:10
451 LL | #[derive(SessionDiagnostic)]
452 | ^^^^^^^^^^^^^^^^^ the trait `IntoDiagnosticArg` is not implemented for `Hello`
454 = help: normalized in stderr
455 note: required by a bound in `DiagnosticBuilder::<'a, G>::set_arg`
456 --> $COMPILER_DIR/rustc_errors/src/diagnostic_builder.rs:LL:CC
458 LL | arg: impl IntoDiagnosticArg,
459 | ^^^^^^^^^^^^^^^^^ required by this bound in `DiagnosticBuilder::<'a, G>::set_arg`
460 = note: this error originates in the derive macro `SessionDiagnostic` (in Nightly builds, run with -Z macro-backtrace for more info)
462 error: aborting due to 55 previous errors
464 Some errors have detailed explanations: E0277, E0425.
465 For more information about an error, try `rustc --explain E0277`.