Skip to content

Commit

Permalink
core: check pointer equality when comparing byte slices
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmonstar committed May 26, 2016
1 parent 3c795e0 commit 6af17e6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/libcore/slice.rs
Expand Up @@ -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,
Expand Down

0 comments on commit 6af17e6

Please sign in to comment.