about summary refs log tree commit diff
path: root/library/std/src/sys
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-05-25 12:52:43 +0000
committerbors <bors@rust-lang.org>2024-05-25 12:52:43 +0000
commit0b2f194b830264f828f5713327369c1f74b4e933 (patch)
treecf5367da7b7a7ff090df0ac69840c15766664b53 /library/std/src/sys
parent77d41156551dc52a4d5df228c897acd239eb6254 (diff)
parent1d54ba84025fa131eae615360d52a70b0aeab3fd (diff)
downloadrust-0b2f194b830264f828f5713327369c1f74b4e933.tar.gz
rust-0b2f194b830264f828f5713327369c1f74b4e933.zip
Auto merge of #125541 - matthiaskrgr:rollup-4gwt4xp, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #125271 (use posix_memalign on almost all Unix targets)
 - #125451 (Fail relating constants of different types)
 - #125478 (Bump bootstrap compiler to the latest beta compiler)
 - #125498 (Stop using the avx512er and avx512pf x86 target features)
 - #125510 (remove proof tree formatting, make em shallow)
 - #125513 (Don't eagerly monomorphize drop for types that are impossible to instantiate)
 - #125514 (Structurally resolve before `builtin_index` in EUV)
 - #125527 (Add manual Sync impl for ReentrantLockGuard)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'library/std/src/sys')
-rw-r--r--library/std/src/sys/pal/unix/alloc.rs16
1 files changed, 7 insertions, 9 deletions
diff --git a/library/std/src/sys/pal/unix/alloc.rs b/library/std/src/sys/pal/unix/alloc.rs
index 2f908e3d0e9..eb3a57c212b 100644
--- a/library/std/src/sys/pal/unix/alloc.rs
+++ b/library/std/src/sys/pal/unix/alloc.rs
@@ -59,10 +59,9 @@ unsafe impl GlobalAlloc for System {
 }
 
 cfg_if::cfg_if! {
-    // We use posix_memalign wherever possible, but not all targets have that function.
+    // We use posix_memalign wherever possible, but some targets have very incomplete POSIX coverage
+    // so we need a fallback for those.
     if #[cfg(any(
-        target_os = "redox",
-        target_os = "espidf",
         target_os = "horizon",
         target_os = "vita",
     ))] {
@@ -74,12 +73,11 @@ cfg_if::cfg_if! {
         #[inline]
         unsafe fn aligned_malloc(layout: &Layout) -> *mut u8 {
             let mut out = ptr::null_mut();
-            // We prefer posix_memalign over aligned_malloc since with aligned_malloc,
-            // implementations are making almost arbitrary choices for which alignments are
-            // "supported", making it hard to use. For instance, some implementations require the
-            // size to be a multiple of the alignment (wasi emmalloc), while others require the
-            // alignment to be at least the pointer size (Illumos, macOS) -- which may or may not be
-            // standards-compliant, but that does not help us.
+            // We prefer posix_memalign over aligned_alloc since it is more widely available, and
+            // since with aligned_alloc, implementations are making almost arbitrary choices for
+            // which alignments are "supported", making it hard to use. For instance, some
+            // implementations require the size to be a multiple of the alignment (wasi emmalloc),
+            // while others require the alignment to be at least the pointer size (Illumos, macOS).
             // posix_memalign only has one, clear requirement: that the alignment be a multiple of
             // `sizeof(void*)`. Since these are all powers of 2, we can just use max.
             let align = layout.align().max(crate::mem::size_of::<usize>());