From 6b2d3d5f3cd1e553d87b5496632132565b6779d3 Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Fri, 1 Jul 2022 15:48:23 +0200 Subject: update cfg(bootstrap)s --- library/alloc/src/boxed.rs | 25 ++++--------------------- library/alloc/src/lib.rs | 1 - library/alloc/src/macros.rs | 20 +------------------- library/alloc/src/vec/mod.rs | 2 +- 4 files changed, 6 insertions(+), 42 deletions(-) (limited to 'library/alloc') diff --git a/library/alloc/src/boxed.rs b/library/alloc/src/boxed.rs index cc395759b20..d83bab7bbbd 100644 --- a/library/alloc/src/boxed.rs +++ b/library/alloc/src/boxed.rs @@ -206,7 +206,7 @@ impl Box { /// ``` /// let five = Box::new(5); /// ``` - #[cfg(all(not(no_global_oom_handling), not(bootstrap)))] + #[cfg(all(not(no_global_oom_handling)))] #[inline(always)] #[stable(feature = "rust1", since = "1.0.0")] #[must_use] @@ -215,23 +215,6 @@ impl Box { Box::new(x) } - /// Allocates memory on the heap and then places `x` into it. - /// - /// This doesn't actually allocate if `T` is zero-sized. - /// - /// # Examples - /// - /// ``` - /// let five = Box::new(5); - /// ``` - #[cfg(all(not(no_global_oom_handling), bootstrap))] - #[inline(always)] - #[stable(feature = "rust1", since = "1.0.0")] - #[must_use] - pub fn new(x: T) -> Self { - box x - } - /// Constructs a new box with uninitialized contents. /// /// # Examples @@ -296,7 +279,7 @@ impl Box { #[must_use] #[inline(always)] pub fn pin(x: T) -> Pin> { - (#[cfg_attr(not(bootstrap), rustc_box)] + (#[rustc_box] Box::new(x)) .into() } @@ -1255,7 +1238,7 @@ unsafe impl<#[may_dangle] T: ?Sized, A: Allocator> Drop for Box { impl Default for Box { /// Creates a `Box`, with the `Default` value for T. fn default() -> Self { - #[cfg_attr(not(bootstrap), rustc_box)] + #[rustc_box] Box::new(T::default()) } } @@ -1628,7 +1611,7 @@ impl From<[T; N]> for Box<[T]> { /// println!("{boxed:?}"); /// ``` fn from(array: [T; N]) -> Box<[T]> { - #[cfg_attr(not(bootstrap), rustc_box)] + #[rustc_box] Box::new(array) } } diff --git a/library/alloc/src/lib.rs b/library/alloc/src/lib.rs index c08caa7b93e..d3816d70b63 100644 --- a/library/alloc/src/lib.rs +++ b/library/alloc/src/lib.rs @@ -149,7 +149,6 @@ #![feature(allocator_internals)] #![feature(allow_internal_unstable)] #![feature(associated_type_bounds)] -#![cfg_attr(bootstrap, feature(box_syntax))] #![feature(cfg_sanitize)] #![feature(const_deref)] #![feature(const_mut_refs)] diff --git a/library/alloc/src/macros.rs b/library/alloc/src/macros.rs index 37898b6655f..88eb6aa7a83 100644 --- a/library/alloc/src/macros.rs +++ b/library/alloc/src/macros.rs @@ -34,7 +34,7 @@ /// be mindful of side effects. /// /// [`Vec`]: crate::vec::Vec -#[cfg(all(not(no_global_oom_handling), not(test), not(bootstrap)))] +#[cfg(all(not(no_global_oom_handling), not(test)))] #[macro_export] #[stable(feature = "rust1", since = "1.0.0")] #[rustc_diagnostic_item = "vec_macro"] @@ -54,24 +54,6 @@ macro_rules! vec { ); } -/// Creates a `Vec` containing the arguments (bootstrap version). -#[cfg(all(not(no_global_oom_handling), not(test), bootstrap))] -#[macro_export] -#[stable(feature = "rust1", since = "1.0.0")] -#[rustc_diagnostic_item = "vec_macro"] -#[allow_internal_unstable(box_syntax, liballoc_internals)] -macro_rules! vec { - () => ( - $crate::__rust_force_expr!($crate::vec::Vec::new()) - ); - ($elem:expr; $n:expr) => ( - $crate::__rust_force_expr!($crate::vec::from_elem($elem, $n)) - ); - ($($x:expr),+ $(,)?) => ( - $crate::__rust_force_expr!(<[_]>::into_vec(box [$($x),+])) - ); -} - // HACK(japaric): with cfg(test) the inherent `[T]::into_vec` method, which is // required for this macro definition, is not available. Instead use the // `slice::into_vec` function which is only available with cfg(test) diff --git a/library/alloc/src/vec/mod.rs b/library/alloc/src/vec/mod.rs index e25f98d8aa6..05370576661 100644 --- a/library/alloc/src/vec/mod.rs +++ b/library/alloc/src/vec/mod.rs @@ -3017,7 +3017,7 @@ impl From<[T; N]> for Vec { #[cfg(not(test))] fn from(s: [T; N]) -> Vec { <[T]>::into_vec( - #[cfg_attr(not(bootstrap), rustc_box)] + #[rustc_box] Box::new(s), ) } -- cgit 1.4.1-3-g733a5