From b221c877e89c701fa138e8d6ef1d615391491a14 Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Tue, 30 Nov 2021 10:50:44 -0500 Subject: [PATCH] Apply cfg-bootstrap switch --- compiler/rustc_borrowck/src/lib.rs | 1 - compiler/rustc_errors/src/lib.rs | 1 - compiler/rustc_expand/src/lib.rs | 1 - compiler/rustc_lint/src/lib.rs | 1 - compiler/rustc_passes/src/lib.rs | 1 - compiler/rustc_resolve/src/lib.rs | 1 - compiler/rustc_typeck/src/lib.rs | 1 - library/alloc/src/lib.rs | 1 - library/core/src/array/mod.rs | 5 ----- library/core/src/lib.rs | 8 ++------ library/core/src/mem/maybe_uninit.rs | 1 - library/core/src/ops/generator.rs | 2 +- library/core/src/slice/raw.rs | 4 ++-- library/core/src/time.rs | 5 ----- library/core/tests/lib.rs | 4 +--- library/std/src/lib.rs | 10 +++------- 16 files changed, 9 insertions(+), 38 deletions(-) diff --git a/compiler/rustc_borrowck/src/lib.rs b/compiler/rustc_borrowck/src/lib.rs index 76d3a83b48d..ceaae9d66cd 100644 --- a/compiler/rustc_borrowck/src/lib.rs +++ b/compiler/rustc_borrowck/src/lib.rs @@ -3,7 +3,6 @@ #![feature(bool_to_option)] #![feature(box_patterns)] #![feature(crate_visibility_modifier)] -#![cfg_attr(bootstrap, feature(format_args_capture))] #![feature(in_band_lifetimes)] #![feature(iter_zip)] #![feature(let_else)] diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index bb3d3a415e7..65c2614c102 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -6,7 +6,6 @@ #![feature(crate_visibility_modifier)] #![feature(backtrace)] #![feature(if_let_guard)] -#![cfg_attr(bootstrap, feature(format_args_capture))] #![feature(iter_zip)] #![feature(let_else)] #![feature(nll)] diff --git a/compiler/rustc_expand/src/lib.rs b/compiler/rustc_expand/src/lib.rs index 4e84a9df6c9..c721c4b8d7c 100644 --- a/compiler/rustc_expand/src/lib.rs +++ b/compiler/rustc_expand/src/lib.rs @@ -1,7 +1,6 @@ #![feature(crate_visibility_modifier)] #![feature(decl_macro)] #![feature(destructuring_assignment)] -#![cfg_attr(bootstrap, feature(format_args_capture))] #![feature(if_let_guard)] #![feature(iter_zip)] #![feature(let_else)] diff --git a/compiler/rustc_lint/src/lib.rs b/compiler/rustc_lint/src/lib.rs index 507b4421fa1..2d6be5527b2 100644 --- a/compiler/rustc_lint/src/lib.rs +++ b/compiler/rustc_lint/src/lib.rs @@ -30,7 +30,6 @@ #![feature(bool_to_option)] #![feature(box_patterns)] #![feature(crate_visibility_modifier)] -#![cfg_attr(bootstrap, feature(format_args_capture))] #![feature(iter_order_by)] #![feature(iter_zip)] #![feature(never_type)] diff --git a/compiler/rustc_passes/src/lib.rs b/compiler/rustc_passes/src/lib.rs index af1c7244100..d01b74930c9 100644 --- a/compiler/rustc_passes/src/lib.rs +++ b/compiler/rustc_passes/src/lib.rs @@ -7,7 +7,6 @@ #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![feature(crate_visibility_modifier)] #![feature(in_band_lifetimes)] -#![cfg_attr(bootstrap, feature(format_args_capture))] #![feature(iter_zip)] #![feature(map_try_insert)] #![feature(min_specialization)] diff --git a/compiler/rustc_resolve/src/lib.rs b/compiler/rustc_resolve/src/lib.rs index d17e8875a1e..f1e5f483044 100644 --- a/compiler/rustc_resolve/src/lib.rs +++ b/compiler/rustc_resolve/src/lib.rs @@ -13,7 +13,6 @@ #![feature(drain_filter)] #![feature(bool_to_option)] #![feature(crate_visibility_modifier)] -#![cfg_attr(bootstrap, feature(format_args_capture))] #![feature(iter_zip)] #![feature(let_else)] #![feature(never_type)] diff --git a/compiler/rustc_typeck/src/lib.rs b/compiler/rustc_typeck/src/lib.rs index c0f0b3fe704..f87cbb7f417 100644 --- a/compiler/rustc_typeck/src/lib.rs +++ b/compiler/rustc_typeck/src/lib.rs @@ -58,7 +58,6 @@ #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![feature(bool_to_option)] #![feature(crate_visibility_modifier)] -#![cfg_attr(bootstrap, feature(format_args_capture))] #![feature(if_let_guard)] #![feature(in_band_lifetimes)] #![feature(is_sorted)] diff --git a/library/alloc/src/lib.rs b/library/alloc/src/lib.rs index 4a66c3f6b2e..1bb257acff7 100644 --- a/library/alloc/src/lib.rs +++ b/library/alloc/src/lib.rs @@ -105,7 +105,6 @@ #![feature(fmt_internals)] #![feature(fn_traits)] #![feature(inherent_ascii_escape)] -#![cfg_attr(bootstrap, feature(format_args_capture))] #![feature(inplace_iteration)] #![feature(iter_advance_by)] #![feature(iter_zip)] diff --git a/library/core/src/array/mod.rs b/library/core/src/array/mod.rs index 09bb4519170..39ccbaaaf7b 100644 --- a/library/core/src/array/mod.rs +++ b/library/core/src/array/mod.rs @@ -330,11 +330,9 @@ fn index_mut(&mut self, index: I) -> &mut Self::Output { } } -#[cfg(not(bootstrap))] #[stable(feature = "copy_clone_array_lib", since = "1.58.0")] impl Copy for [T; N] {} -#[cfg(not(bootstrap))] #[stable(feature = "copy_clone_array_lib", since = "1.58.0")] impl Clone for [T; N] { #[inline] @@ -348,12 +346,10 @@ fn clone_from(&mut self, other: &Self) { } } -#[cfg(not(bootstrap))] trait SpecArrayClone: Clone { fn clone(array: &[Self; N]) -> [Self; N]; } -#[cfg(not(bootstrap))] impl SpecArrayClone for T { #[inline] default fn clone(array: &[T; N]) -> [T; N] { @@ -363,7 +359,6 @@ impl SpecArrayClone for T { } } -#[cfg(not(bootstrap))] impl SpecArrayClone for T { #[inline] fn clone(array: &[T; N]) -> [T; N] { diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs index 102e6f89eb8..b0f9368b0c0 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs @@ -159,14 +159,12 @@ #![feature(const_impl_trait)] #![feature(const_mut_refs)] #![feature(const_precise_live_drops)] -#![cfg_attr(bootstrap, feature(const_raw_ptr_deref))] #![feature(const_refs_to_cell)] #![feature(decl_macro)] #![feature(derive_default_enum)] #![feature(doc_cfg)] #![feature(doc_notable_trait)] -#![cfg_attr(bootstrap, feature(doc_primitive))] -#![cfg_attr(not(bootstrap), feature(rustdoc_internals))] +#![feature(rustdoc_internals)] #![feature(exhaustive_patterns)] #![feature(doc_cfg_hide)] #![feature(extern_types)] @@ -198,7 +196,7 @@ #![feature(try_blocks)] #![feature(unboxed_closures)] #![feature(unsized_fn_params)] -#![cfg_attr(not(bootstrap), feature(asm_const))] +#![feature(asm_const)] // // Target features: #![feature(aarch64_target_feature)] @@ -408,13 +406,11 @@ pub mod arch { #[allow(rustdoc::bare_urls)] #[unstable(feature = "portable_simd", issue = "86656")] #[cfg(not(all(miri, doctest)))] // Miri does not support all SIMD intrinsics -#[cfg(not(bootstrap))] mod core_simd; #[doc = include_str!("../../portable-simd/crates/core_simd/src/core_simd_docs.md")] #[unstable(feature = "portable_simd", issue = "86656")] #[cfg(not(all(miri, doctest)))] // Miri does not support all SIMD intrinsics -#[cfg(not(bootstrap))] pub mod simd { #[unstable(feature = "portable_simd", issue = "86656")] pub use crate::core_simd::simd::*; diff --git a/library/core/src/mem/maybe_uninit.rs b/library/core/src/mem/maybe_uninit.rs index a6e31452edc..9a29094b52c 100644 --- a/library/core/src/mem/maybe_uninit.rs +++ b/library/core/src/mem/maybe_uninit.rs @@ -789,7 +789,6 @@ pub unsafe fn assume_init_drop(&mut self) { /// ``` #[stable(feature = "maybe_uninit_ref", since = "1.55.0")] #[rustc_const_stable(feature = "const_maybe_uninit_assume_init", since = "1.59.0")] - #[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_raw_ptr_deref))] #[inline(always)] pub const unsafe fn assume_init_ref(&self) -> &T { // SAFETY: the caller must guarantee that `self` is initialized. diff --git a/library/core/src/ops/generator.rs b/library/core/src/ops/generator.rs index b527c4b04ad..52a2e464e3a 100644 --- a/library/core/src/ops/generator.rs +++ b/library/core/src/ops/generator.rs @@ -82,7 +82,7 @@ pub trait Generator { /// `return` statement or implicitly as the last expression of a generator /// literal. For example futures would use this as `Result` as it /// represents a completed future. - #[cfg_attr(not(bootstrap), lang = "generator_return")] + #[lang = "generator_return"] type Return; /// Resumes the execution of this generator. diff --git a/library/core/src/slice/raw.rs b/library/core/src/slice/raw.rs index 81bb16d5401..d98db3f57c0 100644 --- a/library/core/src/slice/raw.rs +++ b/library/core/src/slice/raw.rs @@ -131,7 +131,7 @@ } // In debug builds checks that `data` pointer is aligned and non-null and that slice with given `len` would cover less than half the address space -#[cfg(all(not(bootstrap), debug_assertions))] +#[cfg(debug_assertions)] #[unstable(feature = "const_slice_from_raw_parts", issue = "67456")] #[rustc_const_unstable(feature = "const_slice_from_raw_parts", issue = "67456")] const fn debug_check_data_len(data: *const T, len: usize) { @@ -161,7 +161,7 @@ const fn noop(_: *const T) {} ); } -#[cfg(not(all(not(bootstrap), debug_assertions)))] +#[cfg(not(debug_assertions))] const fn debug_check_data_len(_data: *const T, _len: usize) {} /// Converts a reference to T into a slice of length 1 (without copying). diff --git a/library/core/src/time.rs b/library/core/src/time.rs index 5efa04f7e5c..746d1cacfd0 100644 --- a/library/core/src/time.rs +++ b/library/core/src/time.rs @@ -182,7 +182,6 @@ impl Duration { #[inline] #[must_use] #[rustc_const_stable(feature = "duration_consts_2", since = "1.58.0")] - #[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_panic))] pub const fn new(secs: u64, nanos: u32) -> Duration { let secs = match secs.checked_add((nanos / NANOS_PER_SEC) as u64) { Some(secs) => secs, @@ -482,7 +481,6 @@ pub const fn as_nanos(&self) -> u128 { without modifying the original"] #[inline] #[rustc_const_stable(feature = "duration_consts_2", since = "1.58.0")] - #[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_panic))] pub const fn checked_add(self, rhs: Duration) -> Option { if let Some(mut secs) = self.secs.checked_add(rhs.secs) { let mut nanos = self.nanos + rhs.nanos; @@ -543,7 +541,6 @@ pub const fn saturating_add(self, rhs: Duration) -> Duration { without modifying the original"] #[inline] #[rustc_const_stable(feature = "duration_consts_2", since = "1.58.0")] - #[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_panic))] pub const fn checked_sub(self, rhs: Duration) -> Option { if let Some(mut secs) = self.secs.checked_sub(rhs.secs) { let nanos = if self.nanos >= rhs.nanos { @@ -602,7 +599,6 @@ pub const fn saturating_sub(self, rhs: Duration) -> Duration { without modifying the original"] #[inline] #[rustc_const_stable(feature = "duration_consts_2", since = "1.58.0")] - #[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_panic))] pub const fn checked_mul(self, rhs: u32) -> Option { // Multiply nanoseconds as u64, because it cannot overflow that way. let total_nanos = self.nanos as u64 * rhs as u64; @@ -660,7 +656,6 @@ pub const fn saturating_mul(self, rhs: u32) -> Duration { without modifying the original"] #[inline] #[rustc_const_stable(feature = "duration_consts_2", since = "1.58.0")] - #[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_panic))] pub const fn checked_div(self, rhs: u32) -> Option { if rhs != 0 { let secs = self.secs / (rhs as u64); diff --git a/library/core/tests/lib.rs b/library/core/tests/lib.rs index 00d0259321d..908631afd93 100644 --- a/library/core/tests/lib.rs +++ b/library/core/tests/lib.rs @@ -58,11 +58,10 @@ #![feature(const_mut_refs)] #![feature(const_pin)] #![feature(const_slice_from_raw_parts)] -#![cfg_attr(bootstrap, feature(const_raw_ptr_deref))] #![feature(never_type)] #![feature(unwrap_infallible)] #![feature(result_into_ok_or_err)] -#![cfg_attr(not(bootstrap), feature(portable_simd))] +#![feature(portable_simd)] #![feature(ptr_metadata)] #![feature(once_cell)] #![feature(unsized_tuple_coercion)] @@ -108,7 +107,6 @@ mod pin; mod ptr; mod result; -#[cfg(not(bootstrap))] mod simd; mod slice; mod str; diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs index 504c3b7e9f9..41b94cb294c 100644 --- a/library/std/src/lib.rs +++ b/library/std/src/lib.rs @@ -264,8 +264,7 @@ #![feature(const_ipv4)] #![feature(const_ipv6)] #![feature(const_option)] -#![cfg_attr(bootstrap, feature(const_raw_ptr_deref))] -#![cfg_attr(not(bootstrap), feature(const_mut_refs))] +#![feature(const_mut_refs)] #![feature(const_socketaddr)] #![feature(const_trait_impl)] #![feature(container_error_extra)] @@ -275,9 +274,7 @@ #![feature(decl_macro)] #![feature(doc_cfg)] #![feature(doc_cfg_hide)] -#![cfg_attr(bootstrap, feature(doc_primitive))] -#![cfg_attr(bootstrap, feature(doc_keyword))] -#![cfg_attr(not(bootstrap), feature(rustdoc_internals))] +#![feature(rustdoc_internals)] #![feature(doc_masked)] #![feature(doc_notable_trait)] #![feature(dropck_eyepatch)] @@ -323,7 +320,7 @@ #![feature(panic_internals)] #![feature(panic_unwind)] #![feature(pin_static_ref)] -#![cfg_attr(not(bootstrap), feature(portable_simd))] +#![feature(portable_simd)] #![feature(prelude_import)] #![feature(ptr_internals)] #![feature(rustc_attrs)] @@ -476,7 +473,6 @@ #[stable(feature = "rust1", since = "1.0.0")] pub use core::result; #[unstable(feature = "portable_simd", issue = "86656")] -#[cfg(not(bootstrap))] pub use core::simd; #[unstable(feature = "async_stream", issue = "79024")] pub use core::stream;