Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit d8fe589

Browse files
committedJun 11, 2024
remove cfg(bootstrap)
1 parent a2ff49b commit d8fe589

File tree

11 files changed

+20
-84
lines changed

11 files changed

+20
-84
lines changed
 

‎alloc/src/boxed.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,7 @@
145145
//! to `into_iter()` for boxed slices will defer to the slice implementation on editions before
146146
//! 2024:
147147
//!
148-
#![cfg_attr(bootstrap, doc = "```rust,edition2021,ignore")]
149-
#![cfg_attr(not(bootstrap), doc = "```rust,edition2021")]
148+
//! ```rust,edition2021
150149
//! // Rust 2015, 2018, and 2021:
151150
//!
152151
//! # #![allow(boxed_slice_into_iter)] // override our `deny(warnings)`

‎alloc/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@
165165
//
166166
// Language features:
167167
// tidy-alphabetical-start
168-
#![cfg_attr(bootstrap, feature(exclusive_range_pattern))]
169168
#![cfg_attr(not(test), feature(coroutine_trait))]
170169
#![cfg_attr(test, feature(panic_update_hook))]
171170
#![cfg_attr(test, feature(test))]

‎core/src/future/async_drop.rs

-1
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,6 @@ async unsafe fn either<O: IntoFuture<Output = ()>, M: IntoFuture<Output = ()>, T
256256
}
257257
}
258258

