about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorTomasz Miąsko <tomasz.miasko@gmail.com>2020-05-14 00:00:00 +0000
committerTomasz Miąsko <tomasz.miasko@gmail.com>2020-05-14 00:56:49 +0200
commitdab3a5813e2590b2161d84a410e4d5bdc072152d (patch)
tree28fe836306eaf9db64e1cf94b5198c16ff76a715 /src/liballoc
parent75e1463c52aaea25bd32ed53c73797357e561cce (diff)
downloadrust-dab3a5813e2590b2161d84a410e4d5bdc072152d.tar.gz
rust-dab3a5813e2590b2161d84a410e4d5bdc072152d.zip
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]