Skip to content

Commit f23a5f2

Browse files
committed
Auto merge of #62507 - petrochenkov:macunstab, r=alexcrichton
Remove derives `Encodable`/`Decodable` and unstabilize attribute `#[bench]` `Encodable` and `Decodable` were deprecated before 1.0 and emitted an unsuppressable warning all this time. `#[bench]` is a part of the custom test framework feature and cannot be used meaningfully on stable, only as `cfg(false)`. Crater results can be found in #62507 (comment) and below. This PR also reroutes the tracking issue for `feature(test)` from #27812 (compiler internals) to #50297 (custom test frameworks). Closes #62048
2 parents a17951c + ef7ef05 commit f23a5f2

22 files changed

+226
-298
lines changed

src/libcore/hint.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ pub fn spin_loop() {
110110
///
111111
/// This function is a no-op, and does not even read from `dummy`.
112112
#[inline]
113-
#[unstable(feature = "test", issue = "27812")]
113+
#[unstable(feature = "test", issue = "50297")]
114114
#[allow(unreachable_code)] // this makes #[cfg] a bit easier below.
115115
pub fn black_box<T>(dummy: T) -> T {
116116
// We need to "use" the argument in some way LLVM can't introspect, and on

src/libcore/macros.rs

+2-25
Original file line numberDiff line numberDiff line change
@@ -1267,7 +1267,8 @@ pub(crate) mod builtin {
12671267
pub macro test($item:item) { /* compiler built-in */ }
12681268

12691269
/// Attribute macro applied to a function to turn it into a benchmark test.
1270-
#[stable(feature = "rust1", since = "1.0.0")]
1270+
#[unstable(feature = "test", issue = "50297",
1271+
reason = "`bench` is a part of custom test frameworks which are unstable")]
12711272
#[allow_internal_unstable(test, rustc_attrs)]
12721273
#[rustc_builtin_macro]
12731274
#[rustc_macro_transparency = "semitransparent"]
@@ -1309,37 +1310,13 @@ pub(crate) mod builtin {
13091310
#[allow_internal_unstable(core_intrinsics)]
13101311
pub macro Debug($item:item) { /* compiler built-in */ }
13111312

1312-
/// Unstable implementation detail of the `rustc` compiler, do not use.
1313-
#[rustc_builtin_macro]
1314-
#[rustc_macro_transparency = "semitransparent"]
1315-
#[stable(feature = "rust1", since = "1.0.0")]
1316-
#[rustc_deprecated(
1317-
since = "1.0.0",
1318-
reason = "derive(Decodable) is deprecated in favor of derive(RustcDecodable)",
1319-
suggestion = "RustcDecodable",
1320-
)]
1321-
#[allow_internal_unstable(core_intrinsics, libstd_sys_internals)]
1322-
pub macro Decodable($item:item) { /* compiler built-in */ }
1323-
13241313
/// Derive macro generating an impl of the trait `Default`.
13251314
#[rustc_builtin_macro]
13261315
#[rustc_macro_transparency = "semitransparent"]
13271316
#[stable(feature = "rust1", since = "1.0.0")]
13281317
#[allow_internal_unstable(core_intrinsics)]
13291318
pub macro Default($item:item) { /* compiler built-in */ }
13301319

1331-
/// Unstable implementation detail of the `rustc` compiler, do not use.
1332-
#[rustc_builtin_macro]
1333-
#[rustc_macro_transparency = "semitransparent"]
1334-
#[stable(feature = "rust1", since = "1.0.0")]
1335-
#[rustc_deprecated(
1336-
since = "1.0.0",
1337-
reason = "derive(Encodable) is deprecated in favor of derive(RustcEncodable)",
1338-
suggestion = "RustcEncodable",
1339-
)]
1340-
#[allow_internal_unstable(core_intrinsics)]
1341-
pub macro Encodable($item:item) { /* compiler built-in */ }
1342-
13431320
/// Derive macro generating an impl of the trait `Eq`.
13441321
#[rustc_builtin_macro]
13451322
#[rustc_macro_transparency = "semitransparent"]

src/libcore/prelude/v1.rs

-2
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,7 @@ pub use crate::macros::builtin::{
5454
Clone,
5555
Copy,
5656
Debug,
57-
Decodable,
5857
Default,
59-
Encodable,
6058
Eq,
6159
Hash,
6260
Ord,

src/librustc_data_structures/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
#![feature(stmt_expr_attributes)]
2323
#![feature(core_intrinsics)]
2424
#![feature(integer_atomics)]
25+
#![feature(test)]
2526

2627
#![cfg_attr(unix, feature(libc))]
27-
#![cfg_attr(test, feature(test))]
2828

2929
#![cfg_attr(not(bootstrap), allow(rustc::default_hash_types))]
3030

src/libstd/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@
218218
// std may use features in a platform-specific way
219219
#![allow(unused_features)]
220220

221-
#![cfg_attr(test, feature(print_internals, set_stdio, test, update_panic_count))]
221+
#![cfg_attr(test, feature(print_internals, set_stdio, update_panic_count))]
222222
#![cfg_attr(all(target_vendor = "fortanix", target_env = "sgx"),
223223
feature(slice_index_methods, decl_macro, coerce_unsized,
224224
sgx_platform, ptr_wrapping_offset_from))]
@@ -304,6 +304,7 @@
304304
#![feature(stdsimd)]
305305
#![feature(stmt_expr_attributes)]
306306
#![feature(str_internals)]
307+
#![feature(test)]
307308
#![feature(thread_local)]
308309
#![feature(todo_macro)]
309310
#![feature(toowned_clone_into)]

src/libstd/prelude/v1.rs

