Skip to content

Commit

Permalink
Revert "Use assume to inform the optimiser about refcount invariants"
Browse files Browse the repository at this point in the history
This reverts commit a729a40.
  • Loading branch information
alexcrichton committed Jan 21, 2015
1 parent e6f85c2 commit 91cec5b
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions src/liballoc/rc.rs
Expand Up @@ -160,7 +160,6 @@ use core::option::Option::{Some, None};
use core::ptr::{self, PtrExt};
use core::result::Result;
use core::result::Result::{Ok, Err};
use core::intrinsics::assume;

use heap::deallocate;

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

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

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

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

0 comments on commit 91cec5b

Please sign in to comment.