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
There needs to be a way to initialize values, probably just calling ptr::write.
The text was updated successfully, but these errors were encountered:
quadrupleslap
changed the title
Unsound drop of uninitialised variable in set_ivar.
Unsound drop of uninitialised variable in Drop::set_ivar.
Jan 30, 2018
quadrupleslap
changed the title
Unsound drop of uninitialised variable in Drop::set_ivar.
Unsound drop of uninitialised variable in Object::set_ivar.
Jan 30, 2018
I never considered that someone might keep types that implement Drop in ivars! @quadrupleslap can you tell me more about your use case? I'm not sure how you'd plan to drop them (implement dealloc?) and what new APIs that would require.
The easy way to fix the unsoundness would be just adding a : Copy bound, but if you want to store Drop types that still doesn't help you 😛
I was trying to set some boxed values, but it's fine - it's not essential. Adding a Copy requirement sounds like a good idea, but I'm not sure if it's better than just adding Object::init_ivar, and adding a notice to the other *_ivar methods that the value might be uninitialized and that the user should call init_ivar first. The problem with that is that it doesn't automatically free the values, which is technically sound, but not very nice.
There needs to be a way to initialize values, probably just calling
ptr::write
.The text was updated successfully, but these errors were encountered: