You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pwbh
changed the title
Vec implementation throws UB when dropping vec with ZSTs
Vec implementation throws UB when dropping RawVec holding ZSTs
Oct 9, 2023
In the following page there is something missing to handle ZSTs which leads to a UB
nomicon/src/vec/vec-zsts.md
Line 1 in ddfa421
When Vec is dropped filled with ZSTs, I am getting the following error
and indeed we never allocate anything for ZSTs, just pointing to some dangling pointer that represent our ZST.
I suggest a tweak to our Drop trait in
raw_vec
to handle this case where we deallocate only for T when size of T > 0:Please see PR for fix #425
The text was updated successfully, but these errors were encountered: