From e0c5ed0c182918093002acd10caaa0cb8ec8044a Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Wed, 4 Aug 2021 19:00:46 +0200 Subject: [PATCH 1/4] Sort and categorize #![feature]s in alloc. --- library/alloc/src/lib.rs | 94 ++++++++++++++++++++++------------------ 1 file changed, 52 insertions(+), 42 deletions(-) diff --git a/library/alloc/src/lib.rs b/library/alloc/src/lib.rs index 635708fd4cf6e..a143c4e8dde41 100644 --- a/library/alloc/src/lib.rs +++ b/library/alloc/src/lib.rs @@ -80,87 +80,97 @@ )] #![no_std] #![needs_allocator] +// +// Lints: +#![deny(unsafe_op_in_unsafe_fn)] #![warn(deprecated_in_future)] -#![warn(missing_docs)] #![warn(missing_debug_implementations)] +#![warn(missing_docs)] #![allow(explicit_outlives_requirements)] -#![deny(unsafe_op_in_unsafe_fn)] -#![feature(rustc_allow_const_fn_unstable)] -#![cfg_attr(not(test), feature(generator_trait))] -#![cfg_attr(test, feature(test))] -#![cfg_attr(test, feature(new_uninit))] +// +// Library features: +#![feature(alloc_layout_extra)] #![feature(allocator_api)] #![feature(array_chunks)] #![feature(array_methods)] #![feature(array_windows)] -#![feature(allow_internal_unstable)] -#![feature(arbitrary_self_types)] #![feature(async_stream)] -#![feature(box_patterns)] -#![feature(box_syntax)] -#![feature(cfg_sanitize)] -#![feature(cfg_target_has_atomic)] #![feature(coerce_unsized)] #![cfg_attr(not(no_global_oom_handling), feature(const_btree_new))] -#![feature(const_fn_trait_bound)] -#![feature(cow_is_borrowed)] #![feature(const_cow_is_borrowed)] -#![feature(const_trait_impl)] -#![feature(destructuring_assignment)] -#![feature(dispatch_from_dyn)] #![feature(core_intrinsics)] -#![feature(dropck_eyepatch)] +#![feature(cow_is_borrowed)] +#![feature(dispatch_from_dyn)] #![feature(exact_size_is_empty)] -#![feature(exclusive_range_pattern)] #![feature(extend_one)] #![feature(fmt_internals)] #![feature(fn_traits)] -#![feature(fundamental)] #![feature(inplace_iteration)] -// Technically, this is a bug in rustdoc: rustdoc sees the documentation on `#[lang = slice_alloc]` -// blocks is for `&[T]`, which also has documentation using this feature in `core`, and gets mad -// that the feature-gate isn't enabled. Ideally, it wouldn't check for the feature gate for docs -// from other crates, but since this can only appear for lang items, it doesn't seem worth fixing. -#![feature(intra_doc_pointers)] #![feature(iter_advance_by)] #![feature(iter_zip)] -#![feature(lang_items)] #![feature(layout_for_ptr)] -#![feature(negative_impls)] -#![feature(never_type)] -#![feature(nll)] +#![feature(maybe_uninit_extra)] +#![feature(maybe_uninit_slice)] +#![feature(maybe_uninit_uninit_array)] +#![cfg_attr(test, feature(new_uninit))] #![feature(nonnull_slice_from_raw_parts)] -#![feature(auto_traits)] #![feature(option_result_unwrap_unchecked)] #![feature(pattern)] #![feature(ptr_internals)] -#![feature(rustc_attrs)] #![feature(receiver_trait)] -#![feature(min_specialization)] #![feature(set_ptr_value)] +#![feature(slice_group_by)] +#![feature(slice_partition_dedup)] #![feature(slice_ptr_get)] #![feature(slice_ptr_len)] #![feature(slice_range)] -#![feature(staged_api)] #![feature(str_internals)] #![feature(trusted_len)] -#![feature(unboxed_closures)] +#![feature(trusted_random_access)] +#![feature(try_trait_v2)] #![feature(unicode_internals)] #![feature(unsize)] -#![feature(unsized_fn_params)] +// +// Language features: #![feature(allocator_internals)] -#![feature(slice_partition_dedup)] -#![feature(maybe_uninit_extra, maybe_uninit_slice, maybe_uninit_uninit_array)] -#![feature(alloc_layout_extra)] -#![feature(trusted_random_access)] -#![feature(try_trait_v2)] +#![feature(allow_internal_unstable)] +#![feature(arbitrary_self_types)] #![feature(associated_type_bounds)] -#![feature(slice_group_by)] +#![feature(auto_traits)] +#![feature(box_patterns)] +#![feature(box_syntax)] +#![feature(cfg_sanitize)] +#![feature(cfg_target_has_atomic)] +#![feature(const_fn_trait_bound)] +#![feature(const_trait_impl)] #![feature(decl_macro)] +#![feature(destructuring_assignment)] +#![feature(dropck_eyepatch)] +#![feature(exclusive_range_pattern)] +#![feature(fundamental)] +#![cfg_attr(not(test), feature(generator_trait))] +#![feature(lang_items)] +#![feature(min_specialization)] +#![feature(negative_impls)] +#![feature(never_type)] +#![feature(nll)] +#![feature(rustc_allow_const_fn_unstable)] +#![feature(rustc_attrs)] +#![feature(staged_api)] +#![cfg_attr(test, feature(test))] +#![feature(unboxed_closures)] +#![feature(unsized_fn_params)] +// +// Rustdoc features: #![feature(doc_cfg)] #![cfg_attr(not(bootstrap), feature(doc_cfg_hide))] -// Allow testing this library +// Technically, this is a bug in rustdoc: rustdoc sees the documentation on `#[lang = slice_alloc]` +// blocks is for `&[T]`, which also has documentation using this feature in `core`, and gets mad +// that the feature-gate isn't enabled. Ideally, it wouldn't check for the feature gate for docs +// from other crates, but since this can only appear for lang items, it doesn't seem worth fixing. +#![feature(intra_doc_pointers)] +// Allow testing this library #[cfg(test)] #[macro_use] extern crate std; From 4ddc1f2109232461c07e4b2e5f5a09f76a66e91f Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Wed, 4 Aug 2021 19:17:35 +0200 Subject: [PATCH 2/4] Remove unused library #![feature]s from alloc. --- library/alloc/src/lib.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/library/alloc/src/lib.rs b/library/alloc/src/lib.rs index a143c4e8dde41..c8ae9d9a38b06 100644 --- a/library/alloc/src/lib.rs +++ b/library/alloc/src/lib.rs @@ -99,7 +99,6 @@ #![cfg_attr(not(no_global_oom_handling), feature(const_btree_new))] #![feature(const_cow_is_borrowed)] #![feature(core_intrinsics)] -#![feature(cow_is_borrowed)] #![feature(dispatch_from_dyn)] #![feature(exact_size_is_empty)] #![feature(extend_one)] @@ -111,7 +110,6 @@ #![feature(layout_for_ptr)] #![feature(maybe_uninit_extra)] #![feature(maybe_uninit_slice)] -#![feature(maybe_uninit_uninit_array)] #![cfg_attr(test, feature(new_uninit))] #![feature(nonnull_slice_from_raw_parts)] #![feature(option_result_unwrap_unchecked)] @@ -120,7 +118,6 @@ #![feature(receiver_trait)] #![feature(set_ptr_value)] #![feature(slice_group_by)] -#![feature(slice_partition_dedup)] #![feature(slice_ptr_get)] #![feature(slice_ptr_len)] #![feature(slice_range)] From 2104ac5706df99777d7bb7bebc264d3f439fba9f Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Wed, 4 Aug 2021 19:17:35 +0200 Subject: [PATCH 3/4] Remove unused language #![feature]s from alloc. --- library/alloc/src/lib.rs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/library/alloc/src/lib.rs b/library/alloc/src/lib.rs index c8ae9d9a38b06..6f2c24422fda7 100644 --- a/library/alloc/src/lib.rs +++ b/library/alloc/src/lib.rs @@ -131,16 +131,12 @@ // Language features: #![feature(allocator_internals)] #![feature(allow_internal_unstable)] -#![feature(arbitrary_self_types)] #![feature(associated_type_bounds)] -#![feature(auto_traits)] -#![feature(box_patterns)] #![feature(box_syntax)] #![feature(cfg_sanitize)] #![feature(cfg_target_has_atomic)] #![feature(const_fn_trait_bound)] #![feature(const_trait_impl)] -#![feature(decl_macro)] #![feature(destructuring_assignment)] #![feature(dropck_eyepatch)] #![feature(exclusive_range_pattern)] @@ -150,7 +146,6 @@ #![feature(min_specialization)] #![feature(negative_impls)] #![feature(never_type)] -#![feature(nll)] #![feature(rustc_allow_const_fn_unstable)] #![feature(rustc_attrs)] #![feature(staged_api)] From 6fdcedc9c8eff1f56c1568bb936638f1249cd2aa Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Tue, 19 Oct 2021 14:54:35 +0200 Subject: [PATCH 4/4] Reenable feature(nll) in alloc. --- library/alloc/src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/library/alloc/src/lib.rs b/library/alloc/src/lib.rs index 6f2c24422fda7..285d7755c0689 100644 --- a/library/alloc/src/lib.rs +++ b/library/alloc/src/lib.rs @@ -146,6 +146,7 @@ #![feature(min_specialization)] #![feature(negative_impls)] #![feature(never_type)] +#![feature(nll)] // Not necessary, but here to test the `nll` feature. #![feature(rustc_allow_const_fn_unstable)] #![feature(rustc_attrs)] #![feature(staged_api)]