We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c3202af commit 2fffb3aCopy full SHA for 2fffb3a
library/std/src/sys/pal/unix/alloc.rs
@@ -87,7 +87,11 @@ cfg_if::cfg_if! {
87
// [3]: https://bugs.chromium.org/p/chromium/issues/detail?id=138579
88
// [4]: https://chromium.googlesource.com/chromium/src/base/+/master/
89
// /memory/aligned_memory.cc
90
- libc::memalign(layout.align(), layout.size()) as *mut u8
+ //
91
+ // We purpose use the higher alignment so we have it at least
92
+ // a proper word size value guaranteed.
93
+ let align = layout.align().max(create::mem::size_of::<usize>());
94
+ libc::memalign(align, layout.size()) as *mut u8
95
}
96
} else if #[cfg(target_os = "wasi")] {
97
#[inline]
0 commit comments