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;
66
66
/// let number_of_heap_allocs = /* call private allocator API */;
67
67
/// unsafe { std::intrinsics::assume(number_of_heap_allocs > 0); }
68
68
/// ```
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.
69
75
#[ stable( feature = "global_alloc" , since = "1.28.0" ) ]
70
76
pub unsafe trait GlobalAlloc {
71
77
/// Allocate memory as described by the given `layout`.
You can’t perform that action at this time.
0 commit comments