about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorCAD97 <cad97@cad97.com>2020-07-01 16:01:34 -0400
committerCAD97 <cad97@cad97.com>2020-07-01 16:02:34 -0400
commit7498cad0d8dacd51f0d18bdf985c15efe55b4e8a (patch)
tree382d621701670803051ab82156855482b9726674 /src/liballoc
parent98789ac75a15c78462ada2438881c8a4e4fda94a (diff)
downloadrust-7498cad0d8dacd51f0d18bdf985c15efe55b4e8a.tar.gz
rust-7498cad0d8dacd51f0d18bdf985c15efe55b4e8a.zip
Reclarify safety comments in Weak::as_ptr
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/rc.rs6
-rw-r--r--src/liballoc/sync.rs6
2 files changed, 6 insertions, 6 deletions
diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs
index 4d77779b209..835df66d55c 100644
--- a/src/liballoc/rc.rs
+++ b/src/liballoc/rc.rs
@@ -1705,9 +1705,9 @@ impl<T> Weak<T> {
         let ptr: *mut RcBox<T> = NonNull::as_ptr(self.ptr);
 
         // SAFETY: we must offset the pointer manually, and said pointer may be
-        // a dangling weak (usize::MAX). data_offset is safe to call, because we
-        // know a pointer to unsized T must be derived from a real unsized T,
-        // because dangling weaks are only created for sized T. wrapping_offset
+        // a dangling weak (usize::MAX) if T is sized. data_offset is safe to call,
+        // because we know that a pointer to unsized T was derived from a real
+        // unsized T, as dangling weaks are only created for sized T. wrapping_offset
         // is used so that we can use the same code path for the non-dangling
         // unsized case and the potentially dangling sized case.
         unsafe {
diff --git a/src/liballoc/sync.rs b/src/liballoc/sync.rs
index 160abe7210c..875bec5b203 100644
--- a/src/liballoc/sync.rs
+++ b/src/liballoc/sync.rs
@@ -1473,9 +1473,9 @@ impl<T> Weak<T> {
         let ptr: *mut ArcInner<T> = NonNull::as_ptr(self.ptr);
 
         // SAFETY: we must offset the pointer manually, and said pointer may be
-        // a dangling weak (usize::MAX). data_offset is safe to call, because we
-        // know a pointer to unsized T must be derived from a real unsized T,
-        // because dangling weaks are only created for sized T. wrapping_offset
+        // a dangling weak (usize::MAX) if T is sized. data_offset is safe to call,
+        // because we know that a pointer to unsized T was derived from a real
+        // unsized T, as dangling weaks are only created for sized T. wrapping_offset
         // is used so that we can use the same code path for the non-dangling
         // unsized case and the potentially dangling sized case.
         unsafe {