Skip to content

Commit 701135d

Browse files
Fixing A and COOP_PREFERRED generics. WIP.
1 parent ac8406e commit 701135d

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

library/alloc/src/collections/vec_deque/spec_from_iter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use super::{IntoIter, VecDeque};
2-
use crate::Global;
2+
use crate::alloc::Global;
33
use core::alloc;
44

55
/// Specialization trait used for `VecDeque::from_iter`

library/alloc/src/ffi/c_str.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use core::ptr;
1717
use core::slice;
1818
use core::slice::memchr;
1919
use core::str::{self, Utf8Error};
20-
use crate::Global;
20+
use crate::alloc::Global;
2121
use crate::DEFAULT_COOP_PREFERRED;
2222

2323
#[cfg(target_has_atomic = "ptr")]

library/alloc/src/slice.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,11 +454,14 @@ impl<T> [T] {
454454
#[rustc_conversion_suggestion]
455455
#[stable(feature = "rust1", since = "1.0.0")]
456456
#[inline]
457-
pub fn to_vec(&self) -> Vec<T>
457+
pub fn to_vec<const COOP_PREFERRED: bool>(&self) -> Vec<T, Global, COOP_PREFERRED>
458458
where
459459
T: Clone,
460+
[(); core::alloc::co_alloc_metadata_num_slots_with_preference::<Global>(
461+
COOP_PREFERRED,
462+
)]:,
460463
{
461-
self.to_vec_in(Global)
464+
self.to_vec_in::<Global, COOP_PREFERRED>(Global)
462465
}
463466

464467
/// Copies `self` into a new `Vec` with an allocator.

library/alloc/src/vec/spec_from_iter_nested.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use core::iter::TrustedLen;
44
use core::ptr;
55

66
use crate::raw_vec::RawVec;
7-
use crate::Global;
7+
use crate::alloc::Global;
88
use crate::DEFAULT_COOP_PREFERRED;
99

1010
use super::{SpecExtend, Vec};

0 commit comments

Comments
 (0)