about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2020-05-14 10:23:06 +0200
committerGitHub <noreply@github.com>2020-05-14 10:23:06 +0200
commit56986bebc23788146dc46606d5af39b6354d6ad3 (patch)
tree982079b5be6d95cf61ebe5ec761f8521014b67ce /src/liballoc
parent864eae7c48bbddf8842269248354ebdf486c7884 (diff)
parentdab3a5813e2590b2161d84a410e4d5bdc072152d (diff)
Rollup merge of #72183 - tmiasko:decr-strong-count, r=Mark-Simulacrum
Fix Arc::decr_strong_count doc test
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/sync.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/liballoc/sync.rs b/src/liballoc/sync.rs
index 19d289c87fd..dbee9d27d8a 100644
--- a/src/liballoc/sync.rs
+++ b/src/liballoc/sync.rs
@@ -835,12 +835,14 @@ impl<T: ?Sized> Arc<T> {
     ///
     /// unsafe {
     ///     let ptr = Arc::into_raw(five);
-    ///     Arc::decr_strong_count(ptr);
+    ///     Arc::incr_strong_count(ptr);
     ///
-    ///     // This assertion is deterministic because we haven't shared
+    ///     // Those assertions are deterministic because we haven't shared
     ///     // the `Arc` between threads.
     ///     let five = Arc::from_raw(ptr);
-    ///     assert_eq!(0, Arc::strong_count(&five));
+    ///     assert_eq!(2, Arc::strong_count(&five));
+    ///     Arc::decr_strong_count(ptr);
+    ///     assert_eq!(1, Arc::strong_count(&five));
     /// }
     /// ```
     #[inline]