Skip to content

Commit 7d05058

Browse files
TODO replace co_alloc_metadata_num_slots_with_preference_global(...)
1 parent ea538d2 commit 7d05058

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

library/alloc/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,5 +291,6 @@ use crate::alloc::Global;
291291
/// See also `core::alloc::co_alloc_metadata_num_slots_with_preference`.
292292
#[unstable(feature = "global_co_alloc", issue = "none")]
293293
pub const fn co_alloc_metadata_num_slots_with_preference_global(coop_preferred: bool) -> usize {
294-
if Global::IS_CO_ALLOCATOR && coop_preferred { 1 } else { 0 }
294+
// FIXME or replace any calls with core::alloc::co_alloc_metadata_num_slots_with_preference_specific::<Global>(COOP_PREFERRED). Then rename co_alloc_metadata_num_slots_with_preference_specific to co_alloc_metadata_num_slots_with_preference. See raw_vec.rs.
295+
if /*Global::IS_CO_ALLOCATOR*/ true && coop_preferred { 1 } else { 0 }
295296
}

library/alloc/src/raw_vec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ pub(crate) struct RawVec<
7070

7171
impl<T, const COOP_PREFERRED: bool> RawVec<T, Global, COOP_PREFERRED>
7272
where
73-
[(); crate::co_alloc_metadata_num_slots_with_preference_global(COOP_PREFERRED)]:,
73+
[(); core::alloc::co_alloc_metadata_num_slots_with_preference_specific::<Global>(COOP_PREFERRED)]:,
7474
{
7575
/// HACK(Centril): This exists because stable `const fn` can only call stable `const fn`, so
7676
/// they cannot call `Self::new()`.

library/core/src/alloc/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,9 @@ pub type SliceAndMetaResult = Result<SliceAndMeta, AllocError>;
9494

9595
#[unstable(feature = "global_co_alloc", issue = "none")]
9696
pub const fn co_alloc_metadata_num_slots<A: Allocator>() -> usize {
97-
if true {
98-
panic!("FIXME - consider removing co_alloc_metadata_num_slots()");
97+
// @FIXME later
98+
if false {
99+
panic!("FIXME - consider replacing co_alloc_metadata_num_slots() with co_alloc_metadata_num_slots_with_preference_specific(bool), and adding const flags as appropriate.");
99100
}
100101
if A::IS_CO_ALLOCATOR { 1 } else { 0 }
101102
}

0 commit comments

Comments
 (0)