about summary refs log tree commit diff
path: root/library/std/src/sys/pal/unix/alloc.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-05-08 09:29:57 +0000
committerbors <bors@rust-lang.org>2024-05-08 09:29:57 +0000
commit1fef1524f2717afb76832f1620ae54201f96523e (patch)
tree9b3612606b198e24fe1949cba8c73727bd89e856 /library/std/src/sys/pal/unix/alloc.rs
parent7aa17df0f4f3fd77957ad0c74528c503f316501a (diff)
parentceb5ec3ad9d3e42670bb320321d8563bdf5f5ace (diff)
downloadrust-1fef1524f2717afb76832f1620ae54201f96523e.tar.gz
rust-1fef1524f2717afb76832f1620ae54201f96523e.zip
Auto merge of #124879 - workingjubilee:rollup-1k77hyz, r=workingjubilee
Rollup of 4 pull requests

Successful merges:

 - #124470 (std::net: Socket::new_raw now set to SO_NOSIGPIPE on freebsd.)
 - #124782 (add note about `AlreadyExists` to `create_new`)
 - #124788 (Convert instances of `target_os = "macos"` to `target_vendor = "apple"`)
 - #124838 (next_power_of_two: add a doctest to show what happens on 0)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'library/std/src/sys/pal/unix/alloc.rs')
-rw-r--r--library/std/src/sys/pal/unix/alloc.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/library/std/src/sys/pal/unix/alloc.rs b/library/std/src/sys/pal/unix/alloc.rs
index af0089978ec..9938c0bac25 100644
--- a/library/std/src/sys/pal/unix/alloc.rs
+++ b/library/std/src/sys/pal/unix/alloc.rs
@@ -13,7 +13,13 @@ unsafe impl GlobalAlloc for System {
         if layout.align() <= MIN_ALIGN && layout.align() <= layout.size() {
             libc::malloc(layout.size()) as *mut u8
         } else {
-            #[cfg(target_os = "macos")]
+            // `posix_memalign` returns a non-aligned value if supplied a very
+            // large alignment on older versions of Apple's platforms (unknown
+            // exactly which version range, but the issue is definitely
+            // present in macOS 10.14 and iOS 13.3).
+            //
+            // <https://github.com/rust-lang/rust/issues/30170>
+            #[cfg(target_vendor = "apple")]
             {
                 if layout.align() > (1 << 31) {
                     return ptr::null_mut();