Skip to content

Commit f7df1f3

Browse files
committed
Long diagnostic for E0541
1 parent a32e979 commit f7df1f3

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

Diff for: src/libsyntax/diagnostic_list.rs

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

96+
E0541: r##"
97+
An unknown meta item was used.
98+
99+
Erroneous code example:
100+
101+
```compile_fail,E0541
102+
#[deprecated(
103+
since="1.0.0",
104+
reason="Example invalid meta item. Should be 'note'") // error: unknown meta item
105+
]
106+
fn deprecated_function() {}
107+
108+
Meta items are the key/value pairs inside of an attribute. The keys provided must be one of the
109+
valid keys for the specified attribute.
110+
111+
To fix the problem, either remove the unknown meta item, or rename it it you provided the wrong
112+
name.
113+
114+
In the erroneous code example above, the wrong name was provided, so changing it to the right name
115+
fixes the error.
116+
117+
```
118+
#[deprecated(
119+
since="1.0.0",
120+
note="This is a valid meta item for the deprecated attribute."
121+
)]
122+
fn deprecated_function() {}
123+
"##,
124+
96125
E0552: r##"
97126
A unrecognized representation attribute was used.
98127
@@ -318,7 +347,6 @@ register_diagnostics! {
318347
E0538, // multiple [same] items
319348
E0539, // incorrect meta item
320349
E0540, // multiple rustc_deprecated attributes
321-
E0541, // unknown meta item
322350
E0542, // missing 'since'
323351
E0543, // missing 'reason'
324352
E0544, // multiple stability levels

0 commit comments

Comments
 (0)