Skip to content

Commit 4821cb2

Browse files
CoAlloc: slice::into_vec_co - for vec![...].
1 parent fae59a0 commit 4821cb2

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

library/alloc/src/slice.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,8 +627,17 @@ impl<T> [T] {
627627
#[rustc_allow_incoherent_impl]
628628
#[stable(feature = "rust1", since = "1.0.0")]
629629
#[inline]
630+
pub fn into_vec<A: Allocator>(self: Box<Self, A>) -> Vec<T, A> {
631+
// N.B., see the `hack` module in this file for more details.
632+
hack::into_vec(self)
633+
}
634+
635+
/// Coallocation-aware version of [into_vec].
636+
#[rustc_allow_incoherent_impl]
637+
#[unstable(feature = "global_co_alloc", issue = "none")]
638+
#[inline]
630639
#[allow(unused_braces)]
631-
pub fn into_vec<A: Allocator, const CO_ALLOC_PREF: CoAllocPref>(
640+
pub fn into_vec_co<A: Allocator, const CO_ALLOC_PREF: CoAllocPref>(
632641
self: Box<Self, A>,
633642
) -> Vec<T, A, CO_ALLOC_PREF>
634643
where

library/alloc/src/vec/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3510,7 +3510,7 @@ where
35103510
/// assert_eq!(Vec::from(b), vec![1, 2, 3]);
35113511
/// ```
35123512
fn from(s: Box<[T], A>) -> Self {
3513-
s.into_vec()
3513+
s.into_vec_co()
35143514
}
35153515
}
35163516

0 commit comments

Comments
 (0)