]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_error_codes/src/error_codes/E0549.md
Rollup merge of #82244 - pickfire:patch-6, r=dtolnay
[rust.git] / compiler / rustc_error_codes / src / error_codes / E0549.md
1 A `rustc_deprecated` attribute wasn't paired with a `stable`/`unstable`
2 attribute.
3
4 Erroneous code example:
5
6 ```compile_fail,E0549
7 #![feature(staged_api)]
8 #![stable(since = "1.0.0", feature = "test")]
9
10 #[rustc_deprecated(
11     since = "1.0.1",
12     reason = "explanation for deprecation"
13 )] // invalid
14 fn _deprecated_fn() {}
15 ```
16
17 To fix this issue, you need to add also an attribute `stable` or `unstable`.
18 Example:
19
20 ```
21 #![feature(staged_api)]
22 #![stable(since = "1.0.0", feature = "test")]
23
24 #[stable(since = "1.0.0", feature = "test")]
25 #[rustc_deprecated(
26     since = "1.0.1",
27     reason = "explanation for deprecation"
28 )] // ok!
29 fn _deprecated_fn() {}
30 ```
31
32 See the [How Rust is Made and “Nightly Rust”][how-rust-made-nightly] appendix
33 of the Book and the [Stability attributes][stability-attributes] section of the
34 Rustc Dev Guide for more details.
35
36 [how-rust-made-nightly]: https://doc.rust-lang.org/book/appendix-07-nightly-rust.html
37 [stability-attributes]: https://rustc-dev-guide.rust-lang.org/stability.html