about summary refs log tree commit diff
path: root/src/libcollections
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-05-29 17:45:07 -0700
committerAlex Crichton <alex@alexcrichton.com>2014-05-30 15:52:24 -0700
commit748bc3ca49de8ab0b890726120c40567094e43fc (patch)
treea205dcd5582cbecbb1a02fa3ed1ebfdcc85ff881 /src/libcollections
parentf4fa7c8a07a96cc9d0aae0bfc6515fb747f25341 (diff)
downloadrust-748bc3ca49de8ab0b890726120c40567094e43fc.tar.gz
rust-748bc3ca49de8ab0b890726120c40567094e43fc.zip
std: Rename {Eq,Ord} to Partial{Eq,Ord}
This is part of the ongoing renaming of the equality traits. See #12517 for more
details. All code using Eq/Ord will temporarily need to move to Partial{Eq,Ord}
or the Total{Eq,Ord} traits. The Total traits will soon be renamed to {Eq,Ord}.

cc #12517

[breaking-change]
Diffstat (limited to 'src/libcollections')
-rw-r--r--src/libcollections/bitv.rs2
-rw-r--r--src/libcollections/btree.rs24
-rw-r--r--src/libcollections/dlist.rs4
-rw-r--r--src/libcollections/enum_set.rs4
-rw-r--r--src/libcollections/hashmap.rs18
-rw-r--r--src/libcollections/lru_cache.rs4
-rw-r--r--src/libcollections/ringbuf.rs12
-rw-r--r--src/libcollections/treemap.rs12
8 files changed, 40 insertions, 40 deletions
diff --git a/src/libcollections/bitv.rs b/src/libcollections/bitv.rs
index 54bc6989d7c..c91a5289faa 100644
--- a/src/libcollections/bitv.rs
+++ b/src/libcollections/bitv.rs
@@ -796,7 +796,7 @@ impl BitvSet {
     }
 }
 
