Skip to content

Commit 69721de

Browse files
authored
Forbid mixing System with sytem allocator calls
1 parent dec6894 commit 69721de

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)