about summary refs log tree commit diff
path: root/src/libstd/sync/rwlock.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-04-15 20:26:19 -0700
committerbors <bors@rust-lang.org>2016-04-15 20:26:19 -0700
commit6fa61b810dc95ca3e8bbda1681229f855f214fc4 (patch)
treeb8adce9739d902adb0c0a62ed9f2918cae502412 /src/libstd/sync/rwlock.rs
parentfef6c64a8020c357dda902593f1065864564c079 (diff)
parent3df35a01e9825bbdebb986f980095e468357975f (diff)
Auto merge of #32785 - tbu-:pr_more_defaults, r=alexcrichton
Implement `Default` for more types in the standard library

Also add `Hash` to `std::cmp::Ordering` and most possible traits to
`fmt::Error`.
Diffstat (limited to 'src/libstd/sync/rwlock.rs')
-rw-r--r--src/libstd/sync/rwlock.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/libstd/sync/rwlock.rs b/src/libstd/sync/rwlock.rs
index a37c1c16a45..09b1b0a939d 100644
--- a/src/libstd/sync/rwlock.rs
+++ b/src/libstd/sync/rwlock.rs
@@ -346,6 +346,13 @@ impl<T: ?Sized + fmt::Debug> fmt::Debug for RwLock<T> {
     }
 }
 
+#[stable(feature = "rw_lock_default", since = "1.9.0")]
+impl<T: Default> Default for RwLock<T> {
+    fn default() -> RwLock<T> {
+        RwLock::new(Default::default())
+    }
+}
+
 struct Dummy(UnsafeCell<()>);
 unsafe impl Sync for Dummy {}
 static DUMMY: Dummy = Dummy(UnsafeCell::new(()));