From 88ce82554d0b56a3678a4bb784161b37a43a83fe Mon Sep 17 00:00:00 2001 From: inquisitivecrystal <22333129+inquisitivecrystal@users.noreply.github.com> Date: Tue, 20 Jul 2021 16:43:34 -0700 Subject: [PATCH] Implement `PartialOrd<&B>` for `&mut A` --- library/core/src/cmp.rs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/library/core/src/cmp.rs b/library/core/src/cmp.rs index 79610bb409d37..6642264956a24 100644 --- a/library/core/src/cmp.rs +++ b/library/core/src/cmp.rs @@ -1478,6 +1478,32 @@ mod impls { PartialOrd::ge(*self, *other) } } + #[stable(feature = "partial_ord_mut_ref", since = "1.55.0")] + impl PartialOrd<&B> for &mut A + where + A: PartialOrd, + { + #[inline] + fn partial_cmp(&self, other: &&B) -> Option { + PartialOrd::partial_cmp(*self, *other) + } + #[inline] + fn lt(&self, other: &&B) -> bool { + PartialOrd::lt(*self, *other) + } + #[inline] + fn le(&self, other: &&B) -> bool { + PartialOrd::le(*self, *other) + } + #[inline] + fn ge(&self, other: &&B) -> bool { + PartialOrd::ge(*self, *other) + } + #[inline] + fn gt(&self, other: &&B) -> bool { + PartialOrd::gt(*self, *other) + } + } #[stable(feature = "rust1", since = "1.0.0")] impl Ord for &mut A where