rust/library
bors 56d540e057 Auto merge of #97053 - CAD97:realloc-clarification, r=dtolnay
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`
2022-05-16 02:33:34 +00:00
..
alloc Rollup merge of #95365 - mkroening:hermit-alloc-error-handler, r=joshtriplett 2022-05-14 13:42:49 +09:00
backtrace@b02ed04a7e
core Auto merge of #97053 - CAD97:realloc-clarification, r=dtolnay 2022-05-16 02:33:34 +00:00
panic_abort
panic_unwind
portable-simd
proc_macro Remove some unnecessary rustc_allow_const_fn_unstable attributes. 2022-05-13 16:01:18 +10:00
profiler_builtins
rtstartup
rustc-std-workspace-alloc
rustc-std-workspace-core
rustc-std-workspace-std
std Rollup merge of #97060 - bdbai:fix/uwphandle, r=ChrisDenton 2022-05-15 18:41:27 +02:00
stdarch@28335054b1 Also allow unused macro rules in stdarch 2022-05-10 19:53:22 +02:00
test
unwind Add LLVM based mingw-w64 targets 2022-05-13 20:14:15 +02:00