core: check pointer equality when comparing byte slices

This commit is contained in:
Sean McArthur 2016-05-26 11:23:42 -07:00
parent 3c795e08d6
commit 6af17e69ff

View File

@ -1831,6 +1831,9 @@ impl<A> SlicePartialEq<A> for [A]
if self.len() != other.len() {
return false;
}
if self.as_ptr() == other.as_ptr() {
return true;
}
unsafe {
let size = mem::size_of_val(self);
memcmp(self.as_ptr() as *const u8,