Skip to content

Commit 03477e9

Browse files
Rollup merge of #82231 - jesusprubio:add-long-explanation-e0543, r=GuillaumeGomez
Add long explanation for E0543 Helps with #61137
2 parents f97e112 + c80b737 commit 03477e9

File tree

3 files changed

+37
-2
lines changed

3 files changed

+37
-2
lines changed

compiler/rustc_error_codes/src/error_codes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ E0538: include_str!("./error_codes/E0538.md"),
286286
E0539: include_str!("./error_codes/E0539.md"),
287287
E0541: include_str!("./error_codes/E0541.md"),
288288
E0542: include_str!("./error_codes/E0542.md"),
289+
E0543: include_str!("./error_codes/E0543.md"),
289290
E0545: include_str!("./error_codes/E0545.md"),
290291
E0546: include_str!("./error_codes/E0546.md"),
291292
E0547: include_str!("./error_codes/E0547.md"),
@@ -605,7 +606,6 @@ E0781: include_str!("./error_codes/E0781.md"),
605606
E0523,
606607
// E0526, // shuffle indices are not constant
607608
// E0540, // multiple rustc_deprecated attributes
608-
E0543, // missing 'reason'
609609
E0544, // multiple stability levels
610610
// E0548, // replaced with a generic attribute input check
611611
// rustc_deprecated attribute must be paired with either stable or unstable
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
The `reason` value is missing in a stability attribute.
2+
3+
Erroneous code example:
4+
5+
```compile_fail,E0543
6+
#![feature(staged_api)]
7+
#![stable(since = "1.0.0", feature = "test")]
8+
9+
#[stable(since = "0.1.0", feature = "_deprecated_fn")]
10+
#[rustc_deprecated(
11+
since = "1.0.0"
12+
)] // invalid
13+
fn _deprecated_fn() {}
14+
```
15+
16+
To fix this issue, you need to provide the `reason` field. Example:
17+
18+
```
19+
#![feature(staged_api)]
20+
#![stable(since = "1.0.0", feature = "test")]
21+
22+
#[stable(since = "0.1.0", feature = "_deprecated_fn")]
23+
#[rustc_deprecated(
24+
since = "1.0.0",
25+
reason = "explanation for deprecation"
26+
)] // ok!
27+
fn _deprecated_fn() {}
28+
```
29+
30+
See the [How Rust is Made and “Nightly Rust”][how-rust-made-nightly] appendix
31+
of the Book and the [Stability attributes][stability-attributes] section of the
32+
Rustc Dev Guide for more details.
33+
34+
[how-rust-made-nightly]: https://doc.rust-lang.org/book/appendix-07-nightly-rust.html
35+
[stability-attributes]: https://rustc-dev-guide.rust-lang.org/stability.html

src/test/ui/stability-attribute/stability-attribute-sanity.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,5 +116,5 @@ LL | #[rustc_deprecated(since = "a", reason = "text")]
116116

117117
error: aborting due to 19 previous errors
118118

119-
Some errors have detailed explanations: E0539, E0541, E0542, E0546, E0547, E0550.
119+
Some errors have detailed explanations: E0539, E0541, E0542, E0543, E0546, E0547, E0550.
120120
For more information about an error, try `rustc --explain E0539`.

0 commit comments

Comments
 (0)