259-
#[cfg(not(bootstrap))]
260259
#[lang = "async_drop_deferred_drop_in_place"]
261260
async unsafe fn deferred_drop_in_place<T>(to_drop: *mut T) {
262261
// SAFETY: same safety requirements as with drop_in_place (implied by

‎core/src/future/future.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ use crate::task::{Context, Poll};
3535
pub trait Future {
3636
/// The type of value produced on completion.
3737
#[stable(feature = "futures_api", since = "1.36.0")]
38-
#[cfg_attr(not(bootstrap), lang = "future_output")]
38+
#[lang = "future_output"]
3939
type Output;
4040

4141
/// Attempt to resolve the future to a final value, registering

‎core/src/intrinsics.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -986,7 +986,7 @@ pub const unsafe fn assume(b: bool) {
986986
#[unstable(feature = "core_intrinsics", issue = "none")]
987987
#[rustc_intrinsic]
988988
#[rustc_nounwind]
989-
#[cfg_attr(not(bootstrap), miri::intrinsic_fallback_is_spec)]
989+
#[miri::intrinsic_fallback_is_spec]
990990
pub const fn likely(b: bool) -> bool {
991991
b
992992
}
@@ -1006,7 +1006,7 @@ pub const fn likely(b: bool) -> bool {
10061006
#[unstable(feature = "core_intrinsics", issue = "none")]
10071007
#[rustc_intrinsic]
10081008
#[rustc_nounwind]
1009-
#[cfg_attr(not(bootstrap), miri::intrinsic_fallback_is_spec)]
1009+
#[miri::intrinsic_fallback_is_spec]
10101010
pub const fn unlikely(b: bool) -> bool {
10111011
b
10121012
}
@@ -2482,7 +2482,7 @@ extern "rust-intrinsic" {
24822482
#[rustc_nounwind]
24832483
#[rustc_do_not_const_check]
24842484
#[inline]
2485-
#[cfg_attr(not(bootstrap), miri::intrinsic_fallback_is_spec)]
2485+
#[miri::intrinsic_fallback_is_spec]
24862486
pub const fn ptr_guaranteed_cmp<T>(ptr: *const T, other: *const T) -> u8 {
24872487
(ptr == other) as u8
24882488
}
@@ -2747,7 +2747,7 @@ pub const fn ub_checks() -> bool {
27472747
#[unstable(feature = "core_intrinsics", issue = "none")]
27482748
#[rustc_nounwind]
27492749
#[rustc_intrinsic]
2750-
#[cfg_attr(not(bootstrap), miri::intrinsic_fallback_is_spec)]
2750+
#[miri::intrinsic_fallback_is_spec]
27512751
pub const unsafe fn const_allocate(_size: usize, _align: usize) -> *mut u8 {
27522752
// const eval overrides this function, but runtime code for now just returns null pointers.
27532753
// See <https://github.com/rust-lang/rust/issues/93935>.
@@ -2768,7 +2768,7 @@ pub const unsafe fn const_allocate(_size: usize, _align: usize) -> *mut u8 {
27682768
#[unstable(feature = "core_intrinsics", issue = "none")]
27692769
#[rustc_nounwind]
27702770
#[rustc_intrinsic]
2771-
#[cfg_attr(not(bootstrap), miri::intrinsic_fallback_is_spec)]
2771+
#[miri::intrinsic_fallback_is_spec]
27722772
pub const unsafe fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize) {
27732773
// Runtime NOP
27742774
}
@@ -2828,7 +2828,6 @@ impl<P: ?Sized, T: ptr::Thin> AggregateRawPtr<*mut T> for *mut P {
28282828
#[rustc_const_unstable(feature = "ptr_metadata", issue = "81513")]
28292829
#[rustc_intrinsic]
28302830
#[rustc_intrinsic_must_be_overridden]
2831-
#[cfg(not(bootstrap))]
28322831
pub const fn ptr_metadata<P: ptr::Pointee<Metadata = M> + ?Sized, M>(_ptr: *const P) -> M {
28332832
// To implement a fallback we'd have to assume the layout of the pointer,
28342833
// but the whole point of this intrinsic is that we shouldn't do that.

‎core/src/intrinsics/simd.rs

-1
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,6 @@ extern "rust-intrinsic" {
573573
///
574574
/// `T` must be a vector of integers.
575575
#[rustc_nounwind]
576-
#[cfg(not(bootstrap))]
577576
pub fn simd_ctpop<T>(x: T) -> T;
578577

579578
/// Count the trailing zeros of each element.

‎core/src/iter/traits/collect.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -311,8 +311,7 @@ where
311311
label = "`{Self}` is not an iterator",
312312
message = "`{Self}` is not an iterator"
313313
)]
314-
#[cfg_attr(bootstrap, rustc_skip_array_during_method_dispatch)]
315-
#[cfg_attr(not(bootstrap), rustc_skip_during_method_dispatch(array, boxed_slice))]
314+
#[rustc_skip_during_method_dispatch(array, boxed_slice)]
316315
#[stable(feature = "rust1", since = "1.0.0")]
317316
pub trait IntoIterator {
318317
/// The type of the elements being iterated over.

‎core/src/num/int_macros.rs

+7-11
Original file line numberDiff line numberDiff line change
@@ -1165,17 +1165,13 @@ macro_rules! int_impl {
11651165
#[inline(always)]
11661166
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
11671167
pub const unsafe fn unchecked_neg(self) -> Self {
1168-
// ICE resolved by #125184 isn't in bootstrap compiler
1169-
#[cfg(not(bootstrap))]
1170-
{
1171-
assert_unsafe_precondition!(
1172-
check_language_ub,
1173-
concat!(stringify!($SelfT), "::unchecked_neg cannot overflow"),
1174-
(
1175-
lhs: $SelfT = self,
1176-
) => !lhs.overflowing_neg().1,
1177-
);
1178-
}
1168+
assert_unsafe_precondition!(
1169+
check_language_ub,
1170+
concat!(stringify!($SelfT), "::unchecked_neg cannot overflow"),
1171+
(
1172+
lhs: $SelfT = self,
1173+
) => !lhs.overflowing_neg().1,
1174+
);
11791175

11801176
// SAFETY: this is guaranteed to be safe by the caller.
11811177
unsafe {

‎core/src/ops/async_function.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub trait AsyncFn<Args: Tuple>: AsyncFnMut<Args> {
2626
pub trait AsyncFnMut<Args: Tuple>: AsyncFnOnce<Args> {
2727
/// Future returned by [`AsyncFnMut::async_call_mut`] and [`AsyncFn::async_call`].
2828
#[unstable(feature = "async_fn_traits", issue = "none")]
29-
#[cfg_attr(not(bootstrap), lang = "call_ref_future")]
29+
#[lang = "call_ref_future"]
3030
type CallRefFuture<'a>: Future<Output = Self::Output>
3131
where
3232
Self: 'a;
@@ -47,12 +47,12 @@ pub trait AsyncFnMut<Args: Tuple>: AsyncFnOnce<Args> {
4747
pub trait AsyncFnOnce<Args: Tuple> {
4848
/// Future returned by [`AsyncFnOnce::async_call_once`].
4949
#[unstable(feature = "async_fn_traits", issue = "none")]
50-
#[cfg_attr(not(bootstrap), lang = "call_once_future")]
50+
#[lang = "call_once_future"]
5151
type CallOnceFuture: Future<Output = Self::Output>;
5252

5353
/// Output type of the called closure's future.
5454
#[unstable(feature = "async_fn_traits", issue = "none")]
55-
#[cfg_attr(not(bootstrap), lang = "async_fn_once_output")]
55+
#[lang = "async_fn_once_output"]
5656
type Output;
5757

5858
/// Call the [`AsyncFnOnce`], returning a future which may move out of the called closure.
@@ -146,7 +146,7 @@ mod internal_implementation_detail {
146146
// `for<'env> fn() -> (&'env T, ...)`. This allows us to represent the binder
147147
// of the closure's self-capture, and these upvar types will be instantiated with
148148
// the `'closure_env` region provided to the associated type.
149-
#[cfg_attr(not(bootstrap), lang = "async_fn_kind_upvars")]
149+
#[lang = "async_fn_kind_upvars"]
150150
type Upvars<'closure_env, Inputs, Upvars, BorrowedUpvarsAsFnPtr>;
151151
}
152152
}

‎core/src/ptr/metadata.rs

+1-39
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
use crate::fmt;
44
use crate::hash::{Hash, Hasher};
55
use crate::intrinsics::aggregate_raw_ptr;
6-
#[cfg(not(bootstrap))]
76
use crate::intrinsics::ptr_metadata;
87
use crate::marker::Freeze;
98

@@ -96,17 +95,7 @@ pub trait Thin = Pointee<Metadata = ()>;
9695
#[rustc_const_unstable(feature = "ptr_metadata", issue = "81513")]
9796
#[inline]
9897
pub const fn metadata<T: ?Sized>(ptr: *const T) -> <T as Pointee>::Metadata {
99-
#[cfg(bootstrap)]
100-
{
101-
// SAFETY: Accessing the value from the `PtrRepr` union is safe since *const T
102-
// and PtrComponents<T> have the same memory layouts. Only std can make this
103-
// guarantee.
104-
unsafe { PtrRepr { const_ptr: ptr }.components.metadata }
105-
}
106-
#[cfg(not(bootstrap))]
107-
{
108-
ptr_metadata(ptr)
109-
}
98+
ptr_metadata(ptr)
11099
}
111100

112101
/// Forms a (possibly-wide) raw pointer from a data pointer and metadata.
@@ -140,33 +129,6 @@ pub const fn from_raw_parts_mut<T: ?Sized>(
140129
aggregate_raw_ptr(data_pointer, metadata)
141130
}
142131

143-
#[repr(C)]
144-
#[cfg(bootstrap)]
145-
union PtrRepr<T: ?Sized> {
146-
const_ptr: *const T,
147-
mut_ptr: *mut T,
148-
components: PtrComponents<T>,
149-
}
150-
151-
#[repr(C)]
152-
#[cfg(bootstrap)]
153-
struct PtrComponents<T: ?Sized> {
154-
data_pointer: *const (),
155-
metadata: <T as Pointee>::Metadata,
156-
}
157-
158-
// Manual impl needed to avoid `T: Copy` bound.
159-
#[cfg(bootstrap)]
160-
impl<T: ?Sized> Copy for PtrComponents<T> {}
161-
162-
// Manual impl needed to avoid `T: Clone` bound.
163-
#[cfg(bootstrap)]
164-
impl<T: ?Sized> Clone for PtrComponents<T> {
165-
fn clone(&self) -> Self {
166-
*self
167-
}
168-
}
169-
170132
/// The metadata for a `Dyn = dyn SomeTrait` trait object type.
171133
///
172134
/// It is a pointer to a vtable (virtual call table)

‎std/src/env.rs

-16
Original file line numberDiff line numberDiff line change
@@ -361,20 +361,12 @@ impl Error for VarError {
361361
/// }
362362
/// assert_eq!(env::var(key), Ok("VALUE".to_string()));
363363
/// ```
364-
#[cfg(not(bootstrap))]
365364
#[rustc_deprecated_safe_2024]
366365
#[stable(feature = "env", since = "1.0.0")]
367366
pub unsafe fn set_var<K: AsRef<OsStr>, V: AsRef<OsStr>>(key: K, value: V) {
368367
_set_var(key.as_ref(), value.as_ref())
369368
}
370369

371-
#[cfg(bootstrap)]
372-
#[allow(missing_docs)]
373-
#[stable(feature = "env", since = "1.0.0")]
374-
pub fn set_var<K: AsRef<OsStr>, V: AsRef<OsStr>>(key: K, value: V) {
375-
unsafe { _set_var(key.as_ref(), value.as_ref()) }
376-
}
377-
378370
unsafe fn _set_var(key: &OsStr, value: &OsStr) {
379371
os_imp::setenv(key, value).unwrap_or_else(|e| {
380372
panic!("failed to set environment variable `{key:?}` to `{value:?}`: {e}")
@@ -434,20 +426,12 @@ unsafe fn _set_var(key: &OsStr, value: &OsStr) {
434426
/// }
435427
/// assert!(env::var(key).is_err());
436428
/// ```
437-
#[cfg(not(bootstrap))]
438429
#[rustc_deprecated_safe_2024]
439430
#[stable(feature = "env", since = "1.0.0")]
440431
pub unsafe fn remove_var<K: AsRef<OsStr>>(key: K) {
441432
_remove_var(key.as_ref())
442433
}
443434

444-
#[cfg(bootstrap)]
445-
#[allow(missing_docs)]
446-
#[stable(feature = "env", since = "1.0.0")]
447-
pub fn remove_var<K: AsRef<OsStr>>(key: K) {
448-
unsafe { _remove_var(key.as_ref()) }
449-
}
450-
451435
unsafe fn _remove_var(key: &OsStr) {
452436
os_imp::unsetenv(key)
453437
.unwrap_or_else(|e| panic!("failed to remove environment variable `{key:?}`: {e}"))

0 commit comments

Comments
 (0)
Failed to load comments.