-
Notifications
You must be signed in to change notification settings - Fork 61
What about: use-after-move and (maybe) use-after-drop #188
Copy link
Copy link
Open
Labels
A-memoryTopic: Related to memory accessesTopic: Related to memory accessesA-uninitializedTopic: Related to uninitialized memoryTopic: Related to uninitialized memoryC-open-questionCategory: An open question that we should revisitCategory: An open question that we should revisitS-pending-designStatus: Resolving this issue requires addressing some open design questionsStatus: Resolving this issue requires addressing some open design questions
Metadata
Metadata
Assignees
Labels
A-memoryTopic: Related to memory accessesTopic: Related to memory accessesA-uninitializedTopic: Related to uninitialized memoryTopic: Related to uninitialized memoryC-open-questionCategory: An open question that we should revisitCategory: An open question that we should revisitS-pending-designStatus: Resolving this issue requires addressing some open design questionsStatus: Resolving this issue requires addressing some open design questions
Type
Fields
Give feedbackNo fields configured for issues without a type.
Miri currently considers
CopyandMovethe same operation. There are some proposals in particular by @eddyb to make them not the same: it might be beneficial for optimizations to be able to rely on the data not being read again after aMove. This would correspond to replacing the data byUndef. It seems reasonable to do similar things for drop -- though that requires a precise definition of what is actually considered a drop (does that include just theDropterminator or also calls todrop_in_place?).(Miri concern: One reason why I am a bit hesitant about this is that this makes read have a side-effect, so we'd have to make all read methods in Miri take the interpreter context by
&mut self. Reads already have a side-effect in Stacked Borrows but that is fairly local and we just use aRefCellthere.)@eddyb what would be such optimizations that benefit from this, where
StorageDeadis not happening so we need to rely onMove?Potential blockers that would prevent deinit-on-move:
Reasons to do deinit-on-move:
Testcases: