about summary refs log tree commit diff
path: root/library/std/src/sys
diff options
context:
space:
mode:
authorScott Mabin <scott@mabez.dev>2022-01-05 13:13:25 +0000
committerScott Mabin <scott@mabez.dev>2022-01-13 21:09:20 +0000
commit5296baeab13658b307c782e9464cfa6f2027a4ec (patch)
treea1212efb1e229a61166bc5e73582470b92b336dc /library/std/src/sys
parent936ce3dab7fd042101767c439362310f8355e859 (diff)
downloadrust-5296baeab13658b307c782e9464cfa6f2027a4ec.tar.gz
rust-5296baeab13658b307c782e9464cfa6f2027a4ec.zip
Set the allocation MIN_ALIGN for espidf to 4.
Diffstat (limited to 'library/std/src/sys')
-rw-r--r--library/std/src/sys/common/alloc.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/library/std/src/sys/common/alloc.rs b/library/std/src/sys/common/alloc.rs
index 9665d1fa892..e06eaf6db1a 100644
--- a/library/std/src/sys/common/alloc.rs
+++ b/library/std/src/sys/common/alloc.rs
@@ -14,8 +14,8 @@ use crate::ptr;
     target_arch = "asmjs",
     target_arch = "wasm32",
     target_arch = "hexagon",
-    target_arch = "riscv32",
-    target_arch = "xtensa"
+    all(target_arch = "riscv32", not(target_os = "espidf")),
+    all(target_arch = "xtensa", not(target_os = "espidf")),
 )))]
 pub const MIN_ALIGN: usize = 8;
 #[cfg(all(any(
@@ -28,6 +28,12 @@ pub const MIN_ALIGN: usize = 8;
     target_arch = "wasm64",
 )))]
 pub const MIN_ALIGN: usize = 16;
+// The allocator on the esp-idf platform guarentees 4 byte alignment.
+#[cfg(all(any(
+    all(target_arch = "riscv32", target_os = "espidf"),
+    all(target_arch = "xtensa", target_os = "espidf"),
+)))]
+pub const MIN_ALIGN: usize = 4;
 
 pub unsafe fn realloc_fallback(
     alloc: &System,