From 698f8c2f01ea549d77d7dc3338a12e04c11057b9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:02:58 +0200 Subject: Adding upstream version 1.64.0+dfsg1. Signed-off-by: Daniel Baumann --- .../rustc_error_codes/src/error_codes/E0542.md | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 compiler/rustc_error_codes/src/error_codes/E0542.md (limited to 'compiler/rustc_error_codes/src/error_codes/E0542.md') diff --git a/compiler/rustc_error_codes/src/error_codes/E0542.md b/compiler/rustc_error_codes/src/error_codes/E0542.md new file mode 100644 index 000000000..c69e57417 --- /dev/null +++ b/compiler/rustc_error_codes/src/error_codes/E0542.md @@ -0,0 +1,47 @@ +The `since` value is missing in a stability attribute. + +Erroneous code example: + +```compile_fail,E0542 +#![feature(staged_api)] +#![stable(since = "1.0.0", feature = "test")] + +#[stable(feature = "_stable_fn")] // invalid +fn _stable_fn() {} + +#[rustc_const_stable(feature = "_stable_const_fn")] // invalid +const fn _stable_const_fn() {} + +#[stable(feature = "_deprecated_fn", since = "0.1.0")] +#[deprecated( + note = "explanation for deprecation" +)] // invalid +fn _deprecated_fn() {} +``` + +To fix this issue, you need to provide the `since` field. Example: + +``` +#![feature(staged_api)] +#![stable(since = "1.0.0", feature = "test")] + +#[stable(feature = "_stable_fn", since = "1.0.0")] // ok! +fn _stable_fn() {} + +#[rustc_const_stable(feature = "_stable_const_fn", since = "1.0.0")] // ok! +const fn _stable_const_fn() {} + +#[stable(feature = "_deprecated_fn", since = "0.1.0")] +#[deprecated( + since = "1.0.0", + note = "explanation for deprecation" +)] // ok! +fn _deprecated_fn() {} +``` + +See the [How Rust is Made and “Nightly Rust”][how-rust-made-nightly] appendix +of the Book and the [Stability attributes][stability-attributes] section of the +Rustc Dev Guide for more details. + +[how-rust-made-nightly]: https://doc.rust-lang.org/book/appendix-07-nightly-rust.html +[stability-attributes]: https://rustc-dev-guide.rust-lang.org/stability.html -- cgit v1.2.3