Skip to content

Commit

Permalink
Soft-destabilize RustcEncodable/RustcDecodable
Browse files Browse the repository at this point in the history
  • Loading branch information
jhpratt committed Sep 21, 2023
1 parent ad36b5a commit 34b5e3c
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 18 deletions.
20 changes: 14 additions & 6 deletions library/core/src/macros/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1575,20 +1575,28 @@ pub(crate) mod builtin {
/* 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, 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) {
Expand Down
7 changes: 6 additions & 1 deletion library/core/src/prelude/v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down
7 changes: 6 additions & 1 deletion library/std/src/prelude/v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down
16 changes: 6 additions & 10 deletions tests/run-make-fulldeps/pretty-expanded/input.rs
Original file line number Diff line number Diff line change
@@ -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) }

0 comments on commit 34b5e3c

Please sign in to comment.