diff options
| author | Sean McArthur <sean.monstar@gmail.com> | 2016-05-26 11:23:42 -0700 |
|---|---|---|
| committer | Sean McArthur <sean.monstar@gmail.com> | 2016-05-26 11:23:42 -0700 |
| commit | 6af17e69ff5a69892aff4d82b293de2ec7f5050a (patch) | |
| tree | 266e389dd17e7888058865577076479b2465f514 /src/libcore | |
| parent | 3c795e08d6f4a532f12f3f8e1837db5e0647f8b0 (diff) | |
| download | rust-6af17e69ff5a69892aff4d82b293de2ec7f5050a.tar.gz rust-6af17e69ff5a69892aff4d82b293de2ec7f5050a.zip | |
core: check pointer equality when comparing byte slices
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/slice.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/libcore/slice.rs b/src/libcore/slice.rs index a0e978f783d..299444e756a 100644 --- a/src/libcore/slice.rs +++ b/src/libcore/slice.rs @@ -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, |
