Skip to content

Commit 3eee486

Browse files
committed
impl DerefMut for Cell<[T]>
1 parent b1344ab commit 3eee486

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/libcore/cell.rs

+10
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,16 @@ impl<T> Deref for Cell<[T]> {
559559
}
560560
}
561561

562+
#[unstable(feature = "as_cell", issue="43038")]
563+
impl<T> DerefMut for Cell<[T]> {
564+
#[inline]
565+
fn deref_mut(&mut self) -> &mut [Cell<T>] {
566+
unsafe {
567+
&mut *(self as *mut Cell<[T]> as *mut [Cell<T>])
568+
}
569+
}
570+
}
571+
562572
/// A mutable memory location with dynamically checked borrow rules
563573
///
564574
/// See the [module-level documentation](index.html) for more.

0 commit comments

Comments
 (0)