Skip to content

Commit 1f01b42

Browse files
committed
---
yaml --- r: 174775 b: refs/heads/snap-stage3 c: a7525bc h: refs/heads/master i: 174773: f050381 174771: 93bd3ac 174767: 80abcb5 v: v3
1 parent 22913a1 commit 1f01b42

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: a0f86de49748b472d4d189d9688b0d856c000914
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 9bbfd681c9fa47f462a89e8f5eedd3fa2a5de2e7
4+
refs/heads/snap-stage3: a7525bc4c8eb8507a5c248d29286e77133217cf3
55
refs/heads/try: 08f6380a9f0b866796080094f44fe25ea5636547
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d

branches/snap-stage3/src/liballoc/rc.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -909,6 +909,8 @@ trait RcBoxPtr<T> {
909909
fn inc_strong(&self) {
910910
let strong = self.strong();
911911
// The reference count is always at least one unless we're about to drop the type
912+
// This allows the bulk of the destructor to be omitted in cases where we know that
913+
// the reference count must be > 0.
912914
unsafe { assume(strong > 0); }
913915
self.inner().strong.set(strong + 1);
914916
}
@@ -917,6 +919,8 @@ trait RcBoxPtr<T> {
917919
fn dec_strong(&self) {
918920
let strong = self.strong();
919921
// The reference count is always at least one unless we're about to drop the type
922+
// This allows the bulk of the destructor to be omitted in cases where we know that
923+
// the reference count must be > 0
920924
unsafe { assume(strong > 0); }
921925
self.inner().strong.set(strong - 1);
922926
}
@@ -936,7 +940,9 @@ impl<T> RcBoxPtr<T> for Rc<T> {
936940
fn inner(&self) -> &RcBox<T> {
937941
unsafe {
938942
// Safe to assume this here, as if it weren't true, we'd be breaking
939-
// the contract anyway
943+
// the contract anyway.
944+
// This allows the null check to be elided in the destructor if we
945+
// manipulated the reference count in the same function.
940946
assume(!self._ptr.is_null());
941947
&(**self._ptr)
942948
}
@@ -949,6 +955,8 @@ impl<T> RcBoxPtr<T> for Weak<T> {
949955
unsafe {
950956
// Safe to assume this here, as if it weren't true, we'd be breaking
951957
// the contract anyway
958+
// This allows the null check to be elided in the destructor if we
959+
// manipulated the reference count in the same function.
952960
assume(!self._ptr.is_null());
953961
&(**self._ptr)
954962
}

0 commit comments

Comments
 (0)