Skip to content

Commit 5cfac94

Browse files
author
Jorge Aparicio
committed
Deprecate Equiv
1 parent 09707d7 commit 5cfac94

File tree

10 files changed

+20
-5
lines changed

10 files changed

+20
-5
lines changed

src/libcollections/str.rs

+1
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,7 @@ impl<'a> Ord for MaybeOwned<'a> {
563563
}
564564
}
565565

566+
#[allow(deprecated)]
566567
#[deprecated = "use std::str::CowString"]
567568
impl<'a, S: Str> Equiv<S> for MaybeOwned<'a> {
568569
#[inline]

src/libcollections/string.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,8 @@ impl<H: hash::Writer> hash::Hash<H> for String {
822822
}
823823
}
824824

825-
#[experimental = "waiting on Equiv stabilization"]
825+
#[allow(deprecated)]
826+
#[deprecated = "Use overloaded `core::cmp::PartialEq`"]
826827
impl<'a, S: Str> Equiv<S> for String {
827828
#[inline]
828829
fn equiv(&self, other: &S) -> bool {

src/libcollections/vec.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,8 @@ impl<T: PartialOrd> PartialOrd for Vec<T> {
609609
#[unstable = "waiting on Eq stability"]
610610
impl<T: Eq> Eq for Vec<T> {}
611611

612-
#[experimental]
612+
#[allow(deprecated)]
613+
#[deprecated = "Use overloaded `core::cmp::PartialEq`"]
613614
impl<T: PartialEq, Sized? V: AsSlice<T>> Equiv<V> for Vec<T> {
614615
#[inline]
615616
fn equiv(&self, other: &V) -> bool { self.as_slice() == other.as_slice() }

src/libcore/cmp.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ pub trait PartialOrd<Sized? Rhs = Self> for Sized?: PartialEq<Rhs> {
240240
/// of different types. The most common use case for this relation is
241241
/// container types; e.g. it is often desirable to be able to use `&str`
242242
/// values to look up entries in a container with `String` keys.
243-
#[experimental = "Better solutions may be discovered."]
243+
#[deprecated = "Use overloaded core::cmp::PartialEq"]
244244
pub trait Equiv<Sized? T> for Sized? {
245245
/// Implement this function to decide equivalent values.
246246
fn equiv(&self, other: &T) -> bool;

src/libcore/ptr.rs

+4
Original file line numberDiff line numberDiff line change
@@ -321,12 +321,16 @@ impl<T> PartialEq for *mut T {
321321
impl<T> Eq for *mut T {}
322322

323323
// Equivalence for pointers
324+
#[allow(deprecated)]
325+
#[deprecated = "Use overloaded `core::cmp::PartialEq`"]
324326
impl<T> Equiv<*mut T> for *const T {
325327
fn equiv(&self, other: &*mut T) -> bool {
326328
self.to_uint() == other.to_uint()
327329
}
328330
}
329331

332+
#[allow(deprecated)]
333+
#[deprecated = "Use overloaded `core::cmp::PartialEq`"]
330334
impl<T> Equiv<*const T> for *mut T {
331335
fn equiv(&self, other: &*const T) -> bool {
332336
self.to_uint() == other.to_uint()

src/libcore/slice.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -1816,13 +1816,15 @@ impl<A, B> PartialEq<[B]> for [A] where A: PartialEq<B> {
18161816
#[unstable = "waiting for DST"]
18171817
impl<T: Eq> Eq for [T] {}
18181818

1819-
#[unstable = "waiting for DST"]
1819+
#[allow(deprecated)]
1820+
#[deprecated = "Use overloaded `core::cmp::PartialEq`"]
18201821
impl<T: PartialEq, Sized? V: AsSlice<T>> Equiv<V> for [T] {
18211822
#[inline]
18221823
fn equiv(&self, other: &V) -> bool { self.as_slice() == other.as_slice() }
18231824
}
18241825

1825-
#[unstable = "waiting for DST"]
1826+
#[allow(deprecated)]
1827+
#[deprecated = "Use overloaded `core::cmp::PartialEq`"]
18261828
impl<'a,T:PartialEq, Sized? V: AsSlice<T>> Equiv<V> for &'a mut [T] {
18271829
#[inline]
18281830
fn equiv(&self, other: &V) -> bool { self.as_slice() == other.as_slice() }

src/libcore/str.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1248,6 +1248,8 @@ pub mod traits {
12481248
}
12491249
}
12501250

1251+
#[allow(deprecated)]
1252+
#[deprecated = "Use overloaded `core::cmp::PartialEq`"]
12511253
impl<S: Str> Equiv<S> for str {
12521254
#[inline]
12531255
fn equiv(&self, other: &S) -> bool { eq_slice(self, other.as_slice()) }

src/libgraphviz/maybe_owned_vec.rs

+1
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ impl<'a, T: Ord> Ord for MaybeOwnedVector<'a, T> {
9696
}
9797
}
9898

99+
#[allow(deprecated)]
99100
impl<'a, T: PartialEq, Sized? V: AsSlice<T>> Equiv<V> for MaybeOwnedVector<'a, T> {
100101
fn equiv(&self, other: &V) -> bool {
101102
self.as_slice() == other.as_slice()

src/libstd/collections/hash/map.rs

+2
Original file line numberDiff line numberDiff line change
@@ -425,12 +425,14 @@ impl<K: Eq + Hash<S>, V, S, H: Hasher<S>> HashMap<K, V, H> {
425425
table::make_hash(&self.hasher, x)
426426
}
427427

428+
#[allow(deprecated)]
428429
fn search_equiv<'a, Sized? Q: Hash<S> + Equiv<K>>(&'a self, q: &Q)
429430
-> Option<FullBucketImm<'a, K, V>> {
430431
let hash = self.make_hash(q);
431432
search_hashed(&self.table, &hash, |k| q.equiv(k)).into_option()
432433
}
433434

435+
#[allow(deprecated)]
434436
fn search_equiv_mut<'a, Sized? Q: Hash<S> + Equiv<K>>(&'a mut self, q: &Q)
435437
-> Option<FullBucketMut<'a, K, V>> {
436438
let hash = self.make_hash(q);

src/libsyntax/parse/token.rs

+1
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,7 @@ impl fmt::Show for InternedString {
623623
}
624624
}
625625

626+
#[allow(deprecated)]
626627
impl<'a> Equiv<&'a str> for InternedString {
627628
fn equiv(&self, other: & &'a str) -> bool {
628629
(*other) == self.string.as_slice()

0 commit comments

Comments
 (0)