Skip to content

Commit

Permalink
Auto merge of #62507 - petrochenkov:macunstab, r=alexcrichton
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bors committed Aug 1, 2019
2 parents a17951c + ef7ef05 commit f23a5f2
Show file tree
Hide file tree
Showing 22 changed files with 226 additions and 298 deletions.
2 changes: 1 addition & 1 deletion src/libcore/hint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ pub fn spin_loop() {
///
/// This function is a no-op, and does not even read from `dummy`.
#[inline]
#[unstable(feature = "test", issue = "27812")]
#[unstable(feature = "test", issue = "50297")]
#[allow(unreachable_code)] // this makes #[cfg] a bit easier below.
pub fn black_box<T>(dummy: T) -> T {
// We need to "use" the argument in some way LLVM can't introspect, and on
Expand Down
27 changes: 2 additions & 25 deletions src/libcore/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1267,7 +1267,8 @@ pub(crate) mod builtin {
pub macro test($item:item) { /* compiler built-in */ }

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

/// Unstable implementation detail of the `rustc` compiler, do not use.
#[rustc_builtin_macro]
#[rustc_macro_transparency = "semitransparent"]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_deprecated(
since = "1.0.0",
reason = "derive(Decodable) is deprecated in favor of derive(RustcDecodable)",
suggestion = "RustcDecodable",
)]
#[allow_internal_unstable(core_intrinsics, libstd_sys_internals)]
pub macro Decodable($item:item) { /* compiler built-in */ }

/// Derive macro generating an impl of the trait `Default`.
#[rustc_builtin_macro]
#[rustc_macro_transparency = "semitransparent"]
#[stable(feature = "rust1", since = "1.0.0")]
#[allow_internal_unstable(core_intrinsics)]
pub macro Default($item:item) { /* compiler built-in */ }

/// Unstable implementation detail of the `rustc` compiler, do not use.
#[rustc_builtin_macro]
#[rustc_macro_transparency = "semitransparent"]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_deprecated(
since = "1.0.0",
reason = "derive(Encodable) is deprecated in favor of derive(RustcEncodable)",
suggestion = "RustcEncodable",
)]
#[allow_internal_unstable(core_intrinsics)]
pub macro Encodable($item:item) { /* compiler built-in */ }

