-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cell type that uses address of cell owner as key #14
Comments
You can get dangling references: |
Yes, ZSTs were in the back of my mind -- that's a good point. In any case I was thinking of making the owner contain a |
Is this still relevant? Looks like we have #25 now. |
Yes, you're right. Thanks! I will close this as it is already implemented |
Since Rust guarantees no dangling references or use-after-free in safe code, it should be possible to use the address of the cell-owner as the key to access the cells, storing the address as the key in the cell.
If the owner is moved, then it loses access to the cells (which would typically be a bug in the user's code). Also if the owner is dropped and another owner created in the same memory, it will gain access to all the cells previously owned by the old owner. But this doesn't cause soundness problems, because there is still just one owner at any one time. Also access to a cell requires both a pointer to the cell and also the owner's key. So it really doesn't cause any issues that some other code might get logical ownership as it can't get access unless it also has pointers to the cells.
The text was updated successfully, but these errors were encountered: