about summary refs log tree commit diff
path: root/src/liballoc/sync
diff options
context:
space:
mode:
authorBryan Donlan <bdonlan@amazon.com>2019-11-21 19:48:39 +0000
committerBryan Donlan <bdonlan@amazon.com>2019-11-21 19:48:39 +0000
commit0d0b283c2c5a4df891ca47b27f0851ef2549ac3b (patch)
tree6eb788268fba8d8a3c99ab56a29e8c0bbe8b8cd7 /src/liballoc/sync
parent91ee3d1c31e5d1684e0d2ec5036dc69993b6f992 (diff)
downloadrust-0d0b283c2c5a4df891ca47b27f0851ef2549ac3b.tar.gz
rust-0d0b283c2c5a4df891ca47b27f0851ef2549ac3b.zip
Make Weak::weak_count() return zero when no strong refs remain
Diffstat (limited to 'src/liballoc/sync')
-rw-r--r--src/liballoc/sync/tests.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/liballoc/sync/tests.rs b/src/liballoc/sync/tests.rs
index 9220f5e0333..be0200c9a46 100644
--- a/src/liballoc/sync/tests.rs
+++ b/src/liballoc/sync/tests.rs
@@ -62,28 +62,28 @@ fn test_arc_get_mut() {
 
 #[test]
 fn weak_counts() {
-    assert_eq!(Weak::weak_count(&Weak::<u64>::new()), None);
+    assert_eq!(Weak::weak_count(&Weak::<u64>::new()), 0);
     assert_eq!(Weak::strong_count(&Weak::<u64>::new()), 0);
 
     let a = Arc::new(0);
     let w = Arc::downgrade(&a);
     assert_eq!(Weak::strong_count(&w), 1);
-    assert_eq!(Weak::weak_count(&w), Some(1));
+    assert_eq!(Weak::weak_count(&w), 1);
     let w2 = w.clone();
     assert_eq!(Weak::strong_count(&w), 1);
-    assert_eq!(Weak::weak_count(&w), Some(2));
+    assert_eq!(Weak::weak_count(&w), 2);
     assert_eq!(Weak::strong_count(&w2), 1);
-    assert_eq!(Weak::weak_count(&w2), Some(2));
+    assert_eq!(Weak::weak_count(&w2), 2);
     drop(w);
     assert_eq!(Weak::strong_count(&w2), 1);
-    assert_eq!(Weak::weak_count(&w2), Some(1));
+    assert_eq!(Weak::weak_count(&w2), 1);
     let a2 = a.clone();
     assert_eq!(Weak::strong_count(&w2), 2);
-    assert_eq!(Weak::weak_count(&w2), Some(1));
+    assert_eq!(Weak::weak_count(&w2), 1);
     drop(a2);
     drop(a);
     assert_eq!(Weak::strong_count(&w2), 0);
-    assert_eq!(Weak::weak_count(&w2), Some(1));
+    assert_eq!(Weak::weak_count(&w2), 0);
     drop(w2);
 }