File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -66,6 +66,12 @@ use crate::ptr;
6666/// let number_of_heap_allocs = /* call private allocator API */;
6767/// unsafe { std::intrinsics::assume(number_of_heap_allocs > 0); }
6868/// ```
69+ ///
70+ /// Note that allocation/deallocation pairs being moved to the stack is not the only
71+ /// optimization that can be applied. You may generally not rely on heap allocations
72+ /// happening, if they can be removed without changing program behaviour.
73+ /// Whether allocations happen or not is not part of the program behaviour, even if it
74+ /// could be detected via an allocator that tracks allocations.
6975#[ stable( feature = "global_alloc" , since = "1.28.0" ) ]
7076pub unsafe trait GlobalAlloc {
7177 /// Allocate memory as described by the given `layout`.
You can’t perform that action at this time.
0 commit comments