rust/library/alloc
Dylan DPC a2b4d97984
Rollup merge of #79327 - TimDiekmann:static-alloc-pin-in-box, r=Mark-Simulacrum
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.
```
2020-11-29 03:14:07 +01:00
..
benches Reorder benches const variable 2020-09-29 21:39:24 +08:00
src Rollup merge of #79327 - TimDiekmann:static-alloc-pin-in-box, r=Mark-Simulacrum 2020-11-29 03:14:07 +01:00
tests Fix new 'unnecessary trailing semicolon' warnings 2020-11-26 17:08:36 -05:00
Cargo.toml add options to use optimized and mangled compiler builtins 2020-11-15 08:23:31 +01:00