1 error: `#[derive(SessionDiagnostic)]` can only be used on structs
2 --> $DIR/diagnostic-derive.rs:37:1
4 LL | / #[error(code = "E0123", slug = "foo")]
6 LL | | enum SessionDiagnosticOnEnum {
12 error: `#[error = ...]` is not a valid attribute
13 --> $DIR/diagnostic-derive.rs:46:1
15 LL | #[error = "E0123"]
18 error: `#[nonsense(...)]` is not a valid attribute
19 --> $DIR/diagnostic-derive.rs:51:1
21 LL | #[nonsense(code = "E0123", slug = "foo")]
22 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
24 = help: only `error` and `warning` are valid attributes
26 error: diagnostic kind not specified
27 --> $DIR/diagnostic-derive.rs:51:1
29 LL | / #[nonsense(code = "E0123", slug = "foo")]
33 LL | | struct InvalidStructAttr {}
34 | |___________________________^
36 = help: use the `#[error(...)]` attribute to create an error
38 error: `#[error("...")]` is not a valid attribute
39 --> $DIR/diagnostic-derive.rs:58:9
41 LL | #[error("E0123")]
44 error: `slug` not specified
45 --> $DIR/diagnostic-derive.rs:58:1
47 LL | / #[error("E0123")]
50 LL | | struct InvalidLitNestedAttr {}
51 | |______________________________^
53 = help: use the `#[error(slug = "...")]` attribute to set this diagnostic's slug
55 error: `#[error(nonsense)]` is not a valid attribute
56 --> $DIR/diagnostic-derive.rs:64:9
58 LL | #[error(nonsense, code = "E0123", slug = "foo")]
61 error: `#[error(nonsense(...))]` is not a valid attribute
62 --> $DIR/diagnostic-derive.rs:69:9
64 LL | #[error(nonsense("foo"), code = "E0123", slug = "foo")]
67 error: `#[error(nonsense = ...)]` is not a valid attribute
68 --> $DIR/diagnostic-derive.rs:74:9
70 LL | #[error(nonsense = "...", code = "E0123", slug = "foo")]
73 = help: only `slug` and `code` are valid nested attributes
75 error: `#[error(nonsense = ...)]` is not a valid attribute
76 --> $DIR/diagnostic-derive.rs:79:9
78 LL | #[error(nonsense = 4, code = "E0123", slug = "foo")]
81 error: `#[suggestion = ...]` is not a valid attribute
82 --> $DIR/diagnostic-derive.rs:86:5
84 LL | #[suggestion = "bar"]
85 | ^^^^^^^^^^^^^^^^^^^^^
87 = help: only `label`, `note` and `help` are valid field attributes
89 error: specified multiple times
90 --> $DIR/diagnostic-derive.rs:93:1
92 LL | #[error(code = "E0456", slug = "bar")]
93 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
95 note: previously specified here
96 --> $DIR/diagnostic-derive.rs:92:1
98 LL | #[error(code = "E0123", slug = "foo")]
99 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
101 error: specified multiple times
102 --> $DIR/diagnostic-derive.rs:93:16
104 LL | #[error(code = "E0456", slug = "bar")]
107 note: previously specified here
108 --> $DIR/diagnostic-derive.rs:92:16
110 LL | #[error(code = "E0123", slug = "foo")]
113 error: specified multiple times
114 --> $DIR/diagnostic-derive.rs:93:32
116 LL | #[error(code = "E0456", slug = "bar")]
119 note: previously specified here
120 --> $DIR/diagnostic-derive.rs:92:32
122 LL | #[error(code = "E0123", slug = "foo")]
125 error: specified multiple times
126 --> $DIR/diagnostic-derive.rs:101:1
128 LL | #[warning(code = "E0293", slug = "bar")]
129 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
131 note: previously specified here
132 --> $DIR/diagnostic-derive.rs:100:1
134 LL | #[error(code = "E0123", slug = "foo")]
135 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
137 error: specified multiple times
138 --> $DIR/diagnostic-derive.rs:101:18
140 LL | #[warning(code = "E0293", slug = "bar")]
143 note: previously specified here
144 --> $DIR/diagnostic-derive.rs:100:16
146 LL | #[error(code = "E0123", slug = "foo")]
149 error: specified multiple times
150 --> $DIR/diagnostic-derive.rs:101:34
152 LL | #[warning(code = "E0293", slug = "bar")]
155 note: previously specified here
156 --> $DIR/diagnostic-derive.rs:100:32
158 LL | #[error(code = "E0123", slug = "foo")]
161 error: specified multiple times
162 --> $DIR/diagnostic-derive.rs:108:32
164 LL | #[error(code = "E0456", code = "E0457", slug = "bar")]
167 note: previously specified here
168 --> $DIR/diagnostic-derive.rs:108:16
170 LL | #[error(code = "E0456", code = "E0457", slug = "bar")]
173 error: specified multiple times
174 --> $DIR/diagnostic-derive.rs:113:46
176 LL | #[error(code = "E0456", slug = "foo", slug = "bar")]
179 note: previously specified here
180 --> $DIR/diagnostic-derive.rs:113:32
182 LL | #[error(code = "E0456", slug = "foo", slug = "bar")]
185 error: diagnostic kind not specified
186 --> $DIR/diagnostic-derive.rs:118:1
188 LL | struct KindNotProvided {}
189 | ^^^^^^^^^^^^^^^^^^^^^^^^^
191 = help: use the `#[error(...)]` attribute to create an error
193 error: `slug` not specified
194 --> $DIR/diagnostic-derive.rs:121:1
196 LL | / #[error(code = "E0456")]
197 LL | | struct SlugNotProvided {}
198 | |_________________________^
200 = help: use the `#[error(slug = "...")]` attribute to set this diagnostic's slug
202 error: the `#[primary_span]` attribute can only be applied to fields of type `Span`
203 --> $DIR/diagnostic-derive.rs:131:5
208 error: `#[nonsense]` is not a valid attribute
209 --> $DIR/diagnostic-derive.rs:139:5
214 = help: only `skip_arg`, `primary_span`, `label`, `note`, `help` and `subdiagnostic` are valid field attributes
216 error: the `#[label = ...]` attribute can only be applied to fields of type `Span`
217 --> $DIR/diagnostic-derive.rs:156:5
219 LL | #[label = "bar"]
222 error: `name` doesn't refer to a field on this type
223 --> $DIR/diagnostic-derive.rs:164:42
225 LL | #[suggestion(message = "bar", code = "{name}")]
228 error: invalid format string: expected `'}'` but string was terminated
229 --> $DIR/diagnostic-derive.rs:169:16
231 LL | #[derive(SessionDiagnostic)]
232 | - ^ expected `'}'` in format string
234 | because of this opening brace
236 = note: if you intended to print `{`, you can escape it using `{{`
237 = note: this error originates in the derive macro `SessionDiagnostic` (in Nightly builds, run with -Z macro-backtrace for more info)
239 error: invalid format string: unmatched `}` found
240 --> $DIR/diagnostic-derive.rs:179:15
242 LL | #[derive(SessionDiagnostic)]
243 | ^ unmatched `}` in format string
245 = note: if you intended to print `}`, you can escape it using `}}`
246 = note: this error originates in the derive macro `SessionDiagnostic` (in Nightly builds, run with -Z macro-backtrace for more info)
248 error: the `#[label = ...]` attribute can only be applied to fields of type `Span`
249 --> $DIR/diagnostic-derive.rs:199:5
251 LL | #[label = "bar"]
254 error: `#[suggestion(nonsense = ...)]` is not a valid attribute
255 --> $DIR/diagnostic-derive.rs:224:18
257 LL | #[suggestion(nonsense = "bar")]
260 = help: only `message`, `code` and `applicability` are valid field attributes
262 error: `#[suggestion(msg = ...)]` is not a valid attribute
263 --> $DIR/diagnostic-derive.rs:232:18
265 LL | #[suggestion(msg = "bar")]
268 = help: only `message`, `code` and `applicability` are valid field attributes
270 error: wrong field type for suggestion
271 --> $DIR/diagnostic-derive.rs:254:5
273 LL | / #[suggestion(message = "bar", code = "This is suggested code")]
275 LL | | suggestion: Applicability,
276 | |_____________________________^
278 = help: `#[suggestion(...)]` should be applied to fields of type `Span` or `(Span, Applicability)`
280 error: type of field annotated with `#[suggestion(...)]` contains more than one `Span`
281 --> $DIR/diagnostic-derive.rs:269:5
283 LL | / #[suggestion(message = "bar", code = "This is suggested code")]
285 LL | | suggestion: (Span, Span, Applicability),
286 | |___________________________________________^
288 error: type of field annotated with `#[suggestion(...)]` contains more than one Applicability
289 --> $DIR/diagnostic-derive.rs:277:5
291 LL | / #[suggestion(message = "bar", code = "This is suggested code")]
293 LL | | suggestion: (Applicability, Applicability, Span),
294 | |____________________________________________________^
296 error: `#[label(...)]` is not a valid attribute
297 --> $DIR/diagnostic-derive.rs:285:5
302 = help: only `suggestion{,_short,_hidden,_verbose}` are valid field attributes
304 error: `#[help]` must come after `#[error(..)]` or `#[warn(..)]`
305 --> $DIR/diagnostic-derive.rs:406:1
310 error: `#[help = ...]` must come after `#[error(..)]` or `#[warn(..)]`
311 --> $DIR/diagnostic-derive.rs:414:1
316 error: `#[note]` must come after `#[error(..)]` or `#[warn(..)]`
317 --> $DIR/diagnostic-derive.rs:422:1
322 error: `#[note = ...]` must come after `#[error(..)]` or `#[warn(..)]`
323 --> $DIR/diagnostic-derive.rs:430:1
328 error: applicability cannot be set in both the field and attribute
329 --> $DIR/diagnostic-derive.rs:440:49
331 LL | #[suggestion(message = "bar", code = "...", applicability = "maybe-incorrect")]
332 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
334 error: invalid applicability
335 --> $DIR/diagnostic-derive.rs:448:49
337 LL | #[suggestion(message = "bar", code = "...", applicability = "batman")]
338 | ^^^^^^^^^^^^^^^^^^^^^^^^
340 error: cannot find attribute `nonsense` in this scope
341 --> $DIR/diagnostic-derive.rs:51:3
343 LL | #[nonsense(code = "E0123", slug = "foo")]
346 error: cannot find attribute `nonsense` in this scope
347 --> $DIR/diagnostic-derive.rs:139:7
352 error[E0277]: the trait bound `Hello: IntoDiagnosticArg` is not satisfied
353 --> $DIR/diagnostic-derive.rs:329:10
355 LL | #[derive(SessionDiagnostic)]
356 | ^^^^^^^^^^^^^^^^^ the trait `IntoDiagnosticArg` is not implemented for `Hello`
358 = help: the following other types implement trait `IntoDiagnosticArg`:
363 rustc_middle::ty::Ty<'tcx>
365 note: required by a bound in `DiagnosticBuilder::<'a, G>::set_arg`
366 --> $COMPILER_DIR/rustc_errors/src/diagnostic_builder.rs:531:19
368 LL | arg: impl IntoDiagnosticArg,
369 | ^^^^^^^^^^^^^^^^^ required by this bound in `DiagnosticBuilder::<'a, G>::set_arg`
370 = note: this error originates in the derive macro `SessionDiagnostic` (in Nightly builds, run with -Z macro-backtrace for more info)
372 error: aborting due to 43 previous errors
374 For more information about this error, try `rustc --explain E0277`.