Box with !Unpin allocator

Shouldn't it include the bound A: Unpin too? Box contains a field of type A, and if it's !Unpin, we can still unpin it using e.g. Box::into_raw_with_allocator().

It depends on whether Box semantically pin projects its fields. If Pin<&mut Box<T>> doesn't let you get Pin<P<A>>, the the allocator is never actually pinned.

1 Like