diff --git a/compiler/rustc_ast/src/token.rs b/compiler/rustc_ast/src/token.rs index 6646fa9446f..303bdd3a307 100644 --- a/compiler/rustc_ast/src/token.rs +++ b/compiler/rustc_ast/src/token.rs @@ -11,7 +11,7 @@ use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_data_structures::sync::Lrc; use rustc_macros::HashStable_Generic; use rustc_span::symbol::{kw, sym}; -#[cfg_attr(not(bootstrap), allow(hidden_glob_reexports))] +#[allow(hidden_glob_reexports)] use rustc_span::symbol::{Ident, Symbol}; use rustc_span::{self, edition::Edition, Span, DUMMY_SP}; use std::borrow::Cow; diff --git a/compiler/rustc_middle/src/ty/mod.rs b/compiler/rustc_middle/src/ty/mod.rs index 519bdb01623..638e1efa65c 100644 --- a/compiler/rustc_middle/src/ty/mod.rs +++ b/compiler/rustc_middle/src/ty/mod.rs @@ -149,7 +149,7 @@ mod opaque_types; mod parameterized; mod rvalue_scopes; mod structural_impls; -#[cfg_attr(not(bootstrap), allow(hidden_glob_reexports))] +#[allow(hidden_glob_reexports)] mod sty; mod typeck_results; diff --git a/compiler/rustc_trait_selection/src/traits/mod.rs b/compiler/rustc_trait_selection/src/traits/mod.rs index 1af8323b6e9..bc136695442 100644 --- a/compiler/rustc_trait_selection/src/traits/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/mod.rs @@ -13,12 +13,12 @@ mod object_safety; pub mod outlives_bounds; pub mod project; pub mod query; -#[cfg_attr(not(bootstrap), allow(hidden_glob_reexports))] +#[allow(hidden_glob_reexports)] mod select; mod specialize; mod structural_match; mod structural_normalize; -#[cfg_attr(not(bootstrap), allow(hidden_glob_reexports))] +#[allow(hidden_glob_reexports)] mod util; pub mod vtable; pub mod wf; diff --git a/library/alloc/src/alloc.rs b/library/alloc/src/alloc.rs index e24a0fe51bd..c8751ba4911 100644 --- a/library/alloc/src/alloc.rs +++ b/library/alloc/src/alloc.rs @@ -4,11 +4,7 @@ #[cfg(not(test))] use core::intrinsics; -#[cfg(all(bootstrap, not(test)))] -use core::intrinsics::{min_align_of_val, size_of_val}; -#[cfg(all(bootstrap, not(test)))] -use core::ptr::Unique; #[cfg(not(test))] use core::ptr::{self, NonNull}; @@ -337,23 +333,6 @@ unsafe fn exchange_malloc(size: usize, align: usize) -> *mut u8 { } } -#[cfg(all(bootstrap, not(test)))] -#[lang = "box_free"] -#[inline] -// This signature has to be the same as `Box`, otherwise an ICE will happen. -// When an additional parameter to `Box` is added (like `A: Allocator`), this has to be added here as -// well. -// For example if `Box` is changed to `struct Box(Unique, A)`, -// this function has to be changed to `fn box_free(Unique, A)` as well. -unsafe fn box_free(ptr: Unique, alloc: A) { - unsafe { - let size = size_of_val(ptr.as_ref()); - let align = min_align_of_val(ptr.as_ref()); - let layout = Layout::from_size_align_unchecked(size, align); - alloc.deallocate(From::from(ptr.cast()), layout) - } -} - // # Allocation error handler #[cfg(not(no_global_oom_handling))] diff --git a/library/alloc/tests/str.rs b/library/alloc/tests/str.rs index 0ba5d088f61..82c1a9f9ad7 100644 --- a/library/alloc/tests/str.rs +++ b/library/alloc/tests/str.rs @@ -1,4 +1,4 @@ -#![cfg_attr(not(bootstrap), allow(invalid_from_utf8))] +#![allow(invalid_from_utf8)] use std::assert_matches::assert_matches; use std::borrow::Cow; diff --git a/library/core/src/any.rs b/library/core/src/any.rs index 09f52d692d0..277c2f76a08 100644 --- a/library/core/src/any.rs +++ b/library/core/src/any.rs @@ -697,9 +697,6 @@ impl TypeId { #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature = "const_type_id", issue = "77125")] pub const fn of() -> TypeId { - #[cfg(bootstrap)] - let t = intrinsics::type_id::() as u128; - #[cfg(not(bootstrap))] let t: u128 = intrinsics::type_id::(); TypeId { t } } diff --git a/library/core/src/intrinsics.rs b/library/core/src/intrinsics.rs index 5a9a7013a19..deef68e4699 100644 --- a/library/core/src/intrinsics.rs +++ b/library/core/src/intrinsics.rs @@ -1057,23 +1057,6 @@ extern "rust-intrinsic" { #[rustc_const_unstable(feature = "const_type_id", issue = "77125")] #[rustc_safe_intrinsic] #[rustc_nounwind] - #[cfg(bootstrap)] - pub fn type_id() -> u64; - - /// Gets an identifier which is globally unique to the specified type. This - /// function will return the same value for a type regardless of whichever - /// crate it is invoked in. - /// - /// Note that, unlike most intrinsics, this is safe to call; - /// it does not require an `unsafe` block. - /// Therefore, implementations must not require the user to uphold - /// any safety invariants. - /// - /// The stabilized version of this intrinsic is [`core::any::TypeId::of`]. - #[rustc_const_unstable(feature = "const_type_id", issue = "77125")] - #[rustc_safe_intrinsic] - #[rustc_nounwind] - #[cfg(not(bootstrap))] pub fn type_id() -> u128; /// A guard for unsafe functions that cannot ever be executed if `T` is uninhabited: diff --git a/library/core/src/iter/adapters/flatten.rs b/library/core/src/iter/adapters/flatten.rs index d3e45456351..eee6e5bccec 100644 --- a/library/core/src/iter/adapters/flatten.rs +++ b/library/core/src/iter/adapters/flatten.rs @@ -310,7 +310,7 @@ where /// Real logic of both `Flatten` and `FlatMap` which simply delegate to /// this type. #[derive(Clone, Debug)] -#[cfg_attr(bootstrap, unstable(feature = "trusted_len", issue = "37572"))] +#[unstable(feature = "trusted_len", issue = "37572")] struct FlattenCompat { iter: Fuse, frontiter: Option, @@ -464,7 +464,6 @@ where } } -#[cfg_attr(bootstrap, unstable(feature = "trusted_len", issue = "37572"))] impl Iterator for FlattenCompat where I: Iterator>, @@ -579,7 +578,6 @@ where } } -#[cfg_attr(bootstrap, unstable(feature = "trusted_len", issue = "37572"))] impl DoubleEndedIterator for FlattenCompat where I: DoubleEndedIterator>, @@ -649,7 +647,6 @@ where } } -#[cfg_attr(bootstrap, unstable(feature = "trusted_len", issue = "37572"))] unsafe impl TrustedLen for FlattenCompat::IntoIter> where @@ -657,7 +654,6 @@ where { } -#[cfg_attr(bootstrap, unstable(feature = "trusted_len", issue = "37572"))] unsafe impl<'a, const N: usize, I, T> TrustedLen for FlattenCompat::IntoIter> where @@ -665,7 +661,6 @@ where { } -#[cfg_attr(bootstrap, unstable(feature = "trusted_len", issue = "37572"))] unsafe impl<'a, const N: usize, I, T> TrustedLen for FlattenCompat::IntoIter> where diff --git a/library/core/src/marker.rs b/library/core/src/marker.rs index e251015dd86..5ec751e5168 100644 --- a/library/core/src/marker.rs +++ b/library/core/src/marker.rs @@ -140,8 +140,7 @@ unsafe impl Send for &T {} )] #[fundamental] // for Default, for example, which requires that `[T]: !Default` be evaluatable #[rustc_specialization_trait] -#[cfg_attr(not(bootstrap), rustc_deny_explicit_impl(implement_via_object = false))] -#[cfg_attr(bootstrap, rustc_deny_explicit_impl)] +#[rustc_deny_explicit_impl(implement_via_object = false)] #[rustc_coinductive] pub trait Sized { // Empty. @@ -174,8 +173,7 @@ pub trait Sized { /// [nomicon-coerce]: ../../nomicon/coercions.html #[unstable(feature = "unsize", issue = "18598")] #[lang = "unsize"] -#[cfg_attr(not(bootstrap), rustc_deny_explicit_impl(implement_via_object = false))] -#[cfg_attr(bootstrap, rustc_deny_explicit_impl)] +#[rustc_deny_explicit_impl(implement_via_object = false)] pub trait Unsize { // Empty. } @@ -856,8 +854,7 @@ impl StructuralEq for PhantomData {} reason = "this trait is unlikely to ever be stabilized, use `mem::discriminant` instead" )] #[lang = "discriminant_kind"] -#[cfg_attr(not(bootstrap), rustc_deny_explicit_impl(implement_via_object = false))] -#[cfg_attr(bootstrap, rustc_deny_explicit_impl)] +#[rustc_deny_explicit_impl(implement_via_object = false)] pub trait DiscriminantKind { /// The type of the discriminant, which must satisfy the trait /// bounds required by `mem::Discriminant`. @@ -962,8 +959,7 @@ marker_impls! { #[unstable(feature = "const_trait_impl", issue = "67792")] #[lang = "destruct"] #[rustc_on_unimplemented(message = "can't drop `{Self}`", append_const_msg)] -#[cfg_attr(not(bootstrap), rustc_deny_explicit_impl(implement_via_object = false))] -#[cfg_attr(bootstrap, rustc_deny_explicit_impl)] +#[rustc_deny_explicit_impl(implement_via_object = false)] #[const_trait] pub trait Destruct {} @@ -974,8 +970,7 @@ pub trait Destruct {} #[unstable(feature = "tuple_trait", issue = "none")] #[lang = "tuple_trait"] #[rustc_on_unimplemented(message = "`{Self}` is not a tuple")] -#[cfg_attr(not(bootstrap), rustc_deny_explicit_impl(implement_via_object = false))] -#[cfg_attr(bootstrap, rustc_deny_explicit_impl)] +#[rustc_deny_explicit_impl(implement_via_object = false)] pub trait Tuple {} /// A marker for pointer-like types. @@ -1020,7 +1015,6 @@ marker_impls! { // FIXME(adt_const_params): Add to marker_impls call above once not in bootstrap #[unstable(feature = "adt_const_params", issue = "95174")] -#[cfg(not(bootstrap))] impl ConstParamTy for () {} /// A common trait implemented by all function pointers. @@ -1030,8 +1024,7 @@ impl ConstParamTy for () {} reason = "internal trait for implementing various traits for all function pointers" )] #[lang = "fn_ptr_trait"] -#[cfg_attr(not(bootstrap), rustc_deny_explicit_impl(implement_via_object = false))] -#[cfg_attr(bootstrap, rustc_deny_explicit_impl)] +#[rustc_deny_explicit_impl(implement_via_object = false)] pub trait FnPtr: Copy + Clone { /// Returns the address of the function pointer. #[lang = "fn_ptr_addr"] diff --git a/library/core/src/mem/transmutability.rs b/library/core/src/mem/transmutability.rs index aed23119fd2..f5cc86e7767 100644 --- a/library/core/src/mem/transmutability.rs +++ b/library/core/src/mem/transmutability.rs @@ -7,8 +7,7 @@ use crate::marker::ConstParamTy; /// notwithstanding whatever safety checks you have asked the compiler to [`Assume`] are satisfied. #[unstable(feature = "transmutability", issue = "99571")] #[lang = "transmute_trait"] -#[cfg_attr(not(bootstrap), rustc_deny_explicit_impl(implement_via_object = false))] -#[cfg_attr(bootstrap, rustc_deny_explicit_impl)] +#[rustc_deny_explicit_impl(implement_via_object = false)] #[rustc_coinductive] pub unsafe trait BikeshedIntrinsicFrom where diff --git a/library/core/src/ptr/metadata.rs b/library/core/src/ptr/metadata.rs index daaa44b1d9a..040aa069787 100644 --- a/library/core/src/ptr/metadata.rs +++ b/library/core/src/ptr/metadata.rs @@ -50,8 +50,7 @@ use crate::hash::{Hash, Hasher}; /// /// [`to_raw_parts`]: *const::to_raw_parts #[lang = "pointee_trait"] -#[cfg_attr(not(bootstrap), rustc_deny_explicit_impl(implement_via_object = false))] -#[cfg_attr(bootstrap, rustc_deny_explicit_impl)] +#[rustc_deny_explicit_impl(implement_via_object = false)] pub trait Pointee { /// The type for metadata in pointers and references to `Self`. #[lang = "metadata_type"] diff --git a/library/core/src/ptr/unique.rs b/library/core/src/ptr/unique.rs index ff7e91d3ec3..bf8b86677d5 100644 --- a/library/core/src/ptr/unique.rs +++ b/library/core/src/ptr/unique.rs @@ -33,7 +33,7 @@ use crate::ptr::NonNull; #[doc(hidden)] #[repr(transparent)] // Lang item used experimentally by Miri to define the semantics of `Unique`. -#[cfg_attr(not(bootstrap), lang = "ptr_unique")] +#[lang = "ptr_unique"] pub struct Unique { pointer: NonNull, // NOTE: this marker has no consequences for variance, but is necessary diff --git a/library/core/src/tuple.rs b/library/core/src/tuple.rs index ac8d04a8286..7782ace69c1 100644 --- a/library/core/src/tuple.rs +++ b/library/core/src/tuple.rs @@ -1,7 +1,6 @@ // See src/libstd/primitive_docs.rs for documentation. use crate::cmp::Ordering::{self, *}; -#[cfg(not(bootstrap))] use crate::marker::ConstParamTy; use crate::marker::{StructuralEq, StructuralPartialEq}; @@ -51,7 +50,6 @@ macro_rules! tuple_impls { maybe_tuple_doc! { $($T)+ @ #[unstable(feature = "structural_match", issue = "31434")] - #[cfg(not(bootstrap))] impl<$($T: ConstParamTy),+> ConstParamTy for ($($T,)+) {} } diff --git a/library/core/tests/manually_drop.rs b/library/core/tests/manually_drop.rs index 22d72d219a7..bbf444471ad 100644 --- a/library/core/tests/manually_drop.rs +++ b/library/core/tests/manually_drop.rs @@ -1,4 +1,4 @@ -#![cfg_attr(not(bootstrap), allow(undropped_manually_drops))] +#![allow(undropped_manually_drops)] use core::mem::ManuallyDrop;