]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_error_codes/src/error_codes/E0543.md
Rollup merge of #93556 - dtolnay:trailingcomma, r=cjgillot
[rust.git] / compiler / rustc_error_codes / src / error_codes / E0543.md
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