@@ -169,8 +169,9 @@ pub unsafe trait Allocator {
169
169
/// this, the allocator may extend the allocation referenced by `ptr` to fit the new layout.
170
170
///
171
171
/// If this returns `Ok`, then ownership of the memory block referenced by `ptr` has been
172
- /// transferred to this allocator. The memory may or may not have been freed, and should be
173
- /// considered unusable.
172
+ /// transferred to this allocator. Any access to the old `ptr` is Undefined Behavior, even if the
173
+ /// allocation was grown in-place. The newly returned pointer is the only valid pointer
174
+ /// for accessing this memory now.
174
175
///
175
176
/// If this method returns `Err`, then ownership of the memory block has not been transferred to
176
177
/// this allocator, and the contents of the memory block are unaltered.
@@ -295,8 +296,9 @@ pub unsafe trait Allocator {
295
296
/// this, the allocator may shrink the allocation referenced by `ptr` to fit the new layout.
296
297
///
297
298
/// If this returns `Ok`, then ownership of the memory block referenced by `ptr` has been
298
- /// transferred to this allocator. The memory may or may not have been freed, and should be
299
- /// considered unusable.
299
+ /// transferred to this allocator. Any access to the old `ptr` is Undefined Behavior, even if the
300
+ /// allocation was shrunk in-place. The newly returned pointer is the only valid pointer
301
+ /// for accessing this memory now.
300
302
///
301
303
/// If this method returns `Err`, then ownership of the memory block has not been transferred to
302
304
/// this allocator, and the contents of the memory block are unaltered.
0 commit comments