]> git.lizzy.rs Git - rust.git/commitdiff
Revert "Add more explanation for why the assumes are there"
authorAlex Crichton <alex@alexcrichton.com>
Wed, 21 Jan 2015 21:55:04 +0000 (13:55 -0800)
committerAlex Crichton <alex@alexcrichton.com>
Wed, 21 Jan 2015 21:55:04 +0000 (13:55 -0800)
This reverts commit a7525bc4c8eb8507a5c248d29286e77133217cf3.

src/liballoc/rc.rs

index f5a5025c665d83961493f5bb18039534220111ee..65f5ed06254c1eda84295104ab1bb794312f760a 100644 (file)
@@ -755,8 +755,6 @@ fn strong(&self) -> uint { self.inner().strong.get() }
     fn inc_strong(&self) {
         let strong = self.strong();
         // The reference count is always at least one unless we're about to drop the type
-        // This allows the bulk of the destructor to be omitted in cases where we know that
-        // the reference count must be > 0.
         unsafe { assume(strong > 0); }
         self.inner().strong.set(strong + 1);
     }
@@ -765,8 +763,6 @@ fn inc_strong(&self) {
     fn dec_strong(&self) {
         let strong = self.strong();
         // The reference count is always at least one unless we're about to drop the type
-        // This allows the bulk of the destructor to be omitted in cases where we know that
-        // the reference count must be > 0
         unsafe { assume(strong > 0); }
         self.inner().strong.set(strong - 1);
     }
@@ -786,9 +782,7 @@ impl<T> RcBoxPtr<T> for Rc<T> {
     fn inner(&self) -> &RcBox<T> {
         unsafe {
             // Safe to assume this here, as if it weren't true, we'd be breaking
-            // the contract anyway.
-            // This allows the null check to be elided in the destructor if we
-            // manipulated the reference count in the same function.
+            // the contract anyway
             assume(!self._ptr.is_null());
             &(**self._ptr)
         }
@@ -801,8 +795,6 @@ fn inner(&self) -> &RcBox<T> {
         unsafe {
             // Safe to assume this here, as if it weren't true, we'd be breaking
             // the contract anyway
-            // This allows the null check to be elided in the destructor if we
-            // manipulated the reference count in the same function.
             assume(!self._ptr.is_null());
             &(**self._ptr)
         }