Skip to content

Commit d0ecabd

Browse files
committed
---
yaml --- r: 175571 b: refs/heads/auto c: 9bbfd68 h: refs/heads/master i: 175569: 9e28dca 175567: 44d25b0 v: v3
1 parent f6dd01e commit d0ecabd

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
@@ -10,7 +10,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1010
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1111
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1212
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
13-
refs/heads/auto: a729a404945de10f99e2530a5c28952996532b29
13+
refs/heads/auto: 9bbfd681c9fa47f462a89e8f5eedd3fa2a5de2e7
1414
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1515
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1616
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/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)