From 2624e9183d8f3587bac325d6f7a9777c36f2f45b Mon Sep 17 00:00:00 2001 From: Jacob Pratt Date: Thu, 21 Sep 2023 00:06:22 +0000 Subject: [PATCH] Soft-destabilize `RustcEncodable`/`RustcDecodable` --- library/core/src/macros/mod.rs | 20 +++++++++++++------ library/core/src/prelude/v1.rs | 7 ++++++- library/std/src/prelude/v1.rs | 7 ++++++- .../pretty-expanded/input.rs | 16 ++++++--------- 4 files changed, 32 insertions(+), 18 deletions(-) diff --git a/library/core/src/macros/mod.rs b/library/core/src/macros/mod.rs index a78842c8f8d68..574a357b44abb 100644 --- a/library/core/src/macros/mod.rs +++ b/library/core/src/macros/mod.rs @@ -1726,20 +1726,28 @@ pub(crate) mod builtin { builtin # deref($pat) } - /// Unstable implementation detail of the `rustc` compiler, do not use. + /// Derive macro for `rustc-serialize`. Should not be used in new code. #[rustc_builtin_macro] - #[stable(feature = "rust1", since = "1.0.0")] - #[allow_internal_unstable(core_intrinsics, libstd_sys_internals, rt)] + #[unstable( + feature = "rustc_encodable_decodable", + issue = "none", + soft, + reason = "derive macro for `rustc-serialize`; should not be used in new code" + )] #[deprecated(since = "1.52.0", note = "rustc-serialize is deprecated and no longer supported")] #[doc(hidden)] // While technically stable, using it is unstable, and deprecated. Hide it. pub macro RustcDecodable($item:item) { /* compiler built-in */ } - /// Unstable implementation detail of the `rustc` compiler, do not use. + /// Derive macro for `rustc-serialize`. Should not be used in new code. #[rustc_builtin_macro] - #[stable(feature = "rust1", since = "1.0.0")] - #[allow_internal_unstable(core_intrinsics, rt)] + #[unstable( + feature = "rustc_encodable_decodable", + issue = "none", + soft, + reason = "derive macro for `rustc-serialize`; should not be used in new code" + )] #[deprecated(since = "1.52.0", note = "rustc-serialize is deprecated and no longer supported")] #[doc(hidden)] // While technically stable, using it is unstable, and deprecated. Hide it. pub macro RustcEncodable($item:item) { diff --git a/library/core/src/prelude/v1.rs b/library/core/src/prelude/v1.rs index 29f73bb4942aa..698aaa6bbcfd4 100644 --- a/library/core/src/prelude/v1.rs +++ b/library/core/src/prelude/v1.rs @@ -69,7 +69,12 @@ pub use crate::{ pub use crate::concat_bytes; // Do not `doc(inline)` these `doc(hidden)` items. -#[stable(feature = "builtin_macro_prelude", since = "1.38.0")] +#[unstable( + feature = "rustc_encodable_decodable", + issue = "none", + soft, + reason = "unstable implementation detail of the `rustc` compiler, do not use" +)] #[allow(deprecated)] pub use crate::macros::builtin::{RustcDecodable, RustcEncodable}; diff --git a/library/std/src/prelude/v1.rs b/library/std/src/prelude/v1.rs index 36fa4e88b5bde..0559f34c1b4c7 100644 --- a/library/std/src/prelude/v1.rs +++ b/library/std/src/prelude/v1.rs @@ -53,7 +53,12 @@ pub use core::prelude::v1::{ pub use core::prelude::v1::concat_bytes; // Do not `doc(inline)` these `doc(hidden)` items. -#[stable(feature = "builtin_macro_prelude", since = "1.38.0")] +#[unstable( + feature = "rustc_encodable_decodable", + issue = "none", + soft, + reason = "unstable implementation detail of the `rustc` compiler, do not use" +)] #[allow(deprecated)] pub use core::prelude::v1::{RustcDecodable, RustcEncodable}; diff --git a/tests/run-make-fulldeps/pretty-expanded/input.rs b/tests/run-make-fulldeps/pretty-expanded/input.rs index af3d75b3bf216..02b235068a1d2 100644 --- a/tests/run-make-fulldeps/pretty-expanded/input.rs +++ b/tests/run-make-fulldeps/pretty-expanded/input.rs @@ -1,12 +1,8 @@ -#[crate_type="lib"] - // #13544 -extern crate rustc_serialize; - -#[derive(RustcEncodable)] pub struct A; -#[derive(RustcEncodable)] pub struct B(isize); -#[derive(RustcEncodable)] pub struct C { x: isize } -#[derive(RustcEncodable)] pub enum D {} -#[derive(RustcEncodable)] pub enum E { y } -#[derive(RustcEncodable)] pub enum F { z(isize) } +#[derive(Debug)] pub struct A; +#[derive(Debug)] pub struct B(isize); +#[derive(Debug)] pub struct C { x: isize } +#[derive(Debug)] pub enum D {} +#[derive(Debug)] pub enum E { y } +#[derive(Debug)] pub enum F { z(isize) }