diff --git a/src/libcore/slice.rs b/src/libcore/slice.rs
index a0e978f783d73..299444e756a76 100644
--- a/src/libcore/slice.rs
+++ b/src/libcore/slice.rs
@@ -1831,6 +1831,9 @@ impl SlicePartialEq 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,