Skip to content

Commit

Permalink
Rollup merge of #101394 - CAD97:patch-3, r=Mark-Simulacrum
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
matthiaskrgr authored Sep 4, 2022
2 parents dd35e2f + 69721de commit 723f0c4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion library/std/src/alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 723f0c4

Please sign in to comment.