Skip to content

Commit 4ecbd3b

Browse files
committed
fix alloc
1 parent 63e0ddb commit 4ecbd3b

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

library/alloc/src/boxed.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -576,8 +576,7 @@ impl<T, A: Allocator> Box<T, A> {
576576
///
577577
/// This conversion does not allocate on the heap and happens in place.
578578
#[unstable(feature = "box_into_boxed_slice", issue = "71582")]
579-
#[rustc_const_unstable(feature = "const_box", issue = "92521")]
580-
pub const fn into_boxed_slice(boxed: Self) -> Box<[T], A> {
579+
pub fn into_boxed_slice(boxed: Self) -> Box<[T], A> {
581580
let (raw, alloc) = Box::into_raw_with_allocator(boxed);
582581
unsafe { Box::from_raw_in(raw as *mut [T; 1], alloc) }
583582
}
@@ -809,9 +808,8 @@ impl<T, A: Allocator> Box<mem::MaybeUninit<T>, A> {
809808
/// assert_eq!(*five, 5)
810809
/// ```
811810
#[unstable(feature = "new_uninit", issue = "63291")]
812-
#[rustc_const_unstable(feature = "const_box", issue = "92521")]
813811
#[inline]
814-
pub const unsafe fn assume_init(self) -> Box<T, A> {
812+
pub unsafe fn assume_init(self) -> Box<T, A> {
815813
let (raw, alloc) = Box::into_raw_with_allocator(self);
816814
unsafe { Box::from_raw_in(raw as *mut T, alloc) }
817815
}
@@ -844,9 +842,8 @@ impl<T, A: Allocator> Box<mem::MaybeUninit<T>, A> {
844842
/// }
845843
/// ```
846844
#[unstable(feature = "new_uninit", issue = "63291")]
847-
#[rustc_const_unstable(feature = "const_box", issue = "92521")]
848845
#[inline]
849-
pub const fn write(mut boxed: Self, value: T) -> Box<T, A> {
846+
pub fn write(mut boxed: Self, value: T) -> Box<T, A> {
850847
unsafe {
851848
(*boxed).write(value);
852849
boxed.assume_init()
@@ -1090,9 +1087,8 @@ impl<T: ?Sized, A: Allocator> Box<T, A> {
10901087
///
10911088
/// [memory layout]: self#memory-layout
10921089
#[unstable(feature = "allocator_api", issue = "32838")]
1093-
#[rustc_const_unstable(feature = "const_box", issue = "92521")]
10941090
#[inline]
1095-
pub const fn into_raw_with_allocator(b: Self) -> (*mut T, A) {
1091+
pub fn into_raw_with_allocator(b: Self) -> (*mut T, A) {
10961092
let (leaked, alloc) = Box::into_unique(b);
10971093
(leaked.as_ptr(), alloc)
10981094
}
@@ -1102,10 +1098,9 @@ impl<T: ?Sized, A: Allocator> Box<T, A> {
11021098
issue = "none",
11031099
reason = "use `Box::leak(b).into()` or `Unique::from(Box::leak(b))` instead"
11041100
)]
1105-
#[rustc_const_unstable(feature = "const_box", issue = "92521")]
11061101
#[inline]
11071102
#[doc(hidden)]
1108-
pub const fn into_unique(b: Self) -> (Unique<T>, A) {
1103+
pub fn into_unique(b: Self) -> (Unique<T>, A) {
11091104
// Box is recognized as a "unique pointer" by Stacked Borrows, but internally it is a
11101105
// raw pointer for the type system. Turning it directly into a raw pointer would not be
11111106
// recognized as "releasing" the unique pointer to permit aliased raw accesses,
@@ -1163,9 +1158,8 @@ impl<T: ?Sized, A: Allocator> Box<T, A> {
11631158
/// assert_eq!(*static_ref, [4, 2, 3]);
11641159
/// ```
11651160
#[stable(feature = "box_leak", since = "1.26.0")]
1166-
#[rustc_const_unstable(feature = "const_box", issue = "92521")]
11671161
#[inline]
1168-
pub const fn leak<'a>(b: Self) -> &'a mut T
1162+
pub fn leak<'a>(b: Self) -> &'a mut T
11691163
where
11701164
A: 'a,
11711165
{

0 commit comments

Comments
 (0)