-
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
Use AllocRef
for ZSTs in RawVec
#69824
Conversation
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
a2679ba
to
2c8c689
Compare
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
@Gankra Do you want to take a look into this, as you have written the first |
I probably want to merge rust-lang/wg-allocators#44 first as well, as |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
My main concern with this change is that we are turning a compile-time check ( |
AFAICT we don't have that runtime check. Let's take
We basically just move the checks one layer down the road. When using Hopefully I didn't miss anything there... 😄 |
☔ The latest upstream changes (presumably #69879) made this pull request unmergeable. Please resolve the merge conflicts. |
Closing in favor of #69889 |
Moves the responsibility for handling ZSTs from
RawVec
toAllocRef
. On the same occasion I have moved the logic for reserving and shrinking into the new methodsgrow
andshrink
to keep the logic in one place without changing the behavior.Every grow/shrink operation now has three steps:
AllocRef
self.ptr
andself.cap
There are no more checks in
RawVec
needed for taking a different path for ZSTs.This is the last item on the roadmap to support ZSTs in
AllocRef
: rust-lang/wg-allocators#38 (comment)Requires #69799 to land first, otherwise
Global
will be called with zero-sized layouts.closes rust-lang/wg-allocators#38
r? @Amanieu