a2b4d97984
Require allocator to be static for boxed `Pin`-API Allocators has to retain their validity until the instance and all of its clones are dropped. When pinning a value, it must live forever, thus, the allocator requires a `'static` lifetime for pinning a value. [Example from reddit](https://www.reddit.com/r/rust/comments/jymzdw/the_story_continues_vec_now_supports_custom/gd7qak2?utm_source=share&utm_medium=web2x&context=3): ```rust let alloc = MyAlloc(/* ... */); let pinned = Box::pin_in(42, alloc); mem::forget(pinned); // Now `value` must live forever // Otherwise `Pin`'s invariants are violated, storage invalidated // before Drop was called. // borrow of `memory` can end here, there is no value keeping it. drop(alloc); // Oh, value doesn't live forever. ``` |
||
---|---|---|
.. | ||
alloc | ||
backtrace@af078ecc0b | ||
core | ||
panic_abort | ||
panic_unwind | ||
proc_macro | ||
profiler_builtins | ||
rtstartup | ||
rustc-std-workspace-alloc | ||
rustc-std-workspace-core | ||
rustc-std-workspace-std | ||
std | ||
stdarch@777efaf564 | ||
term | ||
test | ||
unwind |