From 6af17e69ff5a69892aff4d82b293de2ec7f5050a Mon Sep 17 00:00:00 2001 From: Sean McArthur Date: Thu, 26 May 2016 11:23:42 -0700 Subject: [PATCH] core: check pointer equality when comparing byte slices --- src/libcore/slice.rs | 3 +++ 1 file changed, 3 insertions(+) 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,