aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2017-10-10 20:24:48 -0500
committerGitHub <noreply@github.com>2017-10-10 20:24:48 -0500
commitb1c7a2fa6dd94bde092bc4d9baed456e7a8bf45b (patch)
treee25c2cc9d450341ede9377318f49528b062c076d
parent3c6e7b56c3469d29df8f6ff3332f50e447671d91 (diff)
parent9c738711bcc8d1a1da198b63acc1fca6eede9a0c (diff)
downloadservo-b1c7a2fa6dd94bde092bc4d9baed456e7a8bf45b.tar.gz
servo-b1c7a2fa6dd94bde092bc4d9baed456e7a8bf45b.zip
Auto merge of #18793 - heycam:ptr-eq, r=emilio
servo_arc: Try pointer equality test first when comparing two Arcs. This doesn't actually help https://bugzilla.mozilla.org/show_bug.cgi?id=1405411 but seems like something we should do. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18793) <!-- Reviewable:end -->
-rw-r--r--components/servo_arc/lib.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/components/servo_arc/lib.rs b/components/servo_arc/lib.rs
index 49a04dea1fc..7d17c26cd51 100644
--- a/components/servo_arc/lib.rs
+++ b/components/servo_arc/lib.rs
@@ -389,11 +389,11 @@ impl<T: ?Sized> Drop for Arc<T> {
impl<T: ?Sized + PartialEq> PartialEq for Arc<T> {
fn eq(&self, other: &Arc<T>) -> bool {
- *(*self) == *(*other)
+ Self::ptr_eq(self, other) || *(*self) == *(*other)
}
fn ne(&self, other: &Arc<T>) -> bool {
- *(*self) != *(*other)
+ !Self::ptr_eq(self, other) && *(*self) != *(*other)
}
}
impl<T: ?Sized + PartialOrd> PartialOrd for Arc<T> {