Remove derives Encodable/Decodable and unstabilize attribute #[bench]

This commit is contained in:
Vadim Petrochenkov 2019-07-27 15:06:49 +03:00
parent 9152fe4ea0
commit 73dae4eaf9
20 changed files with 224 additions and 298 deletions

View File

@ -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

View File

@ -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"]
@ -1309,18 +1310,6 @@ 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"]
@ -1328,18 +1317,6 @@ pub(crate) mod builtin {
#[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"]

View File

@ -54,9 +54,7 @@
Clone,
Copy,
Debug,
Decodable,
Default,
Encodable,
Eq,
Hash,
Ord,

View File

@ -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))]

View File

@ -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))]
@ -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)]

View File

@ -91,9 +91,7 @@
Clone,
Copy,
Debug,
Decodable,
Default,
Encodable,
Eq,
Hash,
Ord,

View File

@ -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 {

View File

@ -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 {

View File

@ -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,

View File

@ -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))]

View File

@ -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) }

View File

@ -418,8 +418,9 @@ pub fn is<T: Error + 'static>(&self) -> bool {
<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() {

View File

@ -1,12 +0,0 @@
// run-pass
#![feature(rustc_private)]
#![allow(dead_code)]
extern crate serialize;
#[derive(Encodable)]
//~^ WARNING derive(Encodable) is deprecated in favor of derive(RustcEncodable)
struct Test1;
fn main() { }

View File

@ -1,8 +0,0 @@
warning: use of deprecated item 'Encodable': derive(Encodable) is deprecated in favor of derive(RustcEncodable)
--> $DIR/deprecated-derive.rs:8:10
|
LL | #[derive(Encodable)]
| ^^^^^^^^^ help: replace the use of the deprecated item: `RustcEncodable`
|
= note: `#[warn(deprecated)]` on by default

View File

@ -32,6 +32,7 @@
// check-pass
#![feature(test)]
#![warn(unused_attributes, unknown_lints)]
// UNGATED WHITE-LISTED BUILT-IN ATTRIBUTES

View File

@ -2,6 +2,8 @@
//! Test that makes sure wrongly-typed bench functions aren't ignored
#![feature(test)]
#[bench]
fn foo() { } //~ ERROR functions used as benches

View File

@ -1,11 +1,11 @@
error: functions used as benches must have signature `fn(&mut Bencher) -> impl Termination`
--> $DIR/issue-12997-1.rs:6:1
--> $DIR/issue-12997-1.rs:8:1
|
LL | fn foo() { }
| ^^^^^^^^^^^^
error: functions used as benches must have signature `fn(&mut Bencher) -> impl Termination`
--> $DIR/issue-12997-1.rs:9:1
--> $DIR/issue-12997-1.rs:11:1
|
LL | fn bar(x: isize, y: isize) { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -2,6 +2,8 @@
//! Test that makes sure wrongly-typed bench functions are rejected
#![feature(test)]
#[bench]
fn bar(x: isize) { }
//~^ ERROR mismatched types

View File

@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/issue-12997-2.rs:6:1
--> $DIR/issue-12997-2.rs:8:1
|
LL | fn bar(x: isize) { }
| ^^^^^^^^^^^^^^^^^^^^ expected isize, found mutable reference