-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not allocate for ZST ThinBox (attempt 2 using const_allocate) #123254
Conversation
I would strongly prefer that we not have an implementation that is only justifiable by the surface being unstable as well. It's one thing to have it be somewhat experimental. |
...on second thought, I took a look at the other PR and it seems to be so radioactive its like I saw the Elephant's Foot. If you can sell oli on this one, then carry on. |
This comment has been minimized.
This comment has been minimized.
34e0d9a
to
6e29f87
Compare
Only if you make sure that ThinBox will not be stabilized in this form, and promise that you are okay with removing this optimization again without hesitation if we change const_allocate in ways that make it not work any more. It is nice to see experimentation with const_allocate and that it can be useful even in its current form. But I want to be sure we are not locked-in to its current form either. |
If it comes to stabilization, I'd prefer to not stabilize But my opinion has little weight.
Yes, I think this is useful as
|
6e29f87
to
8caa27d
Compare
8caa27d
to
0a71aed
Compare
0a71aed
to
f7f89b2
Compare
f7f89b2
to
9546c3f
Compare
9546c3f
to
f2fa71e
Compare
yea, this seems fine to me. Things to do in this PR
Things to do in follow-up PRs
|
There's PR rust-lang#123184 which avoids allocation for ZST ThinBox. That PR has an issue with unsoundness with misuse of `MaybeUninit` (see comments in that PR). This PR is much simpler implementation which does not have this problem, but it uses `const_allocate` feature.
f2fa71e
to
f539134
Compare
Done.
Give pointers where how to do that please?
Is that something I can do?
Like submodule |
I added it
if a submodule works out nicely with visibility, that's prefereable imo @bors r+ rollup |
…llaumeGomez Rollup of 8 pull requests Successful merges: - rust-lang#123254 (Do not allocate for ZST ThinBox (attempt 2 using const_allocate)) - rust-lang#123626 (Add MC/DC support to coverage test tools) - rust-lang#123638 (rustdoc: synthetic auto: filter out clauses from the implementor's ParamEnv) - rust-lang#123653 (Split `non_local_definitions` lint tests in separate test files) - rust-lang#123658 (Stop making any assumption about the projections applied to the upvars in the `ByMoveBody` pass) - rust-lang#123662 (Don't rely on upvars being assigned just because coroutine-closure kind is assigned) - rust-lang#123665 (Fix typo in `Future::poll()` docs) - rust-lang#123672 (compiletest: unset `RUSTC_LOG_COLOR`) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#123254 - stepancheg:thin-box-0-const-alloc, r=oli-obk Do not allocate for ZST ThinBox (attempt 2 using const_allocate) There's PR rust-lang#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`
There's PR #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 onFreeze
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 withconst_allocate
. Maybe it's OK to useconst_allocate
whileThinBox
is unstable? Or, well, we can abandon this PR.r? @oli-obk