Skip to content

Commit a639b99

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/f9a81022962cfb4cb30366572e1afe3ca762854a/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 7807c60 + b35a3c1 commit a639b99

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

std/src/alloc.rs

Lines changed: 4 additions & 1 deletion
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)