Skip to content

Commit e7d4ea3

Browse files
committed
---
yaml --- r: 182507 b: refs/heads/beta c: 9bbfd68 h: refs/heads/master i: 182505: f7fbcf1 182503: 1217ae7 v: v3
1 parent a676228 commit e7d4ea3

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ refs/heads/automation-fail: 1bf06495443584539b958873e04cc2f864ab10e4
3131
refs/heads/issue-18208-method-dispatch-3-quick-reject: 2009f85b9f99dedcec4404418eda9ddba90258a2
3232
refs/heads/batch: b7fd822592a4fb577552d93010c4a4e14f314346
3333
refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
34-
refs/heads/beta: a729a404945de10f99e2530a5c28952996532b29
34+
refs/heads/beta: 9bbfd681c9fa47f462a89e8f5eedd3fa2a5de2e7
3535
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3636
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
3737
refs/heads/tmp: eb836bf767aa1d8d4cba488a9091cde3c0ab4b2f

branches/beta/src/liballoc/rc.rs

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

934934
impl<T> RcBoxPtr<T> for Rc<T> {
935935
#[inline(always)]
936-
fn inner(&self) -> &RcBox<T> { unsafe { &(**self._ptr) } }
936+
fn inner(&self) -> &RcBox<T> {
937+
unsafe {
938+
// Safe to assume this here, as if it weren't true, we'd be breaking
939+
// the contract anyway
940+
assume(!self._ptr.is_null());
941+
&(**self._ptr)
942+
}
943+
}
937944
}
938945

939946
impl<T> RcBoxPtr<T> for Weak<T> {
940947
#[inline(always)]
941-
fn inner(&self) -> &RcBox<T> { unsafe { &(**self._ptr) } }
948+
fn inner(&self) -> &RcBox<T> {
949+
unsafe {
950+
// Safe to assume this here, as if it weren't true, we'd be breaking
951+
// the contract anyway
952+
assume(!self._ptr.is_null());
953+
&(**self._ptr)
954+
}
955+
}
942956
}
943957

944958
#[cfg(test)]

0 commit comments

Comments
 (0)