Skip to content

Commit e6f85c2

Browse files
committed
Revert "Add assumptions that the pointer is non-null"
This reverts commit 9bbfd68.
1 parent ee253c9 commit e6f85c2

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed

src/liballoc/rc.rs

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -779,26 +779,12 @@ trait RcBoxPtr<T> {
779779

780780
impl<T> RcBoxPtr<T> for Rc<T> {
781781
#[inline(always)]
782-
fn inner(&self) -> &RcBox<T> {
783-
unsafe {
784-
// Safe to assume this here, as if it weren't true, we'd be breaking
785-
// the contract anyway
786-
assume(!self._ptr.is_null());
787-
&(**self._ptr)
788-
}
789-
}
782+
fn inner(&self) -> &RcBox<T> { unsafe { &(**self._ptr) } }
790783
}
791784

792785
impl<T> RcBoxPtr<T> for Weak<T> {
793786
#[inline(always)]
794-
fn inner(&self) -> &RcBox<T> {
795-
unsafe {
796-
// Safe to assume this here, as if it weren't true, we'd be breaking
797-
// the contract anyway
798-
assume(!self._ptr.is_null());
799-
&(**self._ptr)
800-
}
801-
}
787+
fn inner(&self) -> &RcBox<T> { unsafe { &(**self._ptr) } }
802788
}
803789

804790
#[cfg(test)]

0 commit comments

Comments
 (0)