mirror of
https://github.com/rust-lang/rust.git
synced 2025-10-28 11:38:01 +00:00
Do not allocate for ZST ThinBox (attempt 2 using const_allocate) There's PR https://github.com/rust-lang/rust/pull/123184 which avoids allocation for ZST ThinBox. That PR has an issue with unsoundness with padding in `MaybeUninit` (see comments in that PR). Also that PR relies on `Freeze` trait. This PR is much simpler implementation which does not have this problem, but it uses `const_allocate` feature. `@oli-obk` suggested that `const_allocate` should not be used for that feature. But I like how easy it to do this feature with `const_allocate`. Maybe it's OK to use `const_allocate` while `ThinBox` is unstable? Or, well, we can abandon this PR. r? `@oli-obk`