Skip to content

Commit e8d07df

Browse files
CoAlloc: Vec: COOP_PREFERRED
1 parent 452bf19 commit e8d07df

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

library/alloc/src/vec/spec_from_iter.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use core::alloc::{self, Allocator};
2+
use crate::alloc::Global;
23
use core::mem::ManuallyDrop;
34
use core::ptr::{self};
45

@@ -38,9 +39,9 @@ where
3839
}
3940

4041
#[allow(unused_braces)]
41-
impl<T, A: Allocator, const COOP_PREFERRED: bool> SpecFromIter<T, IntoIter<T>> for Vec<T, A, COOP_PREFERRED>
42+
impl<T, const COOP_PREFERRED: bool> SpecFromIter<T, IntoIter<T>> for Vec<T, Global, COOP_PREFERRED>
4243
where
43-
[(); alloc::co_alloc_metadata_num_slots_with_preference::<A>(COOP_PREFERRED)]:,
44+
[(); alloc::co_alloc_metadata_num_slots_with_preference::<Global>(COOP_PREFERRED)]:,
4445
{
4546
fn from_iter(iterator: IntoIter<T>) -> Self {
4647
// A common case is passing a vector into a function which immediately
@@ -62,7 +63,7 @@ where
6263
}
6364
}
6465

65-
let mut vec = Vec::new();
66+
let mut vec = Vec::<T, Global, COOP_PREFERRED>::new();
6667
// must delegate to spec_extend() since extend() itself delegates
6768
// to spec_from for empty Vecs
6869
vec.spec_extend(iterator);

0 commit comments

Comments
 (0)