From 5b3462c556932234c6bae24c6f90c55a463f23c3 Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Fri, 14 Jan 2022 09:50:49 +0100 Subject: [PATCH] update cfg(bootstrap)s --- compiler/rustc_expand/src/lib.rs | 1 - compiler/rustc_middle/src/query/mod.rs | 21 +++-------- library/alloc/src/lib.rs | 20 +++++------ library/core/src/cell.rs | 12 ++----- library/core/src/future/into_future.rs | 2 +- library/core/src/lib.rs | 49 ++++++++++++-------------- library/core/src/macros/mod.rs | 1 - library/core/src/prelude/v1.rs | 1 - library/core/tests/cmp.rs | 1 - library/core/tests/intrinsics.rs | 1 - library/core/tests/ptr.rs | 1 - library/std/src/lib.rs | 18 ++++------ library/std/src/prelude/v1.rs | 1 - library/std/src/sync/mutex.rs | 7 ++-- library/std/src/sync/rwlock.rs | 14 +++----- src/bootstrap/builder.rs | 17 +++------ 16 files changed, 55 insertions(+), 112 deletions(-) diff --git a/compiler/rustc_expand/src/lib.rs b/compiler/rustc_expand/src/lib.rs index 5599c1df6d9..dfc07da9169 100644 --- a/compiler/rustc_expand/src/lib.rs +++ b/compiler/rustc_expand/src/lib.rs @@ -2,7 +2,6 @@ #![feature(associated_type_defaults)] #![feature(crate_visibility_modifier)] #![feature(decl_macro)] -#![cfg_attr(bootstrap, feature(destructuring_assignment))] #![feature(if_let_guard)] #![feature(let_else)] #![feature(proc_macro_diagnostic)] diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs index 5dc7b219642..cc72de7c548 100644 --- a/compiler/rustc_middle/src/query/mod.rs +++ b/compiler/rustc_middle/src/query/mod.rs @@ -784,24 +784,11 @@ rustc_queries! { desc { |tcx| "type-checking `{}`", tcx.def_path_str(key.to_def_id()) } cache_on_disk_if { true } load_cached(tcx, id) { - #[cfg(bootstrap)] - { - match match tcx.on_disk_cache().as_ref() { - Some(c) => c.try_load_query_result(*tcx, id), - None => None, - } { - Some(x) => Some(&*tcx.arena.alloc(x)), - None => None, - } - } - #[cfg(not(bootstrap))] - { - let typeck_results: Option> = tcx - .on_disk_cache().as_ref() - .and_then(|c| c.try_load_query_result(*tcx, id)); + let typeck_results: Option> = tcx + .on_disk_cache().as_ref() + .and_then(|c| c.try_load_query_result(*tcx, id)); - typeck_results.map(|x| &*tcx.arena.alloc(x)) - } + typeck_results.map(|x| &*tcx.arena.alloc(x)) } } diff --git a/library/alloc/src/lib.rs b/library/alloc/src/lib.rs index 1cbc2b65f4d..dfd3771c1d0 100644 --- a/library/alloc/src/lib.rs +++ b/library/alloc/src/lib.rs @@ -67,17 +67,14 @@ issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/", test(no_crate_inject, attr(allow(unused_variables), deny(warnings))) )] -#![cfg_attr( - not(bootstrap), - doc(cfg_hide( - not(test), - not(any(test, bootstrap)), - any(not(feature = "miri-test-libstd"), test, doctest), - no_global_oom_handling, - not(no_global_oom_handling), - target_has_atomic = "ptr" - )) -)] +#![doc(cfg_hide( + not(test), + not(any(test, bootstrap)), + any(not(feature = "miri-test-libstd"), test, doctest), + no_global_oom_handling, + not(no_global_oom_handling), + target_has_atomic = "ptr" +))] #![no_std] #![needs_allocator] // @@ -151,7 +148,6 @@ #![feature(const_precise_live_drops)] #![feature(const_trait_impl)] #![feature(const_try)] -#![cfg_attr(bootstrap, feature(destructuring_assignment))] #![feature(dropck_eyepatch)] #![feature(exclusive_range_pattern)] #![feature(fundamental)] diff --git a/library/core/src/cell.rs b/library/core/src/cell.rs index bc3f7167fac..5fd60b75928 100644 --- a/library/core/src/cell.rs +++ b/library/core/src/cell.rs @@ -1310,11 +1310,7 @@ impl Clone for BorrowRef<'_> { /// /// See the [module-level documentation](self) for more. #[stable(feature = "rust1", since = "1.0.0")] -#[cfg_attr( - not(bootstrap), - must_not_suspend = "holding a Ref across suspend \ - points can cause BorrowErrors" -)] +#[must_not_suspend = "holding a Ref across suspend points can cause BorrowErrors"] pub struct Ref<'b, T: ?Sized + 'b> { value: &'b T, borrow: BorrowRef<'b>, @@ -1692,11 +1688,7 @@ impl<'b> BorrowRefMut<'b> { /// /// See the [module-level documentation](self) for more. #[stable(feature = "rust1", since = "1.0.0")] -#[cfg_attr( - not(bootstrap), - must_not_suspend = "holding a RefMut across suspend \ - points can cause BorrowErrors" -)] +#[must_not_suspend = "holding a RefMut across suspend points can cause BorrowErrors"] pub struct RefMut<'b, T: ?Sized + 'b> { value: &'b mut T, borrow: BorrowRefMut<'b>, diff --git a/library/core/src/future/into_future.rs b/library/core/src/future/into_future.rs index cac1866188e..0912f8675fa 100644 --- a/library/core/src/future/into_future.rs +++ b/library/core/src/future/into_future.rs @@ -13,7 +13,7 @@ pub trait IntoFuture { /// Creates a future from a value. #[unstable(feature = "into_future", issue = "67644")] - #[cfg_attr(not(bootstrap), lang = "into_future")] + #[lang = "into_future"] fn into_future(self) -> Self::Future; } diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs index d8ac816fb15..f88eb5e31b8 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs @@ -60,32 +60,29 @@ test(no_crate_inject, attr(deny(warnings))), test(attr(allow(dead_code, deprecated, unused_variables, unused_mut))) )] -#![cfg_attr( - not(bootstrap), - doc(cfg_hide( - not(test), - any(not(feature = "miri-test-libstd"), test, doctest), - no_fp_fmt_parse, - target_pointer_width = "16", - target_pointer_width = "32", - target_pointer_width = "64", - target_has_atomic = "8", - target_has_atomic = "16", - target_has_atomic = "32", - target_has_atomic = "64", - target_has_atomic = "ptr", - target_has_atomic_equal_alignment = "8", - target_has_atomic_equal_alignment = "16", - target_has_atomic_equal_alignment = "32", - target_has_atomic_equal_alignment = "64", - target_has_atomic_equal_alignment = "ptr", - target_has_atomic_load_store = "8", - target_has_atomic_load_store = "16", - target_has_atomic_load_store = "32", - target_has_atomic_load_store = "64", - target_has_atomic_load_store = "ptr", - )) -)] +#![doc(cfg_hide( + not(test), + any(not(feature = "miri-test-libstd"), test, doctest), + no_fp_fmt_parse, + target_pointer_width = "16", + target_pointer_width = "32", + target_pointer_width = "64", + target_has_atomic = "8", + target_has_atomic = "16", + target_has_atomic = "32", + target_has_atomic = "64", + target_has_atomic = "ptr", + target_has_atomic_equal_alignment = "8", + target_has_atomic_equal_alignment = "16", + target_has_atomic_equal_alignment = "32", + target_has_atomic_equal_alignment = "64", + target_has_atomic_equal_alignment = "ptr", + target_has_atomic_load_store = "8", + target_has_atomic_load_store = "16", + target_has_atomic_load_store = "32", + target_has_atomic_load_store = "64", + target_has_atomic_load_store = "ptr", +))] #![no_core] // // Lints: diff --git a/library/core/src/macros/mod.rs b/library/core/src/macros/mod.rs index 488bb875c35..0cc428d6962 100644 --- a/library/core/src/macros/mod.rs +++ b/library/core/src/macros/mod.rs @@ -1003,7 +1003,6 @@ pub(crate) mod builtin { /// assert_eq!(s, b"ABCDEF"); /// # } /// ``` - #[cfg(not(bootstrap))] #[unstable(feature = "concat_bytes", issue = "87555")] #[rustc_builtin_macro] #[macro_export] diff --git a/library/core/src/prelude/v1.rs b/library/core/src/prelude/v1.rs index d91289fad20..b566e211cd8 100644 --- a/library/core/src/prelude/v1.rs +++ b/library/core/src/prelude/v1.rs @@ -65,7 +65,6 @@ pub use crate::{ issue = "87555", reason = "`concat_bytes` is not stable enough for use and is subject to change" )] -#[cfg(not(bootstrap))] #[doc(no_inline)] pub use crate::concat_bytes; diff --git a/library/core/tests/cmp.rs b/library/core/tests/cmp.rs index 58fee19ca74..2b234de6795 100644 --- a/library/core/tests/cmp.rs +++ b/library/core/tests/cmp.rs @@ -204,7 +204,6 @@ fn cmp_default() { assert_eq!(Fool(false), Fool(true)); } -#[cfg(not(bootstrap))] mod const_cmp { use super::*; diff --git a/library/core/tests/intrinsics.rs b/library/core/tests/intrinsics.rs index 7a2e4e29065..ff0a8fe27ae 100644 --- a/library/core/tests/intrinsics.rs +++ b/library/core/tests/intrinsics.rs @@ -37,7 +37,6 @@ fn test_assume_can_be_in_const_contexts() { } #[test] -#[cfg(not(bootstrap))] const fn test_write_bytes_in_const_contexts() { use core::intrinsics::write_bytes; diff --git a/library/core/tests/ptr.rs b/library/core/tests/ptr.rs index b9c0d75b702..171d0d8dfb7 100644 --- a/library/core/tests/ptr.rs +++ b/library/core/tests/ptr.rs @@ -251,7 +251,6 @@ fn test_set_memory() { } #[test] -#[cfg(not(bootstrap))] fn test_set_memory_const() { const XS: [u8; 20] = { let mut xs = [0u8; 20]; diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs index 17fe0011569..6c54a8e7de6 100644 --- a/library/std/src/lib.rs +++ b/library/std/src/lib.rs @@ -195,15 +195,12 @@ test(no_crate_inject, attr(deny(warnings))), test(attr(allow(dead_code, deprecated, unused_variables, unused_mut))) )] -#![cfg_attr( - not(bootstrap), - doc(cfg_hide( - not(test), - not(any(test, bootstrap)), - no_global_oom_handling, - not(no_global_oom_handling) - )) -)] +#![doc(cfg_hide( + not(test), + not(any(test, bootstrap)), + no_global_oom_handling, + not(no_global_oom_handling) +))] // Don't link to std. We are std. #![no_std] #![warn(deprecated_in_future)] @@ -249,7 +246,7 @@ #![feature(cfg_target_thread_local)] #![feature(char_error_internals)] #![feature(char_internals)] -#![cfg_attr(not(bootstrap), feature(concat_bytes))] +#![feature(concat_bytes)] #![feature(concat_idents)] #![feature(const_fn_floating_point_arithmetic)] #![feature(const_fn_fn_ptr_basics)] @@ -578,7 +575,6 @@ pub use core::{ issue = "87555", reason = "`concat_bytes` is not stable enough for use and is subject to change" )] -#[cfg(not(bootstrap))] pub use core::concat_bytes; #[stable(feature = "core_primitive", since = "1.43.0")] diff --git a/library/std/src/prelude/v1.rs b/library/std/src/prelude/v1.rs index 53124daa3a6..0226c4d7a25 100644 --- a/library/std/src/prelude/v1.rs +++ b/library/std/src/prelude/v1.rs @@ -49,7 +49,6 @@ pub use core::prelude::v1::{ issue = "87555", reason = "`concat_bytes` is not stable enough for use and is subject to change" )] -#[cfg(not(bootstrap))] #[doc(no_inline)] pub use core::prelude::v1::concat_bytes; diff --git a/library/std/src/sync/mutex.rs b/library/std/src/sync/mutex.rs index 57f1dcca30e..3ea0a6c3937 100644 --- a/library/std/src/sync/mutex.rs +++ b/library/std/src/sync/mutex.rs @@ -188,12 +188,9 @@ unsafe impl Sync for Mutex {} /// [`lock`]: Mutex::lock /// [`try_lock`]: Mutex::try_lock #[must_use = "if unused the Mutex will immediately unlock"] -#[cfg_attr( - not(bootstrap), - must_not_suspend = "holding a MutexGuard across suspend \ +#[must_not_suspend = "holding a MutexGuard across suspend \ points can cause deadlocks, delays, \ - and cause Futures to not implement `Send`" -)] + and cause Futures to not implement `Send`"] #[stable(feature = "rust1", since = "1.0.0")] pub struct MutexGuard<'a, T: ?Sized + 'a> { lock: &'a Mutex, diff --git a/library/std/src/sync/rwlock.rs b/library/std/src/sync/rwlock.rs index 2f4395ceefd..2e72a9ef54e 100644 --- a/library/std/src/sync/rwlock.rs +++ b/library/std/src/sync/rwlock.rs @@ -95,12 +95,9 @@ unsafe impl Sync for RwLock {} /// [`read`]: RwLock::read /// [`try_read`]: RwLock::try_read #[must_use = "if unused the RwLock will immediately unlock"] -#[cfg_attr( - not(bootstrap), - must_not_suspend = "holding a RwLockReadGuard across suspend \ +#[must_not_suspend = "holding a RwLockReadGuard across suspend \ points can cause deadlocks, delays, \ - and cause Futures to not implement `Send`" -)] + and cause Futures to not implement `Send`"] #[stable(feature = "rust1", since = "1.0.0")] pub struct RwLockReadGuard<'a, T: ?Sized + 'a> { lock: &'a RwLock, @@ -121,12 +118,9 @@ unsafe impl Sync for RwLockReadGuard<'_, T> {} /// [`write`]: RwLock::write /// [`try_write`]: RwLock::try_write #[must_use = "if unused the RwLock will immediately unlock"] -#[cfg_attr( - not(bootstrap), - must_not_suspend = "holding a RwLockWriteGuard across suspend \ +#[must_not_suspend = "holding a RwLockWriteGuard across suspend \ points can cause deadlocks, delays, \ - and cause Future's to not implement `Send`" -)] + and cause Future's to not implement `Send`"] #[stable(feature = "rust1", since = "1.0.0")] pub struct RwLockWriteGuard<'a, T: ?Sized + 'a> { lock: &'a RwLock, diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 6ccf8b1d522..d399e0b9a46 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -988,20 +988,11 @@ impl<'a> Builder<'a> { } }; - // cfg(bootstrap) -- drop the compiler.stage == 0 branch. - if compiler.stage == 0 { - if use_new_symbol_mangling { - rustflags.arg("-Zsymbol-mangling-version=v0"); - } else { - rustflags.arg("-Zsymbol-mangling-version=legacy"); - } + if use_new_symbol_mangling { + rustflags.arg("-Csymbol-mangling-version=v0"); } else { - if use_new_symbol_mangling { - rustflags.arg("-Csymbol-mangling-version=v0"); - } else { - rustflags.arg("-Csymbol-mangling-version=legacy"); - rustflags.arg("-Zunstable-options"); - } + rustflags.arg("-Csymbol-mangling-version=legacy"); + rustflags.arg("-Zunstable-options"); } // FIXME: It might be better to use the same value for both `RUSTFLAGS` and `RUSTDOCFLAGS`,