about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/libcore/hash/mod.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libcore/hash/mod.rs b/src/libcore/hash/mod.rs
index 4f66b00b279..d80101753cb 100644
--- a/src/libcore/hash/mod.rs
+++ b/src/libcore/hash/mod.rs
@@ -695,6 +695,9 @@ mod impls {
                 // Fat pointer
                 // SAFETY: we are accessing the memory occupied by `self`
                 // which is guaranteed to be valid.
+                // This assumes a fat pointer can be represented by a `(usize, usize)`,
+                // which is safe to do in `std` because it is shipped and kept in sync
+                // with the implementation of fat pointers in `rustc`.
                 let (a, b) = unsafe { *(self as *const Self as *const (usize, usize)) };
                 state.write_usize(a);
                 state.write_usize(b);
@@ -712,6 +715,9 @@ mod impls {
                 // Fat pointer
                 // SAFETY: we are accessing the memory occupied by `self`
                 // which is guaranteed to be valid.
+                // This assumes a fat pointer can be represented by a `(usize, usize)`,
+                // which is safe to do in `std` because it is shipped and kept in sync
+                // with the implementation of fat pointers in `rustc`.
                 let (a, b) = unsafe { *(self as *const Self as *const (usize, usize)) };
                 state.write_usize(a);
                 state.write_usize(b);