Skip to content

Commit 0b7c9e7

Browse files
committed
Auto merge of #51490 - Havvy:diagnostic-list, r=GuillaumeGomez
Long diagnostic for E0541 r? @GuillaumeGomez
2 parents 0d76317 + cf3fcab commit 0b7c9e7

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

Diff for: src/libsyntax/diagnostic_list.rs

+32-1
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,38 @@ 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+
// error: unknown meta item
105+
reason="Example invalid meta item. Should be 'note'")
106+
]
107+
fn deprecated_function() {}
108+
```
109+
110+
Meta items are the key-value pairs inside of an attribute. The keys provided
111+
must be one of the valid keys for the specified attribute.
112+
113+
To fix the problem, either remove the unknown meta item, or rename it if you
114+
provided the wrong name.
115+
116+
In the erroneous code example above, the wrong name was provided, so changing
117+
to a correct one it will fix the error. Example:
118+
119+
```
120+
#[deprecated(
121+
since="1.0.0",
122+
note="This is a valid meta item for the deprecated attribute."
123+
)]
124+
fn deprecated_function() {}
125+
```
126+
"##,
127+
96128
E0552: r##"
97129
A unrecognized representation attribute was used.
98130
@@ -318,7 +350,6 @@ register_diagnostics! {
318350
E0538, // multiple [same] items
319351
E0539, // incorrect meta item
320352
E0540, // multiple rustc_deprecated attributes
321-
E0541, // unknown meta item
322353
E0542, // missing 'since'
323354
E0543, // missing 'reason'
324355
E0544, // multiple stability levels

0 commit comments

Comments
 (0)