Skip to content

Instantly share code, notes, and snippets.

@jamesmunns
Created October 19, 2018 15:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesmunns/446816f12ad5ef5b9ce3c3da2c32626e to your computer and use it in GitHub Desktop.
Save jamesmunns/446816f12ad5ef5b9ce3c3da2c32626e to your computer and use it in GitHub Desktop.
diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs
index ec7d366c3f..421b741a3a 100644
--- a/src/libcore/cell.rs
+++ b/src/libcore/cell.rs
@@ -1512,6 +1512,18 @@ impl<T: ?Sized> UnsafeCell<T> {
}
}
+// TODO: correct stable attribute
+#[stable(feature = "rust1", since = "1.0.0")]
+impl<T: Clone> Clone for UnsafeCell<T> {
+ fn clone(&self) -> UnsafeCell<T> {
+ UnsafeCell::new(self.value.clone())
+ }
+}
+
+// TODO: correct stable attribute
+#[stable(feature = "rust1", since = "1.0.0")]
+impl<T: Copy> Copy for UnsafeCell<T> {}
+
#[stable(feature = "unsafe_cell_default", since = "1.10.0")]
impl<T: Default> Default for UnsafeCell<T> {
/// Creates an `UnsafeCell`, with the `Default` value for T.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment