We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d8899c5 commit b0ca5ffCopy full SHA for b0ca5ff
library/core/src/slice/cmp.rs
@@ -87,7 +87,8 @@ where
87
// SAFETY: `self` and `other` are references and are thus guaranteed to be valid.
88
// The two slices have been checked to have the same size above.
89
unsafe {
90
- let size = mem::size_of_val(self);
+ let size =
91
+ if self.as_ptr() == other.as_ptr().cast() { 0 } else { mem::size_of_val(self) };
92
memcmp(self.as_ptr() as *const u8, other.as_ptr() as *const u8, size) == 0
93
}
94
0 commit comments