diff options
| author | F001 <changchun.fan@qq.com> | 2018-06-07 17:47:55 +0800 |
|---|---|---|
| committer | F001 <changchun.fan@qq.com> | 2018-07-17 11:34:19 +0800 |
| commit | 3eee486e270347f39e41f4429cdb253b40219b89 (patch) | |
| tree | 13f4a8ef2e203bc1cce6a79d07130cc21e7ed39f /src/libcore | |
| parent | b1344abc58f0bd2eb6a8c9e664f8318864f640fe (diff) | |
| download | rust-3eee486e270347f39e41f4429cdb253b40219b89.tar.gz rust-3eee486e270347f39e41f4429cdb253b40219b89.zip | |
impl DerefMut for Cell<[T]>
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/cell.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs index a85eee85450..7e2ece0f02c 100644 --- a/src/libcore/cell.rs +++ b/src/libcore/cell.rs @@ -559,6 +559,16 @@ impl<T> Deref for Cell<[T]> { } } +#[unstable(feature = "as_cell", issue="43038")] +impl<T> DerefMut for Cell<[T]> { + #[inline] + fn deref_mut(&mut self) -> &mut [Cell<T>] { + unsafe { + &mut *(self as *mut Cell<[T]> as *mut [Cell<T>]) + } + } +} + /// A mutable memory location with dynamically checked borrow rules /// /// See the [module-level documentation](index.html) for more. |
