-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-DSTsArea: Dynamically-sized types (DSTs)Area: Dynamically-sized types (DSTs)
Description
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)).
Metadata
Metadata
Assignees
Labels
A-DSTsArea: Dynamically-sized types (DSTs)Area: Dynamically-sized types (DSTs)