-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Open
Labels
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsT-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.T-opsemRelevant to the opsem teamRelevant to the opsem team
Description
Location (URL)
https://doc.rust-lang.org/std/cell/struct.Cell.html#method.as_ptr
Summary
Cell<T>::as_ptr allows you to obtain a pointer to T. This pointer can in theory be used to modify the contents of the cell, but is this sound? If I use ptr::write to write to the value, is that sound? Similarly, if I cast the pointer to &mut T and use that to modify the contents, is that sound (assuming I don't use set or get on the original cell while the mutable reference exists)?
I think answers to these questions should be present in the documentation of Cell<T>::as_ptr, otherwise it is unclear what the returned pointer allows.
Metadata
Metadata
Assignees
Labels
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsT-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.T-opsemRelevant to the opsem teamRelevant to the opsem team