We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 07e11e8 commit 03d7001Copy full SHA for 03d7001
library/core/src/alloc/global.rs
@@ -30,7 +30,8 @@ use crate::ptr;
30
/// };
31
///
32
/// const ARENA_SIZE: usize = 128 * 1024;
33
-/// #[repr(C, align(131072))] // 131072 == ARENA_SIZE.
+/// const MAX_SUPPORTED_ALIGN: usize = 4096;
34
+/// #[repr(C, align(4096))] // 4096 == MAX_SUPPORTED_ALIGN
35
/// struct SimpleAllocator {
36
/// arena: UnsafeCell<[u8; ARENA_SIZE]>,
37
/// remaining: AtomicUsize, // we allocate from the top, counting down
@@ -53,8 +54,7 @@ use crate::ptr;
53
54
/// // So we can safely use a mask to ensure alignment without worrying about UB.
55
/// let align_mask_to_round_down = !(align - 1);
56
-/// if align > ARENA_SIZE {
57
-/// // align may be > size !
+/// if align > MAX_SUPPORTED_ALIGN {
58
/// return null_mut();
59
/// }
60
0 commit comments