From 3eee486e270347f39e41f4429cdb253b40219b89 Mon Sep 17 00:00:00 2001 From: F001 Date: Thu, 7 Jun 2018 17:47:55 +0800 Subject: [PATCH] impl DerefMut for Cell<[T]> --- src/libcore/cell.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs index a85eee854509..7e2ece0f02c1 100644 --- a/src/libcore/cell.rs +++ b/src/libcore/cell.rs @@ -559,6 +559,16 @@ impl Deref for Cell<[T]> { } } +#[unstable(feature = "as_cell", issue="43038")] +impl DerefMut for Cell<[T]> { + #[inline] + fn deref_mut(&mut self) -> &mut [Cell] { + unsafe { + &mut *(self as *mut Cell<[T]> as *mut [Cell]) + } + } +} + /// A mutable memory location with dynamically checked borrow rules /// /// See the [module-level documentation](index.html) for more.