-impl cmp::Eq for BitvSet {
+impl cmp::PartialEq for BitvSet {
     fn eq(&self, other: &BitvSet) -> bool {
         if self.size != other.size {
             return false;
diff --git a/src/libcollections/btree.rs b/src/libcollections/btree.rs
index 184a59303f3..e0bb8658c13 100644
--- a/src/libcollections/btree.rs
+++ b/src/libcollections/btree.rs
@@ -92,7 +92,7 @@ impl<K: Clone + TotalOrd, V: Clone> Clone for BTree<K, V> {
     }
 }
 
-impl<K: TotalOrd, V: TotalEq> Eq for BTree<K, V> {
+impl<K: TotalOrd, V: TotalEq> PartialEq for BTree<K, V> {
     fn eq(&self, other: &BTree<K, V>) -> bool {
         self.root.cmp(&other.root) == Equal
     }
@@ -100,7 +100,7 @@ impl<K: TotalOrd, V: TotalEq> Eq for BTree<K, V> {
 
 impl<K: TotalOrd, V: TotalEq> TotalEq for BTree<K, V> {}
 
-impl<K: TotalOrd, V: TotalEq> Ord for BTree<K, V> {
+impl<K: TotalOrd, V: TotalEq> PartialOrd for BTree<K, V> {
     fn lt(&self, other: &BTree<K, V>) -> bool {
         self.cmp(other) == Less
     }
@@ -198,7 +198,7 @@ impl<K: Clone + TotalOrd, V: Clone> Clone for Node<K, V> {
     }
 }
 
-impl<K: TotalOrd, V: TotalEq> Eq for Node<K, V> {
+impl<K: TotalOrd, V: TotalEq> PartialEq for Node<K, V> {
     fn eq(&self, other: &Node<K, V>) -> bool {
         match *self{
             BranchNode(ref branch) => {
@@ -222,7 +222,7 @@ impl<K: TotalOrd, V: TotalEq> Eq for Node<K, V> {
 
 impl<K: TotalOrd, V: TotalEq> TotalEq for Node<K, V> {}
 
-impl<K: TotalOrd, V: TotalEq> Ord for Node<K, V> {
+impl<K: TotalOrd, V: TotalEq> PartialOrd for Node<K, V> {
     fn lt(&self, other: &Node<K, V>) -> bool {
         self.cmp(other) == Less
     }
@@ -393,7 +393,7 @@ impl<K: Clone + TotalOrd, V: Clone> Clone for Leaf<K, V> {
     }
 }
 
-impl<K: TotalOrd, V: TotalEq> Eq for Leaf<K, V> {
+impl<K: TotalOrd, V: TotalEq> PartialEq for Leaf<K, V> {
     fn eq(&self, other: &Leaf<K, V>) -> bool {
         self.elts == other.elts
     }
@@ -401,7 +401,7 @@ impl<K: TotalOrd, V: TotalEq> Eq for Leaf<K, V> {
 
 impl<K: TotalOrd, V: TotalEq> TotalEq for Leaf<K, V> {}
 
-impl<K: TotalOrd, V: TotalEq> Ord for Leaf<K, V> {
+impl<K: TotalOrd, V: TotalEq> PartialOrd for Leaf<K, V> {
     fn lt(&self, other: &Leaf<K, V>) -> bool {
         self.cmp(other) == Less
     }
@@ -623,7 +623,7 @@ impl<K: Clone + TotalOrd, V: Clone> Clone for Branch<K, V> {
     }
 }
 
-impl<K: TotalOrd, V: TotalEq> Eq for Branch<K, V> {
+impl<K: TotalOrd, V: TotalEq> PartialEq for Branch<K, V> {
     fn eq(&self, other: &Branch<K, V>) -> bool {
         self.elts == other.elts
     }
@@ -631,7 +631,7 @@ impl<K: TotalOrd, V: TotalEq> Eq for Branch<K, V> {
 
 impl<K: TotalOrd, V: TotalEq> TotalEq for Branch<K, V> {}
 
-impl<K: TotalOrd, V: TotalEq> Ord for Branch<K, V> {
+impl<K: TotalOrd, V: TotalEq> PartialOrd for Branch<K, V> {
     fn lt(&self, other: &Branch<K, V>) -> bool {
         self.cmp(other) == Less
     }
@@ -691,7 +691,7 @@ impl<K: Clone + TotalOrd, V: Clone> Clone for LeafElt<K, V> {
     }
 }
 
-impl<K: TotalOrd, V: TotalEq> Eq for LeafElt<K, V> {
+impl<K: TotalOrd, V: TotalEq> PartialEq for LeafElt<K, V> {
     fn eq(&self, other: &LeafElt<K, V>) -> bool {
         self.key == other.key && self.value == other.value
     }
@@ -699,7 +699,7 @@ impl<K: TotalOrd, V: TotalEq> Eq for LeafElt<K, V> {
 
 impl<K: TotalOrd, V: TotalEq> TotalEq for LeafElt<K, V> {}
 
-impl<K: TotalOrd, V: TotalEq> Ord for LeafElt<K, V> {
+impl<K: TotalOrd, V: TotalEq> PartialOrd for LeafElt<K, V> {
     fn lt(&self, other: &LeafElt<K, V>) -> bool {
         self.cmp(other) == Less
     }
@@ -740,7 +740,7 @@ impl<K: Clone + TotalOrd, V: Clone> Clone for BranchElt<K, V> {
     }
 }
 
-impl<K: TotalOrd, V: TotalEq> Eq for BranchElt<K, V>{
+impl<K: TotalOrd, V: TotalEq> PartialEq for BranchElt<K, V>{
     fn eq(&self, other: &BranchElt<K, V>) -> bool {
         self.key == other.key && self.value == other.value
     }
@@ -748,7 +748,7 @@ impl<K: TotalOrd, V: TotalEq> Eq for BranchElt<K, V>{
 
 impl<K: TotalOrd, V: TotalEq> TotalEq for BranchElt<K, V>{}
 
-impl<K: TotalOrd, V: TotalEq> Ord for BranchElt<K, V> {
+impl<K: TotalOrd, V: TotalEq> PartialOrd for BranchElt<K, V> {
     fn lt(&self, other: &BranchElt<K, V>) -> bool {
         self.cmp(other) == Less
     }
diff --git a/src/libcollections/dlist.rs b/src/libcollections/dlist.rs
index 95729919738..d99474cf5f8 100644
--- a/src/libcollections/dlist.rs
+++ b/src/libcollections/dlist.rs
@@ -572,7 +572,7 @@ impl<A> Extendable<A> for DList<A> {
     }
 }
 
-impl<A: Eq> Eq for DList<A> {
+impl<A: PartialEq> PartialEq for DList<A> {
     fn eq(&self, other: &DList<A>) -> bool {
         self.len() == other.len() &&
             iter::order::eq(self.iter(), other.iter())
@@ -584,7 +584,7 @@ impl<A: Eq> Eq for DList<A> {
     }
 }
 
-impl<A: Ord> Ord for DList<A> {
+impl<A: PartialOrd> PartialOrd for DList<A> {
     fn lt(&self, other: &DList<A>) -> bool {
         iter::order::lt(self.iter(), other.iter())
     }
diff --git a/src/libcollections/enum_set.rs b/src/libcollections/enum_set.rs
index 41501f2d261..797fbbcebf7 100644
--- a/src/libcollections/enum_set.rs
+++ b/src/libcollections/enum_set.rs
@@ -15,7 +15,7 @@
 
 use std::num::Bitwise;
 
-#[deriving(Clone, Eq, TotalEq, Hash, Show)]
+#[deriving(Clone, PartialEq, TotalEq, Hash, Show)]
 /// A specialized Set implementation to use enum types.
 pub struct EnumSet<E> {
     // We must maintain the invariant that no bits are set
@@ -141,7 +141,7 @@ mod test {
 
     use enum_set::{EnumSet, CLike};
 
-    #[deriving(Eq, Show)]
+    #[deriving(PartialEq, Show)]
     #[repr(uint)]
     enum Foo {
         A, B, C
diff --git a/src/libcollections/hashmap.rs b/src/libcollections/hashmap.rs
index c1bc379f0b7..f535e87de5c 100644
--- a/src/libcollections/hashmap.rs
+++ b/src/libcollections/hashmap.rs
@@ -12,7 +12,7 @@
 
 use std::container::{Container, Mutable, Map, MutableMap, Set, MutableSet};
 use std::clone::Clone;
-use std::cmp::{Eq, TotalEq, Equiv, max};
+use std::cmp::{PartialEq, TotalEq, Equiv, max};
 use std::default::Default;
 use std::fmt;
 use std::fmt::Show;
@@ -32,7 +32,7 @@ use std::slice::ImmutableVector;
 mod table {
     use std::clone::Clone;
     use std::cmp;
-    use std::cmp::Eq;
+    use std::cmp::PartialEq;
     use std::hash::{Hash, Hasher};
     use std::kinds::marker;
     use std::num::{CheckedMul, is_power_of_two};
@@ -145,7 +145,7 @@ mod table {
 
     /// A hash that is not zero, since we use a hash of zero to represent empty
     /// buckets.
-    #[deriving(Eq)]
+    #[deriving(PartialEq)]
     pub struct SafeHash {
         hash: u64,
     }
@@ -661,8 +661,8 @@ static INITIAL_LOAD_FACTOR: Fraction = (9, 10);
 /// denial-of-service attacks (Hash DoS). This behaviour can be
 /// overridden with one of the constructors.
 ///
-/// It is required that the keys implement the `Eq` and `Hash` traits, although
-/// this can frequently be achieved by using `#[deriving(Eq, Hash)]`.
+/// It is required that the keys implement the `PartialEq` and `Hash` traits, although
+/// this can frequently be achieved by using `#[deriving(PartialEq, Hash)]`.
 ///
 /// Relevant papers/articles:
 ///
@@ -1402,7 +1402,7 @@ impl<K: TotalEq + Hash<S>, V: Clone, S, H: Hasher<S>> HashMap<K, V, H> {
     }
 }
 
-impl<K: TotalEq + Hash<S>, V: Eq, S, H: Hasher<S>> Eq for HashMap<K, V, H> {
+impl<K: TotalEq + Hash<S>, V: PartialEq, S, H: Hasher<S>> PartialEq for HashMap<K, V, H> {
     fn eq(&self, other: &HashMap<K, V, H>) -> bool {
         if self.len() != other.len() { return false; }
 
@@ -1480,13 +1480,13 @@ pub type SetMoveItems<K> =
 
 /// An implementation of a hash set using the underlying representation of a
 /// HashMap where the value is (). As with the `HashMap` type, a `HashSet`
-/// requires that the elements implement the `Eq` and `Hash` traits.
+/// requires that the elements implement the `PartialEq` and `Hash` traits.
 #[deriving(Clone)]
 pub struct HashSet<T, H = sip::SipHasher> {
     map: HashMap<T, (), H>
 }
 
-impl<T: TotalEq + Hash<S>, S, H: Hasher<S>> Eq for HashSet<T, H> {
+impl<T: TotalEq + Hash<S>, S, H: Hasher<S>> PartialEq for HashSet<T, H> {
     fn eq(&self, other: &HashSet<T, H>) -> bool {
         if self.len() != other.len() { return false; }
 
@@ -1691,7 +1691,7 @@ mod test_map {
 
     local_data_key!(drop_vector: RefCell<Vec<int>>)
 
-    #[deriving(Hash, Eq, TotalEq)]
+    #[deriving(Hash, PartialEq, TotalEq)]
     struct Dropable {
         k: uint
     }
diff --git a/src/libcollections/lru_cache.rs b/src/libcollections/lru_cache.rs
index 7db3525a36e..7c8513bac32 100644
--- a/src/libcollections/lru_cache.rs
+++ b/src/libcollections/lru_cache.rs
@@ -67,7 +67,7 @@ impl<S, K: Hash<S>> Hash<S> for KeyRef<K> {
     }
 }
 
-impl<K: Eq> Eq for KeyRef<K> {
+impl<K: PartialEq> PartialEq for KeyRef<K> {
     fn eq(&self, other: &KeyRef<K>) -> bool {
         unsafe{ (*self.k).eq(&*other.k) }
     }
@@ -253,7 +253,7 @@ impl<K, V> Drop for LruCache<K, V> {
 mod tests {
     use super::LruCache;
 
-    fn assert_opt_eq<V: Eq>(opt: Option<&V>, v: V) {
+    fn assert_opt_eq<V: PartialEq>(opt: Option<&V>, v: V) {
         assert!(opt.is_some());
         assert!(opt.unwrap() == &v);
     }
diff --git a/src/libcollections/ringbuf.rs b/src/libcollections/ringbuf.rs
index f45c9685be5..0ca4177b7aa 100644
--- a/src/libcollections/ringbuf.rs
+++ b/src/libcollections/ringbuf.rs
@@ -364,7 +364,7 @@ fn raw_index(lo: uint, len: uint, index: uint) -> uint {
     }
 }
 
-impl<A: Eq> Eq for RingBuf<A> {
+impl<A: PartialEq> PartialEq for RingBuf<A> {
     fn eq(&self, other: &RingBuf<A>) -> bool {
         self.nelts == other.nelts &&
             self.iter().zip(other.iter()).all(|(a, b)| a.eq(b))
@@ -397,7 +397,7 @@ mod tests {
     use self::test::Bencher;
     use deque::Deque;
     use std::clone::Clone;
-    use std::cmp::Eq;
+    use std::cmp::PartialEq;
     use std::fmt::Show;
     use super::RingBuf;
 
@@ -483,7 +483,7 @@ mod tests {
     }
 
     #[cfg(test)]
-    fn test_parameterized<T:Clone + Eq + Show>(a: T, b: T, c: T, d: T) {
+    fn test_parameterized<T:Clone + PartialEq + Show>(a: T, b: T, c: T, d: T) {
         let mut deq = RingBuf::new();
         assert_eq!(deq.len(), 0);
         deq.push_front(a.clone());
@@ -568,21 +568,21 @@ mod tests {
         })
     }
 
-    #[deriving(Clone, Eq, Show)]
+    #[deriving(Clone, PartialEq, Show)]
     enum Taggy {
         One(int),
         Two(int, int),
         Three(int, int, int),
     }
 
-    #[deriving(Clone, Eq, Show)]
+    #[deriving(Clone, PartialEq, Show)]
     enum Taggypar<T> {
         Onepar(int),
         Twopar(int, int),
         Threepar(int, int, int),
     }
 
-    #[deriving(Clone, Eq, Show)]
+    #[deriving(Clone, PartialEq, Show)]
     struct RecCy {
         x: int,
         y: int,
diff --git a/src/libcollections/treemap.rs b/src/libcollections/treemap.rs
index 793b562b582..98816003a37 100644
--- a/src/libcollections/treemap.rs
+++ b/src/libcollections/treemap.rs
@@ -43,7 +43,7 @@ pub struct TreeMap<K, V> {
     length: uint
 }
 
-impl<K: Eq + TotalOrd, V: Eq> Eq for TreeMap<K, V> {
+impl<K: PartialEq + TotalOrd, V: PartialEq> PartialEq for TreeMap<K, V> {
     fn eq(&self, other: &TreeMap<K, V>) -> bool {
         self.len() == other.len() &&
             self.iter().zip(other.iter()).all(|(a, b)| a == b)
@@ -51,7 +51,7 @@ impl<K: Eq + TotalOrd, V: Eq> Eq for TreeMap<K, V> {
 }
 
 // Lexicographical comparison
-fn lt<K: Ord + TotalOrd, V: Ord>(a: &TreeMap<K, V>,
+fn lt<K: PartialOrd + TotalOrd, V: PartialOrd>(a: &TreeMap<K, V>,
                                  b: &TreeMap<K, V>) -> bool {
     // the Zip iterator is as long as the shortest of a and b.
     for ((key_a, value_a), (key_b, value_b)) in a.iter().zip(b.iter()) {
@@ -64,7 +64,7 @@ fn lt<K: Ord + TotalOrd, V: Ord>(a: &TreeMap<K, V>,
     a.len() < b.len()
 }
 
-impl<K: Ord + TotalOrd, V: Ord> Ord for TreeMap<K, V> {
+impl<K: PartialOrd + TotalOrd, V: PartialOrd> PartialOrd for TreeMap<K, V> {
     #[inline]
     fn lt(&self, other: &TreeMap<K, V>) -> bool { lt(self, other) }
 }
@@ -552,12 +552,12 @@ pub struct TreeSet<T> {
     map: TreeMap<T, ()>
 }
 
-impl<T: Eq + TotalOrd> Eq for TreeSet<T> {
+impl<T: PartialEq + TotalOrd> PartialEq for TreeSet<T> {
     #[inline]
     fn eq(&self, other: &TreeSet<T>) -> bool { self.map == other.map }
 }
 
-impl<T: Ord + TotalOrd> Ord for TreeSet<T> {
+impl<T: PartialOrd + TotalOrd> PartialOrd for TreeSet<T> {
     #[inline]
     fn lt(&self, other: &TreeSet<T>) -> bool { self.map < other.map }
 }
@@ -1070,7 +1070,7 @@ mod test_treemap {
         assert_eq!(m.find(&k1), Some(&v1));
     }
 
-    fn check_equal<K: Eq + TotalOrd, V: Eq>(ctrl: &[(K, V)],
+    fn check_equal<K: PartialEq + TotalOrd, V: PartialEq>(ctrl: &[(K, V)],
                                             map: &TreeMap<K, V>) {
         assert_eq!(ctrl.is_empty(), map.is_empty());
         for x in ctrl.iter() {