rust/library/alloc
Guillaume Gomez 1c5db28ec3
Rollup merge of #123254 - stepancheg:thin-box-0-const-alloc, r=oli-obk
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`
2024-04-09 13:39:21 +02:00
..
benches disable benches in Miri 2024-04-07 09:58:10 +02:00
src Rollup merge of #123254 - stepancheg:thin-box-0-const-alloc, r=oli-obk 2024-04-09 13:39:21 +02:00
tests stabilize ptr.is_aligned, move ptr.is_aligned_to to a new feature gate 2024-03-29 19:59:46 -04:00
Cargo.toml Rename {collections=>alloc}{tests,benches} 2023-11-26 12:04:56 +00:00