Skip to content

Commit f445caa

Browse files
committed
update cfg(bootstrap)s
1 parent 89870fc commit f445caa

File tree

15 files changed

+23
-114
lines changed

15 files changed

+23
-114
lines changed

alloc/src/boxed.rs

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ impl<T> Box<T> {
206206
/// ```
207207
/// let five = Box::new(5);
208208
/// ```
209-
#[cfg(all(not(no_global_oom_handling), not(bootstrap)))]
209+
#[cfg(all(not(no_global_oom_handling)))]
210210
#[inline(always)]
211211
#[stable(feature = "rust1", since = "1.0.0")]
212212
#[must_use]
@@ -215,23 +215,6 @@ impl<T> Box<T> {
215215
Box::new(x)
216216
}
217217

218-
/// Allocates memory on the heap and then places `x` into it.
219-
///
220-
/// This doesn't actually allocate if `T` is zero-sized.
221-
///
222-
/// # Examples
223-
///
224-
/// ```
225-
/// let five = Box::new(5);
226-
/// ```
227-
#[cfg(all(not(no_global_oom_handling), bootstrap))]
228-
#[inline(always)]
229-
#[stable(feature = "rust1", since = "1.0.0")]
230-
#[must_use]
231-
pub fn new(x: T) -> Self {
232-
box x
233-
}
234-
235218
/// Constructs a new box with uninitialized contents.
236219
///
237220
/// # Examples
@@ -296,7 +279,7 @@ impl<T> Box<T> {
296279
#[must_use]
297280
#[inline(always)]
298281
pub fn pin(x: T) -> Pin<Box<T>> {
299-
(#[cfg_attr(not(bootstrap), rustc_box)]
282+
(#[rustc_box]
300283
Box::new(x))
301284
.into()
302285
}
@@ -1255,7 +1238,7 @@ unsafe impl<#[may_dangle] T: ?Sized, A: Allocator> Drop for Box<T, A> {
12551238
impl<T: Default> Default for Box<T> {
12561239
/// Creates a `Box<T>`, with the `Default` value for T.
12571240
fn default() -> Self {
1258-
#[cfg_attr(not(bootstrap), rustc_box)]
1241+
#[rustc_box]
12591242
Box::new(T::default())
12601243
}
12611244
}
@@ -1628,7 +1611,7 @@ impl<T, const N: usize> From<[T; N]> for Box<[T]> {
16281611
/// println!("{boxed:?}");
16291612
/// ```
16301613
fn from(array: [T; N]) -> Box<[T]> {
1631-
#[cfg_attr(not(bootstrap), rustc_box)]
1614+
#[rustc_box]
16321615
Box::new(array)
16331616
}
16341617
}

alloc/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@
149149
#![feature(allocator_internals)]
150150
#![feature(allow_internal_unstable)]
151151
#![feature(associated_type_bounds)]
152-
#![cfg_attr(bootstrap, feature(box_syntax))]
153152
#![feature(cfg_sanitize)]
154153
#![feature(const_deref)]
155154
#![feature(const_mut_refs)]

alloc/src/macros.rs

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
/// be mindful of side effects.
3535
///
3636
/// [`Vec`]: crate::vec::Vec
37-
#[cfg(all(not(no_global_oom_handling), not(test), not(bootstrap)))]
37+
#[cfg(all(not(no_global_oom_handling), not(test)))]
3838
#[macro_export]
3939
#[stable(feature = "rust1", since = "1.0.0")]
4040
#[rustc_diagnostic_item = "vec_macro"]
@@ -54,24 +54,6 @@ macro_rules! vec {
5454
);
5555
}
5656

57-
/// Creates a `Vec` containing the arguments (bootstrap version).
58-
#[cfg(all(not(no_global_oom_handling), not(test), bootstrap))]
59-
#[macro_export]
60-
#[stable(feature = "rust1", since = "1.0.0")]
61-
#[rustc_diagnostic_item = "vec_macro"]
62-
#[allow_internal_unstable(box_syntax, liballoc_internals)]
63-
macro_rules! vec {
64-
() => (
65-
$crate::__rust_force_expr!($crate::vec::Vec::new())
66-
);
67-
($elem:expr; $n:expr) => (
68-
$crate::__rust_force_expr!($crate::vec::from_elem($elem, $n))
69-
);
70-
($($x:expr),+ $(,)?) => (
71-
$crate::__rust_force_expr!(<[_]>::into_vec(box [$($x),+]))
72-
);
73-
}
74-
7557
// HACK(japaric): with cfg(test) the inherent `[T]::into_vec` method, which is
7658
// required for this macro definition, is not available. Instead use the
7759
// `slice::into_vec` function which is only available with cfg(test)

alloc/src/vec/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3017,7 +3017,7 @@ impl<T, const N: usize> From<[T; N]> for Vec<T> {
30173017
#[cfg(not(test))]
30183018
fn from(s: [T; N]) -> Vec<T> {
30193019
<[T]>::into_vec(
3020-
#[cfg_attr(not(bootstrap), rustc_box)]
3020+
#[rustc_box]
30213021
Box::new(s),
30223022
)
30233023
}

core/src/clone.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ use crate::marker::Destruct;
106106
#[lang = "clone"]
107107
#[rustc_diagnostic_item = "Clone"]
108108
#[rustc_trivial_field_reads]
109-
#[cfg_attr(not(bootstrap), const_trait)]
109+
#[const_trait]
110110
pub trait Clone: Sized {
111111
/// Returns a copy of the value.
112112
///
@@ -129,7 +129,6 @@ pub trait Clone: Sized {
129129
/// allocations.
130130
#[inline]
131131
#[stable(feature = "rust1", since = "1.0.0")]
132-
#[cfg_attr(bootstrap, default_method_body_is_const)]
133132
fn clone_from(&mut self, source: &Self)
134133
where
135134
Self: ~const Destruct,

core/src/cmp.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ use self::Ordering::*;
214214
append_const_msg,
215215
)
216216
)]
217-
#[cfg_attr(not(bootstrap), const_trait)]
217+
#[const_trait]
218218
#[rustc_diagnostic_item = "PartialEq"]
219219
pub trait PartialEq<Rhs: ?Sized = Self> {
220220
/// This method tests for `self` and `other` values to be equal, and is used
@@ -227,7 +227,6 @@ pub trait PartialEq<Rhs: ?Sized = Self> {
227227
#[inline]
228228
#[must_use]
229229
#[stable(feature = "rust1", since = "1.0.0")]
230-
#[cfg_attr(bootstrap, default_method_body_is_const)]
231230
fn ne(&self, other: &Rhs) -> bool {
232231
!self.eq(other)
233232
}
@@ -1054,7 +1053,7 @@ impl PartialOrd for Ordering {
10541053
append_const_msg,
10551054
)
10561055
)]
1057-
#[cfg_attr(not(bootstrap), const_trait)]
1056+
#[const_trait]
10581057
#[rustc_diagnostic_item = "PartialOrd"]
10591058
pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
10601059
/// This method returns an ordering between `self` and `other` values if one exists.
@@ -1098,7 +1097,6 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
10981097
#[inline]
10991098
#[must_use]
11001099
#[stable(feature = "rust1", since = "1.0.0")]
1101-
#[cfg_attr(bootstrap, default_method_body_is_const)]
11021100
fn lt(&self, other: &Rhs) -> bool {
11031101
matches!(self.partial_cmp(other), Some(Less))
11041102
}
@@ -1118,7 +1116,6 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
11181116
#[inline]
11191117
#[must_use]
11201118
#[stable(feature = "rust1", since = "1.0.0")]
1121-
#[cfg_attr(bootstrap, default_method_body_is_const)]
11221119
fn le(&self, other: &Rhs) -> bool {
11231120
// Pattern `Some(Less | Eq)` optimizes worse than negating `None | Some(Greater)`.
11241121
// FIXME: The root cause was fixed upstream in LLVM with:
@@ -1141,7 +1138,6 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
11411138
#[inline]
11421139
#[must_use]
11431140
#[stable(feature = "rust1", since = "1.0.0")]
1144-
#[cfg_attr(bootstrap, default_method_body_is_const)]
11451141
fn gt(&self, other: &Rhs) -> bool {
11461142
matches!(self.partial_cmp(other), Some(Greater))
11471143
}
@@ -1161,7 +1157,6 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
11611157
#[inline]
11621158
#[must_use]
11631159
#[stable(feature = "rust1", since = "1.0.0")]
1164-
#[cfg_attr(bootstrap, default_method_body_is_const)]
11651160
fn ge(&self, other: &Rhs) -> bool {
11661161
matches!(self.partial_cmp(other), Some(Greater | Equal))
11671162
}

core/src/fmt/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2562,7 +2562,7 @@ macro_rules! tuple {
25622562

25632563
macro_rules! maybe_tuple_doc {
25642564
($a:ident @ #[$meta:meta] $item:item) => {
2565-
#[cfg_attr(not(bootstrap), doc(tuple_variadic))]
2565+
#[doc(tuple_variadic)]
25662566
#[doc = "This trait is implemented for tuples up to twelve items long."]
25672567
#[$meta]
25682568
$item

core/src/hash/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -900,7 +900,7 @@ mod impls {
900900

901901
macro_rules! maybe_tuple_doc {
902902
($a:ident @ #[$meta:meta] $item:item) => {
903-
#[cfg_attr(not(bootstrap), doc(tuple_variadic))]
903+
#[doc(tuple_variadic)]
904904
#[doc = "This trait is implemented for tuples up to twelve items long."]
905905
#[$meta]
906906
$item

core/src/primitive_docs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -996,7 +996,7 @@ impl<T> (T,) {}
996996
// Fake impl that's only really used for docs.
997997
#[cfg(doc)]
998998
#[stable(feature = "rust1", since = "1.0.0")]
999-
#[cfg_attr(not(bootstrap), doc(tuple_variadic))]
999+
#[doc(tuple_variadic)]
10001000
/// This trait is implemented on arbitrary-length tuples.
10011001
impl<T: Clone> Clone for (T,) {
10021002
fn clone(&self) -> Self {
@@ -1007,7 +1007,7 @@ impl<T: Clone> Clone for (T,) {
10071007
// Fake impl that's only really used for docs.
10081008
#[cfg(doc)]
10091009
#[stable(feature = "rust1", since = "1.0.0")]
1010-
#[cfg_attr(not(bootstrap), doc(tuple_variadic))]
1010+
#[doc(tuple_variadic)]
10111011
/// This trait is implemented on arbitrary-length tuples.
10121012
impl<T: Copy> Copy for (T,) {
10131013
// empty

core/src/ptr/mod.rs

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -492,27 +492,6 @@ pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
492492
unsafe { drop_in_place(to_drop) }
493493
}
494494

495-
/// Creates a null raw pointer.
496-
///
497-
/// # Examples
498-
///
499-
/// ```
500-
/// use std::ptr;
501-
///
502-
/// let p: *const i32 = ptr::null();
503-
/// assert!(p.is_null());
504-
/// ```
505-
#[inline(always)]
506-
#[must_use]
507-
#[stable(feature = "rust1", since = "1.0.0")]
508-
#[rustc_promotable]
509-
#[rustc_const_stable(feature = "const_ptr_null", since = "1.24.0")]
510-
#[rustc_diagnostic_item = "ptr_null"]
511-
#[cfg(bootstrap)]
512-
pub const fn null<T>() -> *const T {
513-
invalid(0)
514-
}
515-
516495
/// Creates a null raw pointer.
517496
///
518497
/// # Examples
@@ -530,32 +509,10 @@ pub const fn null<T>() -> *const T {
530509
#[rustc_const_stable(feature = "const_ptr_null", since = "1.24.0")]
531510
#[rustc_allow_const_fn_unstable(ptr_metadata)]
532511
#[rustc_diagnostic_item = "ptr_null"]
533-
#[cfg(not(bootstrap))]
534512
pub const fn null<T: ?Sized + Thin>() -> *const T {
535513
from_raw_parts(invalid(0), ())
536514
}
537515

538-
/// Creates a null mutable raw pointer.
539-
///
540-
/// # Examples
541-
///
542-
/// ```
543-
/// use std::ptr;
544-
///
545-
/// let p: *mut i32 = ptr::null_mut();
546-
/// assert!(p.is_null());
547-
/// ```
548-
#[inline(always)]
549-
#[must_use]
550-
#[stable(feature = "rust1", since = "1.0.0")]
551-
#[rustc_promotable]
552-
#[rustc_const_stable(feature = "const_ptr_null", since = "1.24.0")]
553-
#[rustc_diagnostic_item = "ptr_null_mut"]
554-
#[cfg(bootstrap)]
555-
pub const fn null_mut<T>() -> *mut T {
556-
invalid_mut(0)
557-
}
558-
559516
/// Creates an invalid pointer with the given address.
560517
///
561518
/// This is different from `addr as *const T`, which creates a pointer that picks up a previously
@@ -707,7 +664,6 @@ where
707664
#[rustc_const_stable(feature = "const_ptr_null", since = "1.24.0")]
708665
#[rustc_allow_const_fn_unstable(ptr_metadata)]
709666
#[rustc_diagnostic_item = "ptr_null_mut"]
710-
#[cfg(not(bootstrap))]
711667
pub const fn null_mut<T: ?Sized + Thin>() -> *mut T {
712668
from_raw_parts_mut(invalid_mut(0), ())
713669
}

0 commit comments

Comments
 (0)