Skip to content

Commit 4574825

Browse files
committed
Long diagnostic for E0538
1 parent cf3fcab commit 4574825

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

src/libsyntax/diagnostic_list.rs

+30-1
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,36 @@ For more information about the cfg attribute, read:
9393
https://doc.rust-lang.org/reference.html#conditional-compilation
9494
"##,
9595

96+
E0538: r##"
97+
Attribute contains multiple of the same meta item.
98+
99+
Erroneous code example:
100+
101+
```compile_fail,E0538
102+
#[deprecated(
103+
since="1.0.0",
104+
note="First deprecation note.",
105+
note="Second deprecation note." // error: multiple same meta item
106+
)]
107+
fn deprecated_function() {}
108+
```
109+
110+
Meta items are the key-value pairs inside of an attribute. Each key may only be
111+
used once in each attribute.
112+
113+
To fix the problem, remove all but one of the meta items with the same key.
114+
115+
Example:
116+
117+
```
118+
#[deprecated(
119+
since="1.0.0",
120+
note="First deprecation note."
121+
)]
122+
fn deprecated_function() {}
123+
```
124+
"##,
125+
96126
E0541: r##"
97127
An unknown meta item was used.
98128
@@ -347,7 +377,6 @@ and likely to change in the future.
347377
}
348378

349379
register_diagnostics! {
350-
E0538, // multiple [same] items
351380
E0539, // incorrect meta item
352381
E0540, // multiple rustc_deprecated attributes
353382
E0542, // missing 'since'

0 commit comments

Comments
 (0)