56d540e057
Remove potentially misleading realloc parenthetical This parenthetical is problematic, because it suggests that the following is sound: ```rust let layout = Layout:🆕:<[u8; 32]>(); let p1 = alloc(layout); let p2 = realloc(p1, layout, 32); if p1 == p2 { p1.write([0; 32]); dealloc(p1, layout); } else { dealloc(p2, layout); } ``` At the very least, this isn't the case for [ANSI `realloc`](https://en.cppreference.com/w/c/memory/realloc) > The original pointer `ptr` is invalidated and any access to it is undefined behavior (even if reallocation was in-place). and [Windows `HeapReAlloc`](https://docs.microsoft.com/en-us/windows/win32/api/heapapi/nf-heapapi-heaprealloc) is unclear at best (`HEAP_REALLOC_IN_PLACE_ONLY`'s description may imply that the old pointer may be used if `HEAP_REALLOC_IN_PLACE_ONLY` is provided). The conservative position is to just remove the parenthetical. cc `@rust-lang/wg-unsafe-code-guidelines` `@rust-lang/wg-allocators` |
||
---|---|---|
.. | ||
benches | ||
primitive_docs | ||
src | ||
tests | ||
Cargo.toml |