diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-01-21 13:55:04 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-01-21 13:55:04 -0800 |
| commit | ee253c918d2fb961dbdf5c6dbe40dd7fee20148e (patch) | |
| tree | 54f2ad139b8cc2ba881f5001abd92079e34556ab /src/liballoc | |
| parent | ecbee2e56824161fcc0decd087055d13e0876058 (diff) | |
| download | rust-ee253c918d2fb961dbdf5c6dbe40dd7fee20148e.tar.gz rust-ee253c918d2fb961dbdf5c6dbe40dd7fee20148e.zip | |
Revert "Add more explanation for why the assumes are there"
This reverts commit a7525bc4c8eb8507a5c248d29286e77133217cf3.
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/rc.rs | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index f5a5025c665..65f5ed06254 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -755,8 +755,6 @@ trait RcBoxPtr<T> { 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 @@ trait RcBoxPtr<T> { 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 @@ impl<T> RcBoxPtr<T> for Weak<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) } |
