You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is incorrect and violates pin's drop guarantee which in turn breaks existing correct code assuming this rule. For this reason std::box::Box::pin_in has A: 'static bound over the allocator generic type argument.
The text was updated successfully, but these errors were encountered:
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:
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.
This is incorrect and violates pin's drop guarantee which in turn breaks existing correct code assuming this rule. For this reason
std::box::Box::pin_in
hasA: 'static
bound over the allocator generic type argument.The text was updated successfully, but these errors were encountered: