@@ -169,8 +169,9 @@ pub unsafe trait Allocator {
169169 /// this, the allocator may extend the allocation referenced by `ptr` to fit the new layout.
170170 ///
171171 /// 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.
174175 ///
175176 /// If this method returns `Err`, then ownership of the memory block has not been transferred to
176177 /// this allocator, and the contents of the memory block are unaltered.
@@ -295,8 +296,9 @@ pub unsafe trait Allocator {
295296 /// this, the allocator may shrink the allocation referenced by `ptr` to fit the new layout.
296297 ///
297298 /// 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.
300302 ///
301303 /// If this method returns `Err`, then ownership of the memory block has not been transferred to
302304 /// this allocator, and the contents of the memory block are unaltered.
0 commit comments