Skip to content

Commit 1b5ac57

Browse files
committed
Note Weak.ptr never dangles sooner
1 parent 7498cad commit 1b5ac57

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

src/liballoc/rc.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1641,6 +1641,7 @@ pub struct Weak<T: ?Sized> {
16411641
// `Weak::new` sets this to `usize::MAX` so that it doesn’t need
16421642
// to allocate space on the heap. That's not a value a real pointer
16431643
// will ever have because RcBox has alignment at least 2.
1644+
// This is only possible when `T: Sized`; unsized `T` never dangle.
16441645
ptr: NonNull<RcBox<T>>,
16451646
}
16461647

src/liballoc/sync.rs

+1
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ pub struct Weak<T: ?Sized> {
267267
// `Weak::new` sets this to `usize::MAX` so that it doesn’t need
268268
// to allocate space on the heap. That's not a value a real pointer
269269
// will ever have because RcBox has alignment at least 2.
270+
// This is only possible when `T: Sized`; unsized `T` never dangle.
270271
ptr: NonNull<ArcInner<T>>,
271272
}
272273

0 commit comments

Comments
 (0)