]> git.proxmox.com Git - rustc.git/blobdiff - library/std/src/sys/common/alloc.rs
New upstream version 1.70.0+dfsg1
[rustc.git] / library / std / src / sys / common / alloc.rs
index 2a54e99020e38f1bd673e1a4d2c5106aaf7ba0a9..a5fcbdf39c6c685805841a93e9dbe862ed0e707f 100644 (file)
@@ -4,9 +4,10 @@ use crate::ptr;
 
 // The minimum alignment guaranteed by the architecture. This value is used to
 // add fast paths for low alignment values.
-#[cfg(all(any(
+#[cfg(any(
     target_arch = "x86",
     target_arch = "arm",
+    target_arch = "m68k",
     target_arch = "mips",
     target_arch = "powerpc",
     target_arch = "powerpc64",
@@ -14,18 +15,27 @@ use crate::ptr;
     target_arch = "asmjs",
     target_arch = "wasm32",
     target_arch = "hexagon",
-    target_arch = "riscv32"
-)))]
+    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(
+#[cfg(any(
     target_arch = "x86_64",
     target_arch = "aarch64",
+    target_arch = "loongarch64",
     target_arch = "mips64",
     target_arch = "s390x",
     target_arch = "sparc64",
-    target_arch = "riscv64"
-)))]
+    target_arch = "riscv64",
+    target_arch = "wasm64",
+))]
 pub const MIN_ALIGN: usize = 16;
+// The allocator on the esp-idf platform guarantees 4 byte alignment.
+#[cfg(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,