Remove some dead code in DroplessArena. - #159053
Conversation
PR 155325 disallowed ZSTs in `DroplessArena`. This commit removes some dead code paths that were missed in that PR.
|
|
| let elem_size = cmp::max(1, size_of::<T>()); | ||
| let elem_size = size_of::<T>(); |
There was a problem hiding this comment.
Could you add a comment explaning that we forbidded ZSTs earlier? Or even an assert
|
|
||
| impl<T> ArenaChunk<T> { | ||
| #[inline] | ||
| unsafe fn new(capacity: usize) -> ArenaChunk<T> { |
There was a problem hiding this comment.
This should have a safety comment saying to not use on ZSTs, and an assert!(size_of::<T>() > 0)
| fn default() -> TypedArena<T> { | ||
| TypedArena { |
There was a problem hiding this comment.
Can you assert T isn't a ZST?
|
#155325 isn't the right PR, do you have the link to the right one handy? |
|
About the asserts: we already have eight assertions in this file that the size of |
|
You can create an |
|
Could a single const assert be added on the size of T? |
I don't think so: the assertion would need to be within a function like |
PR 155325 disallowed ZSTs in
DroplessArena. This commit removes some dead code paths that were missed in that PR.r? @Nadrieril