diff options
| author | Pietro Albini <pietro@pietroalbini.org> | 2025-05-10 10:51:12 +0200 |
|---|---|---|
| committer | Pietro Albini <pietro@pietroalbini.org> | 2025-05-12 15:33:37 +0200 |
| commit | 2ce08ca5d6046600ff641bfa4018247f3b9451c5 (patch) | |
| tree | 780e2e53e00dcc24d994cedc2c9593a6c3f216ad /library/core/src | |
| parent | 2b7c13e7786db66605b0a1de017c1fe4aa888206 (diff) | |
| download | rust-2ce08ca5d6046600ff641bfa4018247f3b9451c5.tar.gz rust-2ce08ca5d6046600ff641bfa4018247f3b9451c5.zip | |
update cfg(bootstrap)
Diffstat (limited to 'library/core/src')
| -rw-r--r-- | library/core/src/char/convert.rs | 4 | ||||
| -rw-r--r-- | library/core/src/fmt/rt.rs | 8 | ||||
| -rw-r--r-- | library/core/src/future/async_drop.rs | 2 | ||||
| -rw-r--r-- | library/core/src/future/mod.rs | 1 | ||||
| -rw-r--r-- | library/core/src/intrinsics/mod.rs | 13 | ||||
| -rw-r--r-- | library/core/src/intrinsics/simd.rs | 4 | ||||
| -rw-r--r-- | library/core/src/marker.rs | 3 | ||||
| -rw-r--r-- | library/core/src/num/f128.rs | 4 | ||||
| -rw-r--r-- | library/core/src/num/f16.rs | 4 | ||||
| -rw-r--r-- | library/core/src/num/f32.rs | 4 | ||||
| -rw-r--r-- | library/core/src/num/f64.rs | 4 | ||||
| -rw-r--r-- | library/core/src/num/int_macros.rs | 4 | ||||
| -rw-r--r-- | library/core/src/num/uint_macros.rs | 4 | ||||
| -rw-r--r-- | library/core/src/ops/index.rs | 4 | ||||
| -rw-r--r-- | library/core/src/panicking.rs | 1 | ||||
| -rw-r--r-- | library/core/src/pin.rs | 12 | ||||
| -rw-r--r-- | library/core/src/pin/unsafe_pinned.rs | 2 | ||||
| -rw-r--r-- | library/core/src/prelude/v1.rs | 1 | ||||
| -rw-r--r-- | library/core/src/slice/mod.rs | 12 | ||||
| -rw-r--r-- | library/core/src/str/mod.rs | 4 |
20 files changed, 29 insertions, 66 deletions
diff --git a/library/core/src/char/convert.rs b/library/core/src/char/convert.rs index d820965a746..fd17f92f7be 100644 --- a/library/core/src/char/convert.rs +++ b/library/core/src/char/convert.rs @@ -21,7 +21,7 @@ pub(super) const fn from_u32(i: u32) -> Option<char> { /// Converts a `u32` to a `char`, ignoring validity. See [`char::from_u32_unchecked`]. #[inline] #[must_use] -#[cfg_attr(not(bootstrap), allow(unnecessary_transmutes))] +#[allow(unnecessary_transmutes)] pub(super) const unsafe fn from_u32_unchecked(i: u32) -> char { // SAFETY: the caller must guarantee that `i` is a valid char value. unsafe { @@ -222,7 +222,7 @@ impl FromStr for char { } #[inline] -#[cfg_attr(not(bootstrap), allow(unnecessary_transmutes))] +#[allow(unnecessary_transmutes)] const fn char_try_from_u32(i: u32) -> Result<char, CharTryFromError> { // This is an optimized version of the check // (i > MAX as u32) || (i >= 0xD800 && i <= 0xDFFF), diff --git a/library/core/src/fmt/rt.rs b/library/core/src/fmt/rt.rs index c2a8a39bcac..7fd8d3e5b53 100644 --- a/library/core/src/fmt/rt.rs +++ b/library/core/src/fmt/rt.rs @@ -19,14 +19,6 @@ pub struct Placeholder { pub width: Count, } -#[cfg(bootstrap)] -impl Placeholder { - #[inline] - pub const fn new(position: usize, flags: u32, precision: Count, width: Count) -> Self { - Self { position, flags, precision, width } - } -} - /// Used by [width](https://doc.rust-lang.org/std/fmt/#width) /// and [precision](https://doc.rust-lang.org/std/fmt/#precision) specifiers. #[lang = "format_count"] diff --git a/library/core/src/future/async_drop.rs b/library/core/src/future/async_drop.rs index fc4f95a98b4..c48c3f2ba28 100644 --- a/library/core/src/future/async_drop.rs +++ b/library/core/src/future/async_drop.rs @@ -24,7 +24,6 @@ use crate::task::{Context, Poll}; /// are `Copy` get implicitly duplicated by the compiler, making it very /// hard to predict when, and how often destructors will be executed. As such, /// these types cannot have destructors. -#[cfg(not(bootstrap))] #[unstable(feature = "async_drop", issue = "126482")] #[lang = "async_drop"] pub trait AsyncDrop { @@ -42,7 +41,6 @@ pub trait AsyncDrop { } /// Async drop. -#[cfg(not(bootstrap))] #[unstable(feature = "async_drop", issue = "126482")] #[lang = "async_drop_in_place"] pub async unsafe fn async_drop_in_place<T: ?Sized>(_to_drop: *mut T) { diff --git a/library/core/src/future/mod.rs b/library/core/src/future/mod.rs index 4b5a2f34d3f..2b16a568b40 100644 --- a/library/core/src/future/mod.rs +++ b/library/core/src/future/mod.rs @@ -20,7 +20,6 @@ mod pending; mod poll_fn; mod ready; -#[cfg(not(bootstrap))] #[unstable(feature = "async_drop", issue = "126482")] pub use async_drop::{AsyncDrop, async_drop_in_place}; #[stable(feature = "into_future", since = "1.64.0")] diff --git a/library/core/src/intrinsics/mod.rs b/library/core/src/intrinsics/mod.rs index c7220fe7c4a..effdc3c63ee 100644 --- a/library/core/src/intrinsics/mod.rs +++ b/library/core/src/intrinsics/mod.rs @@ -1476,7 +1476,7 @@ pub const fn forget<T: ?Sized>(_: T); /// Turning raw bytes (`[u8; SZ]`) into `u32`, `f64`, etc.: /// /// ``` -/// # #![cfg_attr(not(bootstrap), allow(unnecessary_transmutes))] +/// # #![allow(unnecessary_transmutes)] /// let raw_bytes = [0x78, 0x56, 0x34, 0x12]; /// /// let num = unsafe { @@ -3413,7 +3413,6 @@ pub const fn contract_check_requires<C: Fn() -> bool + Copy>(cond: C) { /// returns false. /// /// Note that this function is a no-op during constant evaluation. -#[cfg(not(bootstrap))] #[unstable(feature = "contracts_internals", issue = "128044")] // Similar to `contract_check_requires`, we need to use the user-facing // `contracts` feature rather than the perma-unstable `contracts_internals`. @@ -3437,16 +3436,6 @@ pub const fn contract_check_ensures<C: Fn(&Ret) -> bool + Copy, Ret>(cond: C, re ) } -/// This is the old version of contract_check_ensures kept here for bootstrap only. -#[cfg(bootstrap)] -#[unstable(feature = "contracts_internals", issue = "128044" /* compiler-team#759 */)] -#[rustc_intrinsic] -pub fn contract_check_ensures<'a, Ret, C: Fn(&'a Ret) -> bool>(ret: &'a Ret, cond: C) { - if contract_checks() && !cond(ret) { - crate::panicking::panic_nounwind("failed ensures check"); - } -} - /// The intrinsic will return the size stored in that vtable. /// /// # Safety diff --git a/library/core/src/intrinsics/simd.rs b/library/core/src/intrinsics/simd.rs index 86e3f8509ee..40efc263068 100644 --- a/library/core/src/intrinsics/simd.rs +++ b/library/core/src/intrinsics/simd.rs @@ -34,7 +34,7 @@ pub const unsafe fn simd_extract<T, U>(x: T, idx: u32) -> U; /// /// `idx` must be in-bounds of the vector. #[rustc_nounwind] -#[cfg_attr(not(bootstrap), rustc_intrinsic)] +#[rustc_intrinsic] pub unsafe fn simd_insert_dyn<T, U>(mut x: T, idx: u32, val: U) -> T { // SAFETY: `idx` must be in-bounds unsafe { (&raw mut x).cast::<U>().add(idx as usize).write(val) } @@ -51,7 +51,7 @@ pub unsafe fn simd_insert_dyn<T, U>(mut x: T, idx: u32, val: U) -> T { /// /// `idx` must be in-bounds of the vector. #[rustc_nounwind] -#[cfg_attr(not(bootstrap), rustc_intrinsic)] +#[rustc_intrinsic] pub unsafe fn simd_extract_dyn<T, U>(x: T, idx: u32) -> U { // SAFETY: `idx` must be in-bounds unsafe { (&raw const x).cast::<U>().add(idx as usize).read() } diff --git a/library/core/src/marker.rs b/library/core/src/marker.rs index 9dc20beda6c..f33b8d188d8 100644 --- a/library/core/src/marker.rs +++ b/library/core/src/marker.rs @@ -885,8 +885,7 @@ marker_impls! { /// /// This is part of [RFC 3467](https://rust-lang.github.io/rfcs/3467-unsafe-pinned.html), and is /// tracked by [#125735](https://github.com/rust-lang/rust/issues/125735). -#[cfg_attr(not(bootstrap), lang = "unsafe_unpin")] -#[cfg_attr(bootstrap, allow(dead_code))] +#[lang = "unsafe_unpin"] pub(crate) unsafe auto trait UnsafeUnpin {} impl<T: ?Sized> !UnsafeUnpin for UnsafePinned<T> {} diff --git a/library/core/src/num/f128.rs b/library/core/src/num/f128.rs index 8020b36c6fa..7e470185c86 100644 --- a/library/core/src/num/f128.rs +++ b/library/core/src/num/f128.rs @@ -893,7 +893,7 @@ impl f128 { #[inline] #[unstable(feature = "f128", issue = "116909")] #[must_use = "this returns the result of the operation, without modifying the original"] - #[cfg_attr(not(bootstrap), allow(unnecessary_transmutes))] + #[allow(unnecessary_transmutes)] pub const fn to_bits(self) -> u128 { // SAFETY: `u128` is a plain old datatype so we can always transmute to it. unsafe { mem::transmute(self) } @@ -941,7 +941,7 @@ impl f128 { #[inline] #[must_use] #[unstable(feature = "f128", issue = "116909")] - #[cfg_attr(not(bootstrap), allow(unnecessary_transmutes))] + #[allow(unnecessary_transmutes)] pub const fn from_bits(v: u128) -> Self { // It turns out the safety issues with sNaN were overblown! Hooray! // SAFETY: `u128` is a plain old datatype so we can always transmute from it. diff --git a/library/core/src/num/f16.rs b/library/core/src/num/f16.rs index 68201400a1d..e47900cba55 100644 --- a/library/core/src/num/f16.rs +++ b/library/core/src/num/f16.rs @@ -881,7 +881,7 @@ impl f16 { #[inline] #[unstable(feature = "f16", issue = "116909")] #[must_use = "this returns the result of the operation, without modifying the original"] - #[cfg_attr(not(bootstrap), allow(unnecessary_transmutes))] + #[allow(unnecessary_transmutes)] pub const fn to_bits(self) -> u16 { // SAFETY: `u16` is a plain old datatype so we can always transmute to it. unsafe { mem::transmute(self) } @@ -928,7 +928,7 @@ impl f16 { #[inline] #[must_use] #[unstable(feature = "f16", issue = "116909")] - #[cfg_attr(not(bootstrap), allow(unnecessary_transmutes))] + #[allow(unnecessary_transmutes)] pub const fn from_bits(v: u16) -> Self { // It turns out the safety issues with sNaN were overblown! Hooray! // SAFETY: `u16` is a plain old datatype so we can always transmute from it. diff --git a/library/core/src/num/f32.rs b/library/core/src/num/f32.rs index da241785d64..5fbc6eb33f1 100644 --- a/library/core/src/num/f32.rs +++ b/library/core/src/num/f32.rs @@ -1085,7 +1085,7 @@ impl f32 { #[stable(feature = "float_bits_conv", since = "1.20.0")] #[rustc_const_stable(feature = "const_float_bits_conv", since = "1.83.0")] #[inline] - #[cfg_attr(not(bootstrap), allow(unnecessary_transmutes))] + #[allow(unnecessary_transmutes)] pub const fn to_bits(self) -> u32 { // SAFETY: `u32` is a plain old datatype so we can always transmute to it. unsafe { mem::transmute(self) } @@ -1131,7 +1131,7 @@ impl f32 { #[rustc_const_stable(feature = "const_float_bits_conv", since = "1.83.0")] #[must_use] #[inline] - #[cfg_attr(not(bootstrap), allow(unnecessary_transmutes))] + #[allow(unnecessary_transmutes)] pub const fn from_bits(v: u32) -> Self { // It turns out the safety issues with sNaN were overblown! Hooray! // SAFETY: `u32` is a plain old datatype so we can always transmute from it. diff --git a/library/core/src/num/f64.rs b/library/core/src/num/f64.rs index c8544771a90..81ab0f14c2b 100644 --- a/library/core/src/num/f64.rs +++ b/library/core/src/num/f64.rs @@ -1083,7 +1083,7 @@ impl f64 { without modifying the original"] #[stable(feature = "float_bits_conv", since = "1.20.0")] #[rustc_const_stable(feature = "const_float_bits_conv", since = "1.83.0")] - #[cfg_attr(not(bootstrap), allow(unnecessary_transmutes))] + #[allow(unnecessary_transmutes)] #[inline] pub const fn to_bits(self) -> u64 { // SAFETY: `u64` is a plain old datatype so we can always transmute to it. @@ -1130,7 +1130,7 @@ impl f64 { #[rustc_const_stable(feature = "const_float_bits_conv", since = "1.83.0")] #[must_use] #[inline] - #[cfg_attr(not(bootstrap), allow(unnecessary_transmutes))] + #[allow(unnecessary_transmutes)] pub const fn from_bits(v: u64) -> Self { // It turns out the safety issues with sNaN were overblown! Hooray! // SAFETY: `u64` is a plain old datatype so we can always transmute from it. diff --git a/library/core/src/num/int_macros.rs b/library/core/src/num/int_macros.rs index 8d31a7b697a..84e1482ed31 100644 --- a/library/core/src/num/int_macros.rs +++ b/library/core/src/num/int_macros.rs @@ -3675,7 +3675,7 @@ macro_rules! int_impl { /// ``` #[stable(feature = "int_to_from_bytes", since = "1.32.0")] #[rustc_const_stable(feature = "const_int_conversion", since = "1.44.0")] - #[cfg_attr(not(bootstrap), allow(unnecessary_transmutes))] + #[allow(unnecessary_transmutes)] // SAFETY: const sound because integers are plain old datatypes so we can always // transmute them to arrays of bytes #[must_use = "this returns the result of the operation, \ @@ -3779,7 +3779,7 @@ macro_rules! int_impl { /// ``` #[stable(feature = "int_to_from_bytes", since = "1.32.0")] #[rustc_const_stable(feature = "const_int_conversion", since = "1.44.0")] - #[cfg_attr(not(bootstrap), allow(unnecessary_transmutes))] + #[allow(unnecessary_transmutes)] #[must_use] // SAFETY: const sound because integers are plain old datatypes so we can always // transmute to them diff --git a/library/core/src/num/uint_macros.rs b/library/core/src/num/uint_macros.rs index bc6cb950816..f38d809c154 100644 --- a/library/core/src/num/uint_macros.rs +++ b/library/core/src/num/uint_macros.rs @@ -3523,7 +3523,7 @@ macro_rules! uint_impl { #[rustc_const_stable(feature = "const_int_conversion", since = "1.44.0")] #[must_use = "this returns the result of the operation, \ without modifying the original"] - #[cfg_attr(not(bootstrap), allow(unnecessary_transmutes))] + #[allow(unnecessary_transmutes)] // SAFETY: const sound because integers are plain old datatypes so we can always // transmute them to arrays of bytes #[inline] @@ -3625,7 +3625,7 @@ macro_rules! uint_impl { /// ``` #[stable(feature = "int_to_from_bytes", since = "1.32.0")] #[rustc_const_stable(feature = "const_int_conversion", since = "1.44.0")] - #[cfg_attr(not(bootstrap), allow(unnecessary_transmutes))] + #[allow(unnecessary_transmutes)] #[must_use] // SAFETY: const sound because integers are plain old datatypes so we can always // transmute to them diff --git a/library/core/src/ops/index.rs b/library/core/src/ops/index.rs index 8106c088f0b..46e19bed43a 100644 --- a/library/core/src/ops/index.rs +++ b/library/core/src/ops/index.rs @@ -67,7 +67,7 @@ pub trait Index<Idx: ?Sized> { /// /// May panic if the index is out of bounds. #[stable(feature = "rust1", since = "1.0.0")] - #[cfg_attr(not(bootstrap), rustc_no_implicit_autorefs)] + #[rustc_no_implicit_autorefs] #[track_caller] fn index(&self, index: Idx) -> &Self::Output; } @@ -172,7 +172,7 @@ pub trait IndexMut<Idx: ?Sized>: Index<Idx> { /// /// May panic if the index is out of bounds. #[stable(feature = "rust1", since = "1.0.0")] - #[cfg_attr(not(bootstrap), rustc_no_implicit_autorefs)] + #[rustc_no_implicit_autorefs] #[track_caller] fn index_mut(&mut self, index: Idx) -> &mut Self::Output; } diff --git a/library/core/src/panicking.rs b/library/core/src/panicking.rs index 83a45436b30..d87f4814f02 100644 --- a/library/core/src/panicking.rs +++ b/library/core/src/panicking.rs @@ -206,7 +206,6 @@ pub mod panic_const { } // Separated panic constants list for async drop feature // (May be joined when the corresponding lang items will be in the bootstrap) - #[cfg(not(bootstrap))] panic_const! { panic_const_coroutine_resumed_drop = "coroutine resumed after async drop", panic_const_async_fn_resumed_drop = "`async fn` resumed after async drop", diff --git a/library/core/src/pin.rs b/library/core/src/pin.rs index dd1c2f2c285..aa8207f8ff4 100644 --- a/library/core/src/pin.rs +++ b/library/core/src/pin.rs @@ -1093,9 +1093,6 @@ pub use self::unsafe_pinned::UnsafePinned; #[derive(Copy, Clone)] pub struct Pin<Ptr> { /// Only public for bootstrap. - #[cfg(bootstrap)] - pub pointer: Ptr, - #[cfg(not(bootstrap))] pointer: Ptr, } @@ -1936,7 +1933,6 @@ unsafe impl<T: ?Sized> PinCoerceUnsized for *mut T {} /// constructor. /// /// [`Box::pin`]: ../../std/boxed/struct.Box.html#method.pin -#[cfg(not(bootstrap))] #[stable(feature = "pin_macro", since = "1.68.0")] #[rustc_macro_transparency = "semitransparent"] #[allow_internal_unstable(super_let)] @@ -1947,11 +1943,3 @@ pub macro pin($value:expr $(,)?) { unsafe { $crate::pin::Pin::new_unchecked(&mut pinned) } } } - -/// Only for bootstrap. -#[cfg(bootstrap)] -#[stable(feature = "pin_macro", since = "1.68.0")] -#[rustc_macro_transparency = "semitransparent"] -pub macro pin($value:expr $(,)?) { - $crate::pin::Pin::<&mut _> { pointer: &mut { $value } } -} diff --git a/library/core/src/pin/unsafe_pinned.rs b/library/core/src/pin/unsafe_pinned.rs index 5fb628c8adb..f65e83662fe 100644 --- a/library/core/src/pin/unsafe_pinned.rs +++ b/library/core/src/pin/unsafe_pinned.rs @@ -21,7 +21,7 @@ use crate::{fmt, ptr}; /// Use `UnsafeCell` for that. /// /// This type blocks niches the same way `UnsafeCell` does. -#[cfg_attr(not(bootstrap), lang = "unsafe_pinned")] +#[lang = "unsafe_pinned"] #[repr(transparent)] #[unstable(feature = "unsafe_pinned", issue = "125735")] pub struct UnsafePinned<T: ?Sized> { diff --git a/library/core/src/prelude/v1.rs b/library/core/src/prelude/v1.rs index 9737d0baec7..8f1b5275871 100644 --- a/library/core/src/prelude/v1.rs +++ b/library/core/src/prelude/v1.rs @@ -59,7 +59,6 @@ pub use crate::hash::macros::Hash; #[stable(feature = "builtin_macro_prelude", since = "1.38.0")] #[allow(deprecated)] -#[cfg_attr(bootstrap, allow(deprecated_in_future))] #[doc(no_inline)] pub use crate::{ assert, cfg, column, compile_error, concat, concat_idents, env, file, format_args, diff --git a/library/core/src/slice/mod.rs b/library/core/src/slice/mod.rs index 88b6674d4cc..058491b53a1 100644 --- a/library/core/src/slice/mod.rs +++ b/library/core/src/slice/mod.rs @@ -109,7 +109,7 @@ impl<T> [T] { #[lang = "slice_len_fn"] #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_stable(feature = "const_slice_len", since = "1.39.0")] - #[cfg_attr(not(bootstrap), rustc_no_implicit_autorefs)] + #[rustc_no_implicit_autorefs] #[inline] #[must_use] pub const fn len(&self) -> usize { @@ -129,7 +129,7 @@ impl<T> [T] { /// ``` #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_stable(feature = "const_slice_is_empty", since = "1.39.0")] - #[cfg_attr(not(bootstrap), rustc_no_implicit_autorefs)] + #[rustc_no_implicit_autorefs] #[inline] #[must_use] pub const fn is_empty(&self) -> bool { @@ -564,7 +564,7 @@ impl<T> [T] { /// assert_eq!(None, v.get(0..4)); /// ``` #[stable(feature = "rust1", since = "1.0.0")] - #[cfg_attr(not(bootstrap), rustc_no_implicit_autorefs)] + #[rustc_no_implicit_autorefs] #[inline] #[must_use] pub fn get<I>(&self, index: I) -> Option<&I::Output> @@ -590,7 +590,7 @@ impl<T> [T] { /// assert_eq!(x, &[0, 42, 2]); /// ``` #[stable(feature = "rust1", since = "1.0.0")] - #[cfg_attr(not(bootstrap), rustc_no_implicit_autorefs)] + #[rustc_no_implicit_autorefs] #[inline] #[must_use] pub fn get_mut<I>(&mut self, index: I) -> Option<&mut I::Output> @@ -628,7 +628,7 @@ impl<T> [T] { /// } /// ``` #[stable(feature = "rust1", since = "1.0.0")] - #[cfg_attr(not(bootstrap), rustc_no_implicit_autorefs)] + #[rustc_no_implicit_autorefs] #[inline] #[must_use] pub unsafe fn get_unchecked<I>(&self, index: I) -> &I::Output @@ -671,7 +671,7 @@ impl<T> [T] { /// assert_eq!(x, &[1, 13, 4]); /// ``` #[stable(feature = "rust1", since = "1.0.0")] - #[cfg_attr(not(bootstrap), rustc_no_implicit_autorefs)] + #[rustc_no_implicit_autorefs] #[inline] #[must_use] pub unsafe fn get_unchecked_mut<I>(&mut self, index: I) -> &mut I::Output diff --git a/library/core/src/str/mod.rs b/library/core/src/str/mod.rs index dafabba645c..9e7e949b722 100644 --- a/library/core/src/str/mod.rs +++ b/library/core/src/str/mod.rs @@ -134,7 +134,7 @@ impl str { #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_stable(feature = "const_str_len", since = "1.39.0")] #[rustc_diagnostic_item = "str_len"] - #[cfg_attr(not(bootstrap), rustc_no_implicit_autorefs)] + #[rustc_no_implicit_autorefs] #[must_use] #[inline] pub const fn len(&self) -> usize { @@ -154,7 +154,7 @@ impl str { /// ``` #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_stable(feature = "const_str_is_empty", since = "1.39.0")] - #[cfg_attr(not(bootstrap), rustc_no_implicit_autorefs)] + #[rustc_no_implicit_autorefs] #[must_use] #[inline] pub const fn is_empty(&self) -> bool { |
