rust-lang / wg-allocators

Home of the Allocators working group: Paving a path for a standard set of allocator traits to be used in collections!
http://bit.ly/hello-wg-allocators
203 stars 9 forks source link

Explicitly mention in the docs that `grow`, `grow_zeroed`, and `shrink` have to handle changes in alignment #97

Closed autumnontape closed 2 years ago

autumnontape commented 2 years ago

The docs currently imply that the alignment of new_layout may be different from that of old_layout by not stating otherwise. Reallocations with altered alignments are extremely uncommon; I had to track down #5 in this repository to convince myself this wasn't a mistake. This could be a pitfall for implementors of Allocator if it's not made more explicit.

Amanieu commented 2 years ago

Sounds good, would you be willing to make a PR to rust-lang/rust to update the documentation?

autumnontape commented 2 years ago

Sure! I can probably do that a few hours from now.

autumnontape commented 2 years ago

I've opened https://github.com/rust-lang/rust/pull/95546.

autumnontape commented 2 years ago

https://github.com/rust-lang/rust/pull/95546 was merged!