Skip to content

Commit 16c897e

Browse files
Fixing A and COOP_PREFERRED generics. WIP
1 parent e65b809 commit 16c897e

File tree

3 files changed

+5
-10
lines changed

3 files changed

+5
-10
lines changed

library/alloc/src/lib.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -288,9 +288,3 @@ pub(crate) mod test_helpers {
288288

289289
use crate::alloc::Global;
290290

291-
/// See also `core::alloc::co_alloc_metadata_num_slots_with_preference`.
292-
#[unstable(feature = "global_co_alloc", issue = "none")]
293-
pub const fn co_alloc_metadata_num_slots_with_preference_global(coop_preferred: bool) -> usize {
294-
// FIXME or replace any calls with core::alloc::co_alloc_metadata_num_slots_with_preference::<Global>(COOP_PREFERRED). See raw_vec.rs.
295-
if /*Global::IS_CO_ALLOCATOR*/ true && coop_preferred { 1 } else { 0 }
296-
}

library/alloc/src/string.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,7 @@ where
662662

663663
const REPLACEMENT: &str = "\u{FFFD}";
664664

665-
let mut res = String::with_capacity(v.len());
665+
let mut res = String::<false>::with_capacity(v.len());
666666
res.push_str(first_valid);
667667
res.push_str(REPLACEMENT);
668668

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)