Skip to content

Commit 91cec5b

Browse files
committed
Revert "Use assume to inform the optimiser about refcount invariants"
This reverts commit a729a40.
1 parent e6f85c2 commit 91cec5b

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

src/liballoc/rc.rs

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ use core::option::Option::{Some, None};
160160
use core::ptr::{self, PtrExt};
161161
use core::result::Result;
162162
use core::result::Result::{Ok, Err};
163-
use core::intrinsics::assume;
164163

165164
use heap::deallocate;
166165

@@ -752,20 +751,10 @@ trait RcBoxPtr<T> {
752751
fn strong(&self) -> uint { self.inner().strong.get() }
753752

754753
#[inline]
755-
fn inc_strong(&self) {
756-
let strong = self.strong();
757-
// The reference count is always at least one unless we're about to drop the type
758-
unsafe { assume(strong > 0); }
759-
self.inner().strong.set(strong + 1);
760-
}
754+
fn inc_strong(&self) { self.inner().strong.set(self.strong() + 1); }
761755

762756
#[inline]
763-
fn dec_strong(&self) {
764-
let strong = self.strong();
765-
// The reference count is always at least one unless we're about to drop the type
766-
unsafe { assume(strong > 0); }
767-
self.inner().strong.set(strong - 1);
768-
}
757+
fn dec_strong(&self) { self.inner().strong.set(self.strong() - 1); }
769758

770759
#[inline]
771760
fn weak(&self) -> uint { self.inner().weak.get() }

0 commit comments

Comments
 (0)