Skip to content

Commit 9ca4c8e

Browse files
CoAlloc: minor tidy
1 parent 4a996e6 commit 9ca4c8e

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

library/alloc/src/macros.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,10 @@ macro_rules! meta_num_slots_global {
207207
#[macro_export]
208208
macro_rules! meta_num_slots_default_global {
209209
() => {
210-
if ::alloc::alloc::Global::CO_ALLOC_META_NUM_SLOTS && (DEFAULT_COOP_PREF!()) { 1 } else { 0 }
210+
if ::alloc::alloc::Global::CO_ALLOC_META_NUM_SLOTS && (DEFAULT_COOP_PREF!()) {
211+
1
212+
} else {
213+
0
214+
}
211215
};
212216
}

library/alloc/src/raw_vec.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
#![unstable(feature = "raw_vec_internals", reason = "unstable const warnings", issue = "none")]
22

33
use crate::meta_num_slots_default;
4+
use core::alloc::CoAllocMetaBase;
45
use core::alloc::{self, LayoutError, PtrAndMeta};
56
use core::cmp;
67
use core::intrinsics;
78
use core::mem::{self, ManuallyDrop, MaybeUninit, SizedTypeProperties};
89
use core::ops::Drop;
910
use core::ptr::{self, NonNull, Unique};
1011
use core::slice;
11-
use core::alloc::CoAllocMetaBase;
1212

1313
#[cfg(not(no_global_oom_handling))]
1414
use crate::alloc::handle_alloc_error;
@@ -53,8 +53,11 @@ enum AllocInit {
5353
/// `Box<[T]>`, since `capacity()` won't yield the length.
5454
#[allow(missing_debug_implementations)]
5555
#[allow(unused_braces)] //@FIXME remove #[allow(unused_braces)] once that false positive warning fix is included on stable
56-
pub(crate) struct RawVec<T, A: Allocator = Global, const COOP_PREF: bool = { CO_ALLOC_PREF_DEFAULT!() }>
57-
where
56+
pub(crate) struct RawVec<
57+
T,
58+
A: Allocator = Global,
59+
const COOP_PREF: bool = { CO_ALLOC_PREF_DEFAULT!() },
60+
> where
5861
[(); alloc::co_alloc_metadata_num_slots_with_preference::<A>(COOP_PREF)]:,
5962
{
6063
ptr: Unique<T>,
@@ -121,7 +124,7 @@ impl<T, A: Allocator, const COOP_PREF: bool> RawVec<T, A, COOP_PREF>
121124
where
122125
[(); alloc::co_alloc_metadata_num_slots_with_preference::<A>(COOP_PREF)]:,
123126
{
124-
const fn new_plain_metas() -> [A::CoAllocMeta; {meta_num_slots_default!(A)}] {
127+
const fn new_plain_metas() -> [A::CoAllocMeta; { meta_num_slots_default!(A) }] {
125128
loop {}
126129
}
127130

library/core/src/alloc/global.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ pub struct RawAndMeta<M: CoAllocMetaBase> {
131131
#[stable(feature = "global_alloc", since = "1.28.0")]
132132
pub unsafe trait GlobalAlloc {
133133
/// NOT for public use. The default value MAY be REMOVED or CHANGED.
134-
///
134+
///
135135
/// @FIXME Validate (preferrable at compile time, otherwise as a test) that this type's
136136
/// alignment <= `usize` alignment.
137137
#[unstable(feature = "global_co_alloc_meta", issue = "none")]

0 commit comments

Comments
 (0)