diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-09-04 18:55:46 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-04 18:55:46 +0200 |
| commit | 723f0c477bb08012dbde95eb7510a0230579fe6a (patch) | |
| tree | b4c9a0396da8c567c0402346f1bdbc8f468c762c | |
| parent | dd35e2f79bd19f331ca8a0644400af99e5a598ae (diff) | |
| parent | 69721defc21e9704c39aec65dea9e2be4377cb1b (diff) | |
| download | rust-723f0c477bb08012dbde95eb7510a0230579fe6a.tar.gz rust-723f0c477bb08012dbde95eb7510a0230579fe6a.zip | |
Rollup merge of #101394 - CAD97:patch-3, r=Mark-Simulacrum
Forbid mixing `System` with direct sytem allocator calls e.g. [on windows](https://github.com/rust-lang/rust/blob/dec689432fac6720b2f18101ac28a21add98b1b8/library/std/src/sys/windows/alloc.rs#L129-L178), trying to mix `System::alloc` and `HeapFree` will not work because of the extra work done to serve higher alignments.
| -rw-r--r-- | library/std/src/alloc.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/library/std/src/alloc.rs b/library/std/src/alloc.rs index a05e0db3af7..61c1ff578b2 100644 --- a/library/std/src/alloc.rs +++ b/library/std/src/alloc.rs @@ -68,7 +68,10 @@ pub use alloc_crate::alloc::*; /// The default memory allocator provided by the operating system. /// /// This is based on `malloc` on Unix platforms and `HeapAlloc` on Windows, -/// plus related functions. +/// plus related functions. However, it is not valid to mix use of the backing +/// system allocator with `System`, as this implementation may include extra +/// work, such as to serve alignment requests greater than the alignment +/// provided directly by the backing system allocator. /// /// This type implements the `GlobalAlloc` trait and Rust programs by default /// work as if they had this definition: |