/// Derive macro generating an impl of the trait `Eq`.
#[rustc_builtin_macro]
#[rustc_macro_transparency = "semitransparent"]
Expand Down
2 changes: 0 additions & 2 deletions src/libcore/prelude/v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@ pub use crate::macros::builtin::{
Clone,
Copy,
Debug,
Decodable,
Default,
Encodable,
Eq,
Hash,
Ord,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_data_structures/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
#![feature(stmt_expr_attributes)]
#![feature(core_intrinsics)]
#![feature(integer_atomics)]
#![feature(test)]

#![cfg_attr(unix, feature(libc))]
#![cfg_attr(test, feature(test))]

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

Expand Down
3 changes: 2 additions & 1 deletion src/libstd/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@
// std may use features in a platform-specific way
#![allow(unused_features)]

#![cfg_attr(test, feature(print_internals, set_stdio, test, update_panic_count))]
#![cfg_attr(test, feature(print_internals, set_stdio, update_panic_count))]
#![cfg_attr(all(target_vendor = "fortanix", target_env = "sgx"),
feature(slice_index_methods, decl_macro, coerce_unsized,
sgx_platform, ptr_wrapping_offset_from))]
Expand Down Expand Up @@ -304,6 +304,7 @@
#![feature(stdsimd)]
#![feature(stmt_expr_attributes)]
#![feature(str_internals)]
#![feature(test)]
#![feature(thread_local)]
#![feature(todo_macro)]
#![feature(toowned_clone_into)]
Expand Down
2 changes: 0 additions & 2 deletions src/libstd/prelude/v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,7 @@ pub use core::prelude::v1::{
Clone,
Copy,
Debug,
Decodable,
Default,
Encodable,
Eq,
Hash,
Ord,
Expand Down
18 changes: 1 addition & 17 deletions src/libsyntax_ext/deriving/decodable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,7 @@ pub fn expand_deriving_rustc_decodable(cx: &mut ExtCtxt<'_>,
mitem: &MetaItem,
item: &Annotatable,
push: &mut dyn FnMut(Annotatable)) {
expand_deriving_decodable_imp(cx, span, mitem, item, push, "rustc_serialize")
}

pub fn expand_deriving_decodable(cx: &mut ExtCtxt<'_>,
span: Span,
mitem: &MetaItem,
item: &Annotatable,
push: &mut dyn FnMut(Annotatable)) {
expand_deriving_decodable_imp(cx, span, mitem, item, push, "serialize")
}

fn expand_deriving_decodable_imp(cx: &mut ExtCtxt<'_>,
span: Span,
mitem: &MetaItem,
item: &Annotatable,
push: &mut dyn FnMut(Annotatable),
krate: &'static str) {
let krate = "rustc_serialize";
let typaram = &*deriving::hygienic_type_parameter(item, "__D");

let trait_def = TraitDef {
Expand Down
18 changes: 1 addition & 17 deletions src/libsyntax_ext/deriving/encodable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,23 +98,7 @@ pub fn expand_deriving_rustc_encodable(cx: &mut ExtCtxt<'_>,
mitem: &MetaItem,
item: &Annotatable,
push: &mut dyn FnMut(Annotatable)) {
expand_deriving_encodable_imp(cx, span, mitem, item, push, "rustc_serialize")
}

pub fn expand_deriving_encodable(cx: &mut ExtCtxt<'_>,
span: Span,
mitem: &MetaItem,
item: &Annotatable,
push: &mut dyn FnMut(Annotatable)) {
expand_deriving_encodable_imp(cx, span, mitem, item, push, "serialize")
}

fn expand_deriving_encodable_imp(cx: &mut ExtCtxt<'_>,
span: Span,
mitem: &MetaItem,
item: &Annotatable,
push: &mut dyn FnMut(Annotatable),
krate: &'static str) {
let krate = "rustc_serialize";
let typaram = &*deriving::hygienic_type_parameter(item, "__S");

let trait_def = TraitDef {
Expand Down
2 changes: 0 additions & 2 deletions src/libsyntax_ext/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,7 @@ pub fn register_builtin_macros(resolver: &mut dyn syntax::ext::base::Resolver, e
Clone: clone::expand_deriving_clone,
Copy: bounds::expand_deriving_copy,
Debug: debug::expand_deriving_debug,
Decodable: decodable::expand_deriving_decodable,
Default: default::expand_deriving_default,
Encodable: encodable::expand_deriving_encodable,
Eq: eq::expand_deriving_eq,
Hash: hash::expand_deriving_hash,
Ord: ord::expand_deriving_ord,
Expand Down
2 changes: 1 addition & 1 deletion src/libtest/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
// cargo) to detect this crate.

#![crate_name = "test"]
#![unstable(feature = "test", issue = "27812")]
#![unstable(feature = "test", issue = "50297")]
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/", test(attr(deny(warnings))))]
#![feature(asm)]
#![cfg_attr(any(unix, target_os = "cloudabi"), feature(libc, rustc_private))]
Expand Down
14 changes: 7 additions & 7 deletions src/test/run-make-fulldeps/pretty-expanded/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

// #13544

extern crate serialize;
extern crate serialize as rustc_serialize;

#[derive(Encodable)] pub struct A;
#[derive(Encodable)] pub struct B(isize);
#[derive(Encodable)] pub struct C { x: isize }
#[derive(Encodable)] pub enum D {}
#[derive(Encodable)] pub enum E { y }
#[derive(Encodable)] pub enum F { z(isize) }
#[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) }
5 changes: 3 additions & 2 deletions src/test/run-make-fulldeps/save-analysis/foo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -418,8 +418,9 @@ impl Error + 'static + Send {
<Error + 'static>::is::<T>(self)
}
}
extern crate serialize;
#[derive(Clone, Copy, Hash, Encodable, Decodable, PartialEq, Eq, PartialOrd, Ord, Debug, Default)]
extern crate serialize as rustc_serialize;
#[derive(Clone, Copy, Hash, RustcEncodable, RustcDecodable,
PartialEq, Eq, PartialOrd, Ord, Debug, Default)]
struct AllDerives(i32);

fn test_format_args() {
Expand Down
12 changes: 0 additions & 12 deletions src/test/ui-fulldeps/deprecated-derive.rs

This file was deleted.

8 changes: 0 additions & 8 deletions src/test/ui-fulldeps/deprecated-derive.stderr

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

// check-pass

#![feature(test)]
#![warn(unused_attributes, unknown_lints)]

// UNGATED WHITE-LISTED BUILT-IN ATTRIBUTES
Expand Down
Loading

0 comments on commit f23a5f2

Please sign in to comment.