diff options
| author | Ralf Jung <post@ralfj.de> | 2019-11-13 09:11:09 +0100 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2019-11-13 09:11:09 +0100 |
| commit | 5b5ae01340fdbb31f56453655472b783e5719eb9 (patch) | |
| tree | 8d934563db6bb4846feab3dfee1b735aa35f128c | |
| parent | 19ebe2fb6d7de19de155e70938fafcca6f9b5003 (diff) | |
| download | rust-5b5ae01340fdbb31f56453655472b783e5719eb9.tar.gz rust-5b5ae01340fdbb31f56453655472b783e5719eb9.zip | |
expand docs
| -rw-r--r-- | src/libcore/cell.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs index 4afeec66758..7b7be8f3d2f 100644 --- a/src/libcore/cell.rs +++ b/src/libcore/cell.rs @@ -1551,15 +1551,20 @@ impl<T: ?Sized> UnsafeCell<T> { } /// Gets a mutable pointer to the wrapped value. + /// The difference to [`get`] is that this function accepts a raw pointer, + /// which is useful to avoid the creation of temporary references. /// - /// This can be cast to a pointer of any kind. + /// The result can be cast to a pointer of any kind. /// Ensure that the access is unique (no active references, mutable or not) /// when casting to `&mut T`, and ensure that there are no mutations /// or mutable aliases going on when casting to `&T`. /// + /// [`get`]: #method.get + /// /// # Examples /// - /// Gradual initialization of an `UnsafeCell`: + /// Gradual initialization of an `UnsafeCell` requires `raw_get`, as + /// calling `get` would require creating a reference to uninitialized data: /// /// ``` /// #![feature(unsafe_cell_raw_get)] |
