Skip to content

Commit ee253c9

Browse files
committed
Revert "Add more explanation for why the assumes are there"
This reverts commit a7525bc.
1 parent ecbee2e commit ee253c9

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

src/liballoc/rc.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -755,8 +755,6 @@ trait RcBoxPtr<T> {
755755
fn inc_strong(&self) {
756756
let strong = self.strong();
757757
// The reference count is always at least one unless we're about to drop the type
758-
// This allows the bulk of the destructor to be omitted in cases where we know that
759-
// the reference count must be > 0.
760758
unsafe { assume(strong > 0); }
761759
self.inner().strong.set(strong + 1);
762760
}
@@ -765,8 +763,6 @@ trait RcBoxPtr<T> {
765763
fn dec_strong(&self) {
766764
let strong = self.strong();
767765
// The reference count is always at least one unless we're about to drop the type
768-
// This allows the bulk of the destructor to be omitted in cases where we know that
769-
// the reference count must be > 0
770766
unsafe { assume(strong > 0); }
771767
self.inner().strong.set(strong - 1);
772768
}
@@ -786,9 +782,7 @@ impl<T> RcBoxPtr<T> for Rc<T> {
786782
fn inner(&self) -> &RcBox<T> {
787783
unsafe {
788784
// Safe to assume this here, as if it weren't true, we'd be breaking
789-
// the contract anyway.
790-
// This allows the null check to be elided in the destructor if we
791-
// manipulated the reference count in the same function.
785+
// the contract anyway
792786
assume(!self._ptr.is_null());
793787
&(**self._ptr)
794788
}
@@ -801,8 +795,6 @@ impl<T> RcBoxPtr<T> for Weak<T> {
801795
unsafe {
802796
// Safe to assume this here, as if it weren't true, we'd be breaking
803797
// the contract anyway
804-
// This allows the null check to be elided in the destructor if we
805-
// manipulated the reference count in the same function.
806798
assume(!self._ptr.is_null());
807799
&(**self._ptr)
808800
}

0 commit comments

Comments
 (0)