Skip to content

Commit 723f0c4

Browse files
authored
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.
2 parents dd35e2f + 69721de commit 723f0c4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

library/std/src/alloc.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,10 @@ pub use alloc_crate::alloc::*;
6868
/// The default memory allocator provided by the operating system.
6969
///
7070
/// This is based on `malloc` on Unix platforms and `HeapAlloc` on Windows,
71-
/// plus related functions.
71+
/// plus related functions. However, it is not valid to mix use of the backing
72+
/// system allocator with `System`, as this implementation may include extra
73+
/// work, such as to serve alignment requests greater than the alignment
74+
/// provided directly by the backing system allocator.
7275
///
7376
/// This type implements the `GlobalAlloc` trait and Rust programs by default
7477
/// work as if they had this definition:

0 commit comments

Comments
 (0)