1 error: `#[derive(SessionDiagnostic)]` can only be used on structs
2 --> $DIR/session-derive-errors.rs:34:1
4 LL | / #[error = "E0123"]
6 LL | | enum SessionDiagnosticOnEnum {
12 error: `#[label = ...]` is not a valid SessionDiagnostic struct attribute
13 --> $DIR/session-derive-errors.rs:43:1
15 LL | #[label = "This is in the wrong place"]
16 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
18 error: `#[suggestion = ...]` is not a valid SessionDiagnostic field attribute
19 --> $DIR/session-derive-errors.rs:50:5
21 LL | #[suggestion = "this is the wrong kind of attribute"]
22 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
24 error: `error` specified multiple times
25 --> $DIR/session-derive-errors.rs:58:11
27 LL | #[error = "E0456"]
30 error: `lint` specified when `error` was already specified
31 --> $DIR/session-derive-errors.rs:64:10
33 LL | #[lint = "some_useful_lint"]
36 error: `code` not specified
37 --> $DIR/session-derive-errors.rs:73:1
39 LL | struct ErrorCodeNotProvided {}
40 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
42 = help: use the [code = "..."] attribute to set this diagnostic's error code
44 error: the `#[message = "..."]` attribute can only be applied to fields of type Span
45 --> $DIR/session-derive-errors.rs:101:5
47 LL | #[message = "this message is applied to a String field"]
48 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
50 error: `name` doesn't refer to a field on this type
51 --> $DIR/session-derive-errors.rs:108:1
53 LL | #[message = "This error has a field, and references {name}"]
54 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
56 error: invalid format string: expected `'}'` but string was terminated
57 --> $DIR/session-derive-errors.rs:116:1
59 LL | #[derive(SessionDiagnostic)]
60 | ----------------- in this derive macro expansion
61 LL | #[error = "E0123"]
62 | - because of this opening brace
63 LL | #[message = "This is missing a closing brace: {name"]
64 | ^ expected `'}'` in format string
66 = note: if you intended to print `{`, you can escape it using `{{`
67 = note: this error originates in the derive macro `SessionDiagnostic` (in Nightly builds, run with -Z macro-backtrace for more info)
69 error: invalid format string: unmatched `}` found
70 --> $DIR/session-derive-errors.rs:125:1
72 LL | #[derive(SessionDiagnostic)]
73 | ----------------- in this derive macro expansion
74 LL | #[error = "E0123"]
75 LL | #[message = "This is missing an opening brace: name}"]
76 | ^ unmatched `}` in format string
78 = note: if you intended to print `}`, you can escape it using `}}`
79 = note: this error originates in the derive macro `SessionDiagnostic` (in Nightly builds, run with -Z macro-backtrace for more info)
81 error: The `#[label = ...]` attribute can only be applied to fields of type Span
82 --> $DIR/session-derive-errors.rs:144:5
84 LL | #[label = "See here"]
85 | ^^^^^^^^^^^^^^^^^^^^^
87 error: `nonsense` is not a valid key for `#[suggestion(...)]`
88 --> $DIR/session-derive-errors.rs:169:18
90 LL | #[suggestion(nonsense = "This is nonsense")]
91 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
93 error: `msg` is not a valid key for `#[suggestion(...)]`
94 --> $DIR/session-derive-errors.rs:177:18
96 LL | #[suggestion(msg = "This is a suggestion")]
97 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
99 error: missing suggestion message
100 --> $DIR/session-derive-errors.rs:185:7
102 LL | #[suggestion(code = "This is suggested code")]
103 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
105 = help: provide a suggestion message using #[suggestion(message = "...")]
107 error: wrong field type for suggestion
108 --> $DIR/session-derive-errors.rs:200:5
110 LL | / #[suggestion(message = "This is a message", code = "This is suggested code")]
112 LL | | suggestion: Applicability,
113 | |_____________________________^
115 = help: #[suggestion(...)] should be applied to fields of type Span or (Span, Applicability)
117 error: type of field annotated with `#[suggestion(...)]` contains more than one Span
118 --> $DIR/session-derive-errors.rs:215:5
120 LL | / #[suggestion(message = "This is a message", code = "This is suggested code")]
122 LL | | suggestion: (Span, Span, Applicability),
123 | |___________________________________________^
125 error: type of field annotated with `#[suggestion(...)]` contains more than one Applicability
126 --> $DIR/session-derive-errors.rs:223:5
128 LL | / #[suggestion(message = "This is a message", code = "This is suggested code")]
130 LL | | suggestion: (Applicability, Applicability, Span),
131 | |____________________________________________________^
133 error: invalid annotation list `#[label(...)]`
134 --> $DIR/session-derive-errors.rs:231:7
136 LL | #[label("wrong kind of annotation for label")]
137 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
139 error: aborting due to 18 previous errors