-2
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,7 @@ pub use core::prelude::v1::{
9191
Clone,
9292
Copy,
9393
Debug,
94-
Decodable,
9594
Default,
96-
Encodable,
9795
Eq,
9896
Hash,
9997
Ord,

src/libsyntax_ext/deriving/decodable.rs

+1-17
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,7 @@ pub fn expand_deriving_rustc_decodable(cx: &mut ExtCtxt<'_>,
1717
mitem: &MetaItem,
1818
item: &Annotatable,
1919
push: &mut dyn FnMut(Annotatable)) {
20-
expand_deriving_decodable_imp(cx, span, mitem, item, push, "rustc_serialize")
21-
}
22-
23-
pub fn expand_deriving_decodable(cx: &mut ExtCtxt<'_>,
24-
span: Span,
25-
mitem: &MetaItem,
26-
item: &Annotatable,
27-
push: &mut dyn FnMut(Annotatable)) {
28-
expand_deriving_decodable_imp(cx, span, mitem, item, push, "serialize")
29-
}
30-
31-
fn expand_deriving_decodable_imp(cx: &mut ExtCtxt<'_>,
32-
span: Span,
33-
mitem: &MetaItem,
34-
item: &Annotatable,
35-
push: &mut dyn FnMut(Annotatable),
36-
krate: &'static str) {
20+
let krate = "rustc_serialize";
3721
let typaram = &*deriving::hygienic_type_parameter(item, "__D");
3822

3923
let trait_def = TraitDef {

src/libsyntax_ext/deriving/encodable.rs

+1-17
Original file line numberDiff line numberDiff line change
@@ -98,23 +98,7 @@ pub fn expand_deriving_rustc_encodable(cx: &mut ExtCtxt<'_>,
9898
mitem: &MetaItem,
9999
item: &Annotatable,
100100
push: &mut dyn FnMut(Annotatable)) {
101-
expand_deriving_encodable_imp(cx, span, mitem, item, push, "rustc_serialize")
102-
}
103-
104-
pub fn expand_deriving_encodable(cx: &mut ExtCtxt<'_>,
105-
span: Span,
106-
mitem: &MetaItem,
107-
item: &Annotatable,
108-
push: &mut dyn FnMut(Annotatable)) {
109-
expand_deriving_encodable_imp(cx, span, mitem, item, push, "serialize")
110-
}
111-
112-
fn expand_deriving_encodable_imp(cx: &mut ExtCtxt<'_>,
113-
span: Span,
114-
mitem: &MetaItem,
115-
item: &Annotatable,
116-
push: &mut dyn FnMut(Annotatable),
117-
krate: &'static str) {
101+
let krate = "rustc_serialize";
118102
let typaram = &*deriving::hygienic_type_parameter(item, "__S");
119103

120104
let trait_def = TraitDef {

src/libsyntax_ext/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,7 @@ pub fn register_builtin_macros(resolver: &mut dyn syntax::ext::base::Resolver, e
9292
Clone: clone::expand_deriving_clone,
9393
Copy: bounds::expand_deriving_copy,
9494
Debug: debug::expand_deriving_debug,
95-
Decodable: decodable::expand_deriving_decodable,
9695
Default: default::expand_deriving_default,
97-
Encodable: encodable::expand_deriving_encodable,
9896
Eq: eq::expand_deriving_eq,
9997
Hash: hash::expand_deriving_hash,
10098
Ord: ord::expand_deriving_ord,

src/libtest/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
// cargo) to detect this crate.
1919

2020
#![crate_name = "test"]
21-
#![unstable(feature = "test", issue = "27812")]
21+
#![unstable(feature = "test", issue = "50297")]
2222
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/", test(attr(deny(warnings))))]
2323
#![feature(asm)]
2424
#![cfg_attr(any(unix, target_os = "cloudabi"), feature(libc, rustc_private))]

src/test/run-make-fulldeps/pretty-expanded/input.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
// #13544
44

5-
extern crate serialize;
5+
extern crate serialize as rustc_serialize;
66

7-
#[derive(Encodable)] pub struct A;
8-
#[derive(Encodable)] pub struct B(isize);
9-
#[derive(Encodable)] pub struct C { x: isize }
10-
#[derive(Encodable)] pub enum D {}
11-
#[derive(Encodable)] pub enum E { y }
12-
#[derive(Encodable)] pub enum F { z(isize) }
7+
#[derive(RustcEncodable)] pub struct A;
8+
#[derive(RustcEncodable)] pub struct B(isize);
9+
#[derive(RustcEncodable)] pub struct C { x: isize }
10+
#[derive(RustcEncodable)] pub enum D {}
11+
#[derive(RustcEncodable)] pub enum E { y }
12+
#[derive(RustcEncodable)] pub enum F { z(isize) }

src/test/run-make-fulldeps/save-analysis/foo.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -418,8 +418,9 @@ impl Error + 'static + Send {
418418
<Error + 'static>::is::<T>(self)
419419
}
420420
}
421-
extern crate serialize;
422-
#[derive(Clone, Copy, Hash, Encodable, Decodable, PartialEq, Eq, PartialOrd, Ord, Debug, Default)]
421+
extern crate serialize as rustc_serialize;
422+
#[derive(Clone, Copy, Hash, RustcEncodable, RustcDecodable,
423+
PartialEq, Eq, PartialOrd, Ord, Debug, Default)]
423424
struct AllDerives(i32);
424425

425426
fn test_format_args() {

src/test/ui-fulldeps/deprecated-derive.rs

-12
This file was deleted.

src/test/ui-fulldeps/deprecated-derive.stderr

-8
This file was deleted.

src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.rs

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232

3333
// check-pass
3434

35+
#![feature(test)]
3536
#![warn(unused_attributes, unknown_lints)]
3637

3738
// UNGATED WHITE-LISTED BUILT-IN ATTRIBUTES

0 commit comments

Comments
 (0)