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
Currently, mem::size_of_val and friends only support sized types, and just defer to mem::size_of etc.. Ideally, they would also support dynamically-sized types, in a way such that size_of_val(&[1, 2, 3]: &[int]) == size_of::<int>() * 3. Because this requires an actual value, they wouldn’t be able to simply defer to calling size_of etc. and would instead have to become intrinsic functions. I believe that this issue makes implementing pointer types that accept dynamically-sized type parameters very difficult (if not impossible) (e.g., #18248 (although I think that also might require a way of running destructors for unsized values)).
The text was updated successfully, but these errors were encountered:
Currently,
mem::size_of_val
and friends only support sized types, and just defer tomem::size_of
etc.. Ideally, they would also support dynamically-sized types, in a way such thatsize_of_val(&[1, 2, 3]: &[int]) == size_of::<int>() * 3
. Because this requires an actual value, they wouldn’t be able to simply defer to callingsize_of
etc. and would instead have to become intrinsic functions. I believe that this issue makes implementing pointer types that accept dynamically-sized type parameters very difficult (if not impossible) (e.g., #18248 (although I think that also might require a way of running destructors for unsized values)).The text was updated successfully, but these errors were encountered: