From bba701c59d84eac4e20d0796ec06db8d1cdd39cf Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Sat, 31 May 2014 10:43:52 -0700 Subject: [PATCH] std: Drop Total from Total{Eq,Ord} This completes the last stage of the renaming of the comparison hierarchy of traits. This change renames TotalEq to Eq and TotalOrd to Ord. In the future the new Eq/Ord will be filled out with their appropriate methods, but for now this change is purely a renaming change. [breaking-change] --- src/liballoc/owned.rs | 6 +- src/liballoc/rc.rs | 6 +- src/libcollections/btree.rs | 96 +++++----- src/libcollections/dlist.rs | 2 +- src/libcollections/enum_set.rs | 2 +- src/libcollections/hashmap.rs | 52 +++--- src/libcollections/lru_cache.rs | 10 +- src/libcollections/priority_queue.rs | 10 +- src/libcollections/treemap.rs | 80 ++++----- src/libcore/cmp.rs | 41 ++--- src/libcore/intrinsics.rs | 2 +- src/libcore/iter.rs | 18 +- src/libcore/option.rs | 4 +- src/libcore/prelude.rs | 4 +- src/libcore/ptr.rs | 6 +- src/libcore/result.rs | 2 +- src/libcore/slice.rs | 18 +- src/libcore/str.rs | 10 +- src/libcore/tuple.rs | 10 +- src/libfmt_macros/lib.rs | 4 +- src/libglob/lib.rs | 8 +- src/libnum/bigint.rs | 10 +- src/libnum/rational.rs | 4 +- src/librustc/back/link.rs | 2 +- src/librustc/driver/config.rs | 2 +- src/librustc/middle/borrowck/mod.rs | 4 +- src/librustc/middle/lang_items.rs | 2 +- src/librustc/middle/lint.rs | 6 +- src/librustc/middle/mem_categorization.rs | 10 +- src/librustc/middle/resolve.rs | 2 +- src/librustc/middle/trans/datum.rs | 2 +- src/librustc/middle/trans/monomorphize.rs | 4 +- src/librustc/middle/ty.rs | 56 +++--- .../typeck/infer/region_inference/mod.rs | 4 +- src/librustc/middle/typeck/mod.rs | 2 +- src/librustc/util/nodemap.rs | 4 +- src/librustdoc/clean/mod.rs | 2 +- src/libserialize/collection_impls.rs | 16 +- src/libstd/ascii.rs | 2 +- src/libstd/bitflags.rs | 2 +- src/libstd/io/net/ip.rs | 4 +- src/libstd/io/process.rs | 4 +- src/libstd/path/posix.rs | 4 +- src/libstd/path/windows.rs | 4 +- src/libstd/prelude.rs | 6 +- src/libstd/slice.rs | 10 +- src/libstd/str.rs | 6 +- src/libstd/string.rs | 2 +- src/libstd/vec.rs | 10 +- src/libsyntax/abi.rs | 2 +- src/libsyntax/ast.rs | 164 +++++++++--------- src/libsyntax/codemap.rs | 6 +- src/libsyntax/ext/deriving/generic/mod.rs | 2 +- src/libsyntax/ext/deriving/mod.rs | 4 +- src/libsyntax/owned_slice.rs | 2 +- src/libsyntax/parse/obsolete.rs | 2 +- src/libsyntax/parse/token.rs | 8 +- src/libsyntax/util/interner.rs | 6 +- src/libtest/lib.rs | 4 +- src/libtest/stats.rs | 2 +- src/libtime/lib.rs | 2 +- src/liburl/lib.rs | 4 +- src/libuuid/lib.rs | 2 +- src/snapshots.txt | 8 + src/test/bench/shootout-k-nucleotide.rs | 2 +- ...riving-span-TotalEq-enum-struct-variant.rs | 2 +- .../deriving-span-TotalEq-enum.rs | 2 +- .../deriving-span-TotalEq-struct.rs | 2 +- .../deriving-span-TotalEq-tuple-struct.rs | 2 +- ...iving-span-TotalOrd-enum-struct-variant.rs | 4 +- .../deriving-span-TotalOrd-enum.rs | 4 +- .../deriving-span-TotalOrd-struct.rs | 4 +- .../deriving-span-TotalOrd-tuple-struct.rs | 4 +- .../run-pass/deriving-cmp-generic-enum.rs | 6 +- .../deriving-cmp-generic-struct-enum.rs | 6 +- .../run-pass/deriving-cmp-generic-struct.rs | 6 +- .../deriving-cmp-generic-tuple-struct.rs | 6 +- .../run-pass/deriving-cmp-shortcircuit.rs | 6 +- src/test/run-pass/deriving-global.rs | 6 +- ...deriving-self-lifetime-totalord-totaleq.rs | 2 +- src/test/run-pass/issue-12860.rs | 2 +- src/test/run-pass/regions-mock-tcx.rs | 4 +- src/test/run-pass/vector-sort-failure-safe.rs | 2 +- 83 files changed, 436 insertions(+), 431 deletions(-) diff --git a/src/liballoc/owned.rs b/src/liballoc/owned.rs index 61fff41374b..9377c968272 100644 --- a/src/liballoc/owned.rs +++ b/src/liballoc/owned.rs @@ -12,7 +12,7 @@ use core::any::{Any, AnyRefExt}; use core::clone::Clone; -use core::cmp::{PartialEq, PartialOrd, TotalEq, TotalOrd, Ordering}; +use core::cmp::{PartialEq, PartialOrd, Eq, Ord, Ordering}; use core::default::Default; use core::fmt; use core::intrinsics; @@ -67,11 +67,11 @@ impl PartialOrd for Box { #[inline] fn gt(&self, other: &Box) -> bool { *(*self) > *(*other) } } -impl TotalOrd for Box { +impl Ord for Box { #[inline] fn cmp(&self, other: &Box) -> Ordering { (**self).cmp(*other) } } -impl TotalEq for Box {} +impl Eq for Box {} /// Extension methods for an owning `Any` trait object pub trait AnyOwnExt { diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index 8bf7f64a719..7177aa3de45 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -26,7 +26,7 @@ pointers, and then storing the parent pointers as `Weak` pointers. use core::mem::transmute; use core::cell::Cell; use core::clone::Clone; -use core::cmp::{PartialEq, PartialOrd, TotalEq, TotalOrd, Ordering}; +use core::cmp::{PartialEq, PartialOrd, Eq, Ord, Ordering}; use core::kinds::marker; use core::ops::{Deref, Drop}; use core::option::{Option, Some, None}; @@ -157,7 +157,7 @@ impl PartialEq for Rc { fn ne(&self, other: &Rc) -> bool { **self != **other } } -impl TotalEq for Rc {} +impl Eq for Rc {} impl PartialOrd for Rc { #[inline(always)] @@ -173,7 +173,7 @@ impl PartialOrd for Rc { fn ge(&self, other: &Rc) -> bool { **self >= **other } } -impl TotalOrd for Rc { +impl Ord for Rc { #[inline] fn cmp(&self, other: &Rc) -> Ordering { (**self).cmp(&**other) } } diff --git a/src/libcollections/btree.rs b/src/libcollections/btree.rs index e0bb8658c13..cebf21ee7e7 100644 --- a/src/libcollections/btree.rs +++ b/src/libcollections/btree.rs @@ -29,7 +29,7 @@ pub struct BTree { upper_bound: uint } -impl BTree { +impl BTree { ///Returns new BTree with root node (leaf) and user-supplied lower bound ///The lower bound applies to every node except the root node. @@ -59,7 +59,7 @@ impl BTree { //We would probably want to remove the dependence on the Clone trait in the future. //It is here as a crutch to ensure values can be passed around through the tree's nodes //especially during insertions and deletions. -impl BTree { +impl BTree { ///Returns the value of a given key, which may not exist in the tree. ///Calls the root node's get method. pub fn get(self, k: K) -> Option { @@ -84,7 +84,7 @@ impl BTree { } } -impl Clone for BTree { +impl Clone for BTree { ///Implements the Clone trait for the BTree. ///Uses a helper function/constructor to produce a new BTree. fn clone(&self) -> BTree { @@ -92,28 +92,28 @@ impl Clone for BTree { } } -impl PartialEq for BTree { +impl PartialEq for BTree { fn eq(&self, other: &BTree) -> bool { self.root.cmp(&other.root) == Equal } } -impl TotalEq for BTree {} +impl Eq for BTree {} -impl PartialOrd for BTree { +impl PartialOrd for BTree { fn lt(&self, other: &BTree) -> bool { self.cmp(other) == Less } } -impl TotalOrd for BTree { +impl Ord for BTree { ///Returns an ordering based on the root nodes of each BTree. fn cmp(&self, other: &BTree) -> Ordering { self.root.cmp(&other.root) } } -impl fmt::Show for BTree { +impl fmt::Show for BTree { ///Returns a string representation of the BTree fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.root.fmt(f) @@ -133,7 +133,7 @@ enum Node { //Node functions/methods -impl Node { +impl Node { ///Creates a new leaf node given a vector of elements. fn new_leaf(vec: Vec>) -> Node { LeafNode(Leaf::new(vec)) @@ -164,7 +164,7 @@ impl Node { } } -impl Node { +impl Node { ///Returns the corresponding value to the provided key. ///get() is called in different ways on a branch or a leaf. fn get(&self, k: K) -> Option { @@ -183,7 +183,7 @@ impl Node { } } -impl Clone for Node { +impl Clone for Node { ///Returns a new node based on whether or not it is a branch or a leaf. fn clone(&self) -> Node { match *self { @@ -198,7 +198,7 @@ impl Clone for Node { } } -impl PartialEq for Node { +impl PartialEq for Node { fn eq(&self, other: &Node) -> bool { match *self{ BranchNode(ref branch) => { @@ -220,16 +220,16 @@ impl PartialEq for Node { } } -impl TotalEq for Node {} +impl Eq for Node {} -impl PartialOrd for Node { +impl PartialOrd for Node { fn lt(&self, other: &Node) -> bool { self.cmp(other) == Less } } -impl TotalOrd for Node { - ///Implementation of TotalOrd for Nodes. +impl Ord for Node { + ///Implementation of Ord for Nodes. fn cmp(&self, other: &Node) -> Ordering { match *self { LeafNode(ref leaf) => { @@ -248,7 +248,7 @@ impl TotalOrd for Node { } } -impl fmt::Show for Node { +impl fmt::Show for Node { ///Returns a string representation of a Node. ///Will iterate over the Node and show "Key: x, value: y, child: () // " ///for all elements in the Node. "Child" only exists if the Node contains @@ -275,7 +275,7 @@ struct Branch { } -impl Leaf { +impl Leaf { ///Creates a new Leaf from a vector of LeafElts. fn new(vec: Vec>) -> Leaf { Leaf { @@ -335,7 +335,7 @@ impl Leaf { } -impl Leaf { +impl Leaf { ///Returns the corresponding value to the supplied key. fn get(&self, k: K) -> Option { for s in self.elts.iter() { @@ -386,28 +386,28 @@ impl Leaf { } } -impl Clone for Leaf { +impl Clone for Leaf { ///Returns a new Leaf with the same elts. fn clone(&self) -> Leaf { Leaf::new(self.elts.clone()) } } -impl PartialEq for Leaf { +impl PartialEq for Leaf { fn eq(&self, other: &Leaf) -> bool { self.elts == other.elts } } -impl TotalEq for Leaf {} +impl Eq for Leaf {} -impl PartialOrd for Leaf { +impl PartialOrd for Leaf { fn lt(&self, other: &Leaf) -> bool { self.cmp(other) == Less } } -impl TotalOrd for Leaf { +impl Ord for Leaf { ///Returns an ordering based on the first element of each Leaf. fn cmp(&self, other: &Leaf) -> Ordering { if self.elts.len() > other.elts.len() { @@ -421,7 +421,7 @@ impl TotalOrd for Leaf { } -impl fmt::Show for Leaf { +impl fmt::Show for Leaf { ///Returns a string representation of a Leaf. fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { for (i, s) in self.elts.iter().enumerate() { @@ -433,7 +433,7 @@ impl fmt::Show for Leaf { } -impl Branch { +impl Branch { ///Creates a new Branch from a vector of BranchElts and a rightmost child (a node). fn new(vec: Vec>, right: Box>) -> Branch { @@ -492,7 +492,7 @@ impl Branch { } } -impl Branch { +impl Branch { ///Returns the corresponding value to the supplied key. ///If the key is not there, find the child that might hold it. fn get(&self, k: K) -> Option { @@ -616,28 +616,28 @@ impl Branch { } } -impl Clone for Branch { +impl Clone for Branch { ///Returns a new branch using the clone methods of the Branch's internal variables. fn clone(&self) -> Branch { Branch::new(self.elts.clone(), self.rightmost_child.clone()) } } -impl PartialEq for Branch { +impl PartialEq for Branch { fn eq(&self, other: &Branch) -> bool { self.elts == other.elts } } -impl TotalEq for Branch {} +impl Eq for Branch {} -impl PartialOrd for Branch { +impl PartialOrd for Branch { fn lt(&self, other: &Branch) -> bool { self.cmp(other) == Less } } -impl TotalOrd for Branch { +impl Ord for Branch { ///Compares the first elements of two branches to determine an ordering fn cmp(&self, other: &Branch) -> Ordering { if self.elts.len() > other.elts.len() { @@ -650,7 +650,7 @@ impl TotalOrd for Branch { } } -impl fmt::Show for Branch { +impl fmt::Show for Branch { ///Returns a string representation of a Branch. fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { for (i, s) in self.elts.iter().enumerate() { @@ -674,7 +674,7 @@ struct BranchElt { value: V } -impl LeafElt { +impl LeafElt { ///Creates a new LeafElt from a supplied key-value pair. fn new(k: K, v: V) -> LeafElt { LeafElt { @@ -684,42 +684,42 @@ impl LeafElt { } } -impl Clone for LeafElt { +impl Clone for LeafElt { ///Returns a new LeafElt by cloning the key and value. fn clone(&self) -> LeafElt { LeafElt::new(self.key.clone(), self.value.clone()) } } -impl PartialEq for LeafElt { +impl PartialEq for LeafElt { fn eq(&self, other: &LeafElt) -> bool { self.key == other.key && self.value == other.value } } -impl TotalEq for LeafElt {} +impl Eq for LeafElt {} -impl PartialOrd for LeafElt { +impl PartialOrd for LeafElt { fn lt(&self, other: &LeafElt) -> bool { self.cmp(other) == Less } } -impl TotalOrd for LeafElt { +impl Ord for LeafElt { ///Returns an ordering based on the keys of the LeafElts. fn cmp(&self, other: &LeafElt) -> Ordering { self.key.cmp(&other.key) } } -impl fmt::Show for LeafElt { +impl fmt::Show for LeafElt { ///Returns a string representation of a LeafElt. fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "Key: {}, value: {};", self.key, self.value) } } -impl BranchElt { +impl BranchElt { ///Creates a new BranchElt from a supplied key, value, and left child. fn new(k: K, v: V, n: Box>) -> BranchElt { BranchElt { @@ -731,7 +731,7 @@ impl BranchElt { } -impl Clone for BranchElt { +impl Clone for BranchElt { ///Returns a new BranchElt by cloning the key, value, and left child. fn clone(&self) -> BranchElt { BranchElt::new(self.key.clone(), @@ -740,28 +740,28 @@ impl Clone for BranchElt { } } -impl PartialEq for BranchElt{ +impl PartialEq for BranchElt{ fn eq(&self, other: &BranchElt) -> bool { self.key == other.key && self.value == other.value } } -impl TotalEq for BranchElt{} +impl Eq for BranchElt{} -impl PartialOrd for BranchElt { +impl PartialOrd for BranchElt { fn lt(&self, other: &BranchElt) -> bool { self.cmp(other) == Less } } -impl TotalOrd for BranchElt { - ///Fulfills TotalOrd for BranchElts +impl Ord for BranchElt { + ///Fulfills Ord for BranchElts fn cmp(&self, other: &BranchElt) -> Ordering { self.key.cmp(&other.key) } } -impl fmt::Show for BranchElt { +impl fmt::Show for BranchElt { /// Returns string containing key, value, and child (which should recur to a /// leaf) Consider changing in future to be more readable. fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { diff --git a/src/libcollections/dlist.rs b/src/libcollections/dlist.rs index d99474cf5f8..014d4e680ee 100644 --- a/src/libcollections/dlist.rs +++ b/src/libcollections/dlist.rs @@ -388,7 +388,7 @@ impl DList { } } -impl DList { +impl DList { /// Insert `elt` sorted in ascending order /// /// O(N) diff --git a/src/libcollections/enum_set.rs b/src/libcollections/enum_set.rs index 797fbbcebf7..78485321aa5 100644 --- a/src/libcollections/enum_set.rs +++ b/src/libcollections/enum_set.rs @@ -15,7 +15,7 @@ use std::num::Bitwise; -#[deriving(Clone, PartialEq, TotalEq, Hash, Show)] +#[deriving(Clone, PartialEq, Eq, Hash, Show)] /// A specialized Set implementation to use enum types. pub struct EnumSet { // We must maintain the invariant that no bits are set diff --git a/src/libcollections/hashmap.rs b/src/libcollections/hashmap.rs index f535e87de5c..4eacc386306 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::{PartialEq, TotalEq, Equiv, max}; +use std::cmp::{PartialEq, Eq, Equiv, max}; use std::default::Default; use std::fmt; use std::fmt::Show; @@ -733,7 +733,7 @@ fn grow_at(capacity: uint, load_factor: Fraction) -> uint { fraction_mul(capacity, load_factor) } -impl, V, S, H: Hasher> HashMap { +impl, V, S, H: Hasher> HashMap { /// Get the number of elements which will force the capacity to shrink. /// When size == self.shrink_at(), we halve the capacity. fn shrink_at(&self) -> uint { @@ -925,12 +925,12 @@ impl, V, S, H: Hasher> HashMap { } } -impl, V, S, H: Hasher> Container for HashMap { +impl, V, S, H: Hasher> Container for HashMap { /// Return the number of elements in the map fn len(&self) -> uint { self.table.size() } } -impl, V, S, H: Hasher> Mutable for HashMap { +impl, V, S, H: Hasher> Mutable for HashMap { /// Clear the map, removing all key-value pairs. fn clear(&mut self) { self.minimum_capacity = self.table.size(); @@ -945,7 +945,7 @@ impl, V, S, H: Hasher> Mutable for HashMap { } -impl, V, S, H: Hasher> Map for HashMap { +impl, V, S, H: Hasher> Map for HashMap { fn find<'a>(&'a self, k: &K) -> Option<&'a V> { self.search(k).map(|idx| { let (_, v) = self.table.read(&idx); @@ -958,7 +958,7 @@ impl, V, S, H: Hasher> Map for HashMap { } } -impl, V, S, H: Hasher> MutableMap for HashMap { +impl, V, S, H: Hasher> MutableMap for HashMap { fn find_mut<'a>(&'a mut self, k: &K) -> Option<&'a mut V> { match self.search(k) { None => None, @@ -1027,7 +1027,7 @@ impl, V, S, H: Hasher> MutableMap for HashMap HashMap { +impl HashMap { /// Create an empty HashMap. pub fn new() -> HashMap { HashMap::with_capacity(INITIAL_CAPACITY) @@ -1042,7 +1042,7 @@ impl HashMap { } } -impl, V, S, H: Hasher> HashMap { +impl, V, S, H: Hasher> HashMap { pub fn with_hasher(hasher: H) -> HashMap { HashMap::with_capacity_and_hasher(INITIAL_CAPACITY, hasher) } @@ -1390,7 +1390,7 @@ impl, V, S, H: Hasher> HashMap { } } -impl, V: Clone, S, H: Hasher> HashMap { +impl, V: Clone, S, H: Hasher> HashMap { /// Like `find`, but returns a copy of the value. pub fn find_copy(&self, k: &K) -> Option { self.find(k).map(|v| (*v).clone()) @@ -1402,7 +1402,7 @@ impl, V: Clone, S, H: Hasher> HashMap { } } -impl, V: PartialEq, S, H: Hasher> PartialEq for HashMap { +impl, V: PartialEq, S, H: Hasher> PartialEq for HashMap { fn eq(&self, other: &HashMap) -> bool { if self.len() != other.len() { return false; } @@ -1416,7 +1416,7 @@ impl, V: PartialEq, S, H: Hasher> PartialEq for HashMap< } } -impl + Show, V: Show, S, H: Hasher> Show for HashMap { +impl + Show, V: Show, S, H: Hasher> Show for HashMap { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { try!(write!(f, r"\{")); @@ -1429,7 +1429,7 @@ impl + Show, V: Show, S, H: Hasher> Show for HashMap, V, S, H: Hasher + Default> Default for HashMap { +impl, V, S, H: Hasher + Default> Default for HashMap { fn default() -> HashMap { HashMap::with_hasher(Default::default()) } @@ -1453,7 +1453,7 @@ pub type Keys<'a, K, V> = pub type Values<'a, K, V> = iter::Map<'static, (&'a K, &'a V), &'a V, Entries<'a, K, V>>; -impl, V, S, H: Hasher + Default> FromIterator<(K, V)> for HashMap { +impl, V, S, H: Hasher + Default> FromIterator<(K, V)> for HashMap { fn from_iter>(iter: T) -> HashMap { let (lower, _) = iter.size_hint(); let mut map = HashMap::with_capacity_and_hasher(lower, Default::default()); @@ -1462,7 +1462,7 @@ impl, V, S, H: Hasher + Default> FromIterator<(K, V)> fo } } -impl, V, S, H: Hasher + Default> Extendable<(K, V)> for HashMap { +impl, V, S, H: Hasher + Default> Extendable<(K, V)> for HashMap { fn extend>(&mut self, mut iter: T) { for (k, v) in iter { self.insert(k, v); @@ -1486,7 +1486,7 @@ pub struct HashSet { map: HashMap } -impl, S, H: Hasher> PartialEq for HashSet { +impl, S, H: Hasher> PartialEq for HashSet { fn eq(&self, other: &HashSet) -> bool { if self.len() != other.len() { return false; } @@ -1494,15 +1494,15 @@ impl, S, H: Hasher> PartialEq for HashSet { } } -impl, S, H: Hasher> Container for HashSet { +impl, S, H: Hasher> Container for HashSet { fn len(&self) -> uint { self.map.len() } } -impl, S, H: Hasher> Mutable for HashSet { +impl, S, H: Hasher> Mutable for HashSet { fn clear(&mut self) { self.map.clear() } } -impl, S, H: Hasher> Set for HashSet { +impl, S, H: Hasher> Set for HashSet { fn contains(&self, value: &T) -> bool { self.map.contains_key(value) } fn is_disjoint(&self, other: &HashSet) -> bool { @@ -1514,13 +1514,13 @@ impl, S, H: Hasher> Set for HashSet { } } -impl, S, H: Hasher> MutableSet for HashSet { +impl, S, H: Hasher> MutableSet for HashSet { fn insert(&mut self, value: T) -> bool { self.map.insert(value, ()) } fn remove(&mut self, value: &T) -> bool { self.map.remove(value) } } -impl HashSet { +impl HashSet { /// Create an empty HashSet pub fn new() -> HashSet { HashSet::with_capacity(INITIAL_CAPACITY) @@ -1533,7 +1533,7 @@ impl HashSet { } } -impl, S, H: Hasher> HashSet { +impl, S, H: Hasher> HashSet { pub fn with_hasher(hasher: H) -> HashSet { HashSet::with_capacity_and_hasher(INITIAL_CAPACITY, hasher) } @@ -1603,7 +1603,7 @@ impl, S, H: Hasher> HashSet { } } -impl + fmt::Show, S, H: Hasher> fmt::Show for HashSet { +impl + fmt::Show, S, H: Hasher> fmt::Show for HashSet { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { try!(write!(f, r"\{")); @@ -1616,7 +1616,7 @@ impl + fmt::Show, S, H: Hasher> fmt::Show for HashSet, S, H: Hasher + Default> FromIterator for HashSet { +impl, S, H: Hasher + Default> FromIterator for HashSet { fn from_iter>(iter: I) -> HashSet { let (lower, _) = iter.size_hint(); let mut set = HashSet::with_capacity_and_hasher(lower, Default::default()); @@ -1625,7 +1625,7 @@ impl, S, H: Hasher + Default> FromIterator for HashSe } } -impl, S, H: Hasher + Default> Extendable for HashSet { +impl, S, H: Hasher + Default> Extendable for HashSet { fn extend>(&mut self, mut iter: I) { for k in iter { self.insert(k); @@ -1633,7 +1633,7 @@ impl, S, H: Hasher + Default> Extendable for HashSet< } } -impl Default for HashSet { +impl Default for HashSet { fn default() -> HashSet { HashSet::new() } } @@ -1691,7 +1691,7 @@ mod test_map { local_data_key!(drop_vector: RefCell>) - #[deriving(Hash, PartialEq, TotalEq)] + #[deriving(Hash, PartialEq, Eq)] struct Dropable { k: uint } diff --git a/src/libcollections/lru_cache.rs b/src/libcollections/lru_cache.rs index 7c8513bac32..ea25eee06d0 100644 --- a/src/libcollections/lru_cache.rs +++ b/src/libcollections/lru_cache.rs @@ -73,7 +73,7 @@ impl PartialEq for KeyRef { } } -impl TotalEq for KeyRef {} +impl Eq for KeyRef {} impl LruEntry { fn new(k: K, v: V) -> LruEntry { @@ -86,7 +86,7 @@ impl LruEntry { } } -impl LruCache { +impl LruCache { /// Create an LRU Cache that holds at most `capacity` items. pub fn new(capacity: uint) -> LruCache { let cache = LruCache { @@ -201,7 +201,7 @@ impl LruCache { } } -impl fmt::Show for LruCache { +impl fmt::Show for LruCache { /// Return a string that lists the key-value pairs from most-recently /// used to least-recently used. fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -222,14 +222,14 @@ impl fmt::Show for LruCache { } } -impl Container for LruCache { +impl Container for LruCache { /// Return the number of key-value pairs in the cache. fn len(&self) -> uint { self.map.len() } } -impl Mutable for LruCache { +impl Mutable for LruCache { /// Clear the cache of all key-value pairs. fn clear(&mut self) { self.map.clear(); diff --git a/src/libcollections/priority_queue.rs b/src/libcollections/priority_queue.rs index 4a0daf529de..3c1337a0382 100644 --- a/src/libcollections/priority_queue.rs +++ b/src/libcollections/priority_queue.rs @@ -22,17 +22,17 @@ pub struct PriorityQueue { data: Vec, } -impl Container for PriorityQueue { +impl Container for PriorityQueue { /// Returns the length of the queue fn len(&self) -> uint { self.data.len() } } -impl Mutable for PriorityQueue { +impl Mutable for PriorityQueue { /// Drop all items from the queue fn clear(&mut self) { self.data.truncate(0) } } -impl PriorityQueue { +impl PriorityQueue { /// An iterator visiting all values in underlying vector, in /// arbitrary order. pub fn iter<'a>(&'a self) -> Items<'a, T> { @@ -214,7 +214,7 @@ impl<'a, T> Iterator<&'a T> for Items<'a, T> { fn size_hint(&self) -> (uint, Option) { self.iter.size_hint() } } -impl FromIterator for PriorityQueue { +impl FromIterator for PriorityQueue { fn from_iter>(iter: Iter) -> PriorityQueue { let mut q = PriorityQueue::new(); q.extend(iter); @@ -222,7 +222,7 @@ impl FromIterator for PriorityQueue { } } -impl Extendable for PriorityQueue { +impl Extendable for PriorityQueue { fn extend>(&mut self, mut iter: Iter) { let (lower, _) = iter.size_hint(); diff --git a/src/libcollections/treemap.rs b/src/libcollections/treemap.rs index 98816003a37..1184c9b7b52 100644 --- a/src/libcollections/treemap.rs +++ b/src/libcollections/treemap.rs @@ -10,7 +10,7 @@ //! An ordered map and set implemented as self-balancing binary search //! trees. The only requirement for the types is that the key implements -//! `TotalOrd`. +//! `Ord`. use std::cmp::Ordering; use std::fmt::Show; @@ -43,7 +43,7 @@ pub struct TreeMap { length: uint } -impl PartialEq for TreeMap { +impl PartialEq for TreeMap { fn eq(&self, other: &TreeMap) -> bool { self.len() == other.len() && self.iter().zip(other.iter()).all(|(a, b)| a == b) @@ -51,7 +51,7 @@ impl PartialEq for TreeMap { } // Lexicographical comparison -fn lt(a: &TreeMap, +fn lt(a: &TreeMap, b: &TreeMap) -> 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,12 +64,12 @@ fn lt(a: &TreeMap, a.len() < b.len() } -impl PartialOrd for TreeMap { +impl PartialOrd for TreeMap { #[inline] fn lt(&self, other: &TreeMap) -> bool { lt(self, other) } } -impl Show for TreeMap { +impl Show for TreeMap { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { try!(write!(f, r"\{")); @@ -82,18 +82,18 @@ impl Show for TreeMap { } } -impl Container for TreeMap { +impl Container for TreeMap { fn len(&self) -> uint { self.length } } -impl Mutable for TreeMap { +impl Mutable for TreeMap { fn clear(&mut self) { self.root = None; self.length = 0 } } -impl Map for TreeMap { +impl Map for TreeMap { fn find<'a>(&'a self, key: &K) -> Option<&'a V> { let mut current: &'a Option>> = &self.root; loop { @@ -111,7 +111,7 @@ impl Map for TreeMap { } } -impl MutableMap for TreeMap { +impl MutableMap for TreeMap { #[inline] fn find_mut<'a>(&'a mut self, key: &K) -> Option<&'a mut V> { find_mut(&mut self.root, key) @@ -130,7 +130,7 @@ impl MutableMap for TreeMap { } } -impl TreeMap { +impl TreeMap { /// Create an empty TreeMap pub fn new() -> TreeMap { TreeMap{root: None, length: 0} } @@ -216,7 +216,7 @@ macro_rules! bound_setup { } -impl TreeMap { +impl TreeMap { /// Get a lazy iterator that should be initialized using /// `traverse_left`/`traverse_right`/`traverse_complete`. fn iter_for_traversal<'a>(&'a self) -> Entries<'a, K, V> { @@ -546,23 +546,23 @@ impl<'a, T> Iterator<&'a T> for RevSetItems<'a, T> { /// A implementation of the `Set` trait on top of the `TreeMap` container. The /// only requirement is that the type of the elements contained ascribes to the -/// `TotalOrd` trait. +/// `Ord` trait. #[deriving(Clone)] pub struct TreeSet { map: TreeMap } -impl PartialEq for TreeSet { +impl PartialEq for TreeSet { #[inline] fn eq(&self, other: &TreeSet) -> bool { self.map == other.map } } -impl PartialOrd for TreeSet { +impl PartialOrd for TreeSet { #[inline] fn lt(&self, other: &TreeSet) -> bool { self.map < other.map } } -impl Show for TreeSet { +impl Show for TreeSet { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { try!(write!(f, r"\{")); @@ -575,17 +575,17 @@ impl Show for TreeSet { } } -impl Container for TreeSet { +impl Container for TreeSet { #[inline] fn len(&self) -> uint { self.map.len() } } -impl Mutable for TreeSet { +impl Mutable for TreeSet { #[inline] fn clear(&mut self) { self.map.clear() } } -impl Set for TreeSet { +impl Set for TreeSet { #[inline] fn contains(&self, value: &T) -> bool { self.map.contains_key(value) @@ -620,7 +620,7 @@ impl Set for TreeSet { } } -impl MutableSet for TreeSet { +impl MutableSet for TreeSet { #[inline] fn insert(&mut self, value: T) -> bool { self.map.insert(value, ()) } @@ -628,7 +628,7 @@ impl MutableSet for TreeSet { fn remove(&mut self, value: &T) -> bool { self.map.remove(value) } } -impl TreeSet { +impl TreeSet { /// Create an empty TreeSet #[inline] pub fn new() -> TreeSet { TreeSet{map: TreeMap::new()} } @@ -728,7 +728,7 @@ pub struct UnionItems<'a, T> { } /// Compare `x` and `y`, but return `short` if x is None and `long` if y is None -fn cmp_opt(x: Option<&T>, y: Option<&T>, +fn cmp_opt(x: Option<&T>, y: Option<&T>, short: Ordering, long: Ordering) -> Ordering { match (x, y) { (None , _ ) => short, @@ -737,7 +737,7 @@ fn cmp_opt(x: Option<&T>, y: Option<&T>, } } -impl<'a, T: TotalOrd> Iterator<&'a T> for DifferenceItems<'a, T> { +impl<'a, T: Ord> Iterator<&'a T> for DifferenceItems<'a, T> { fn next(&mut self) -> Option<&'a T> { loop { match cmp_opt(self.a.peek(), self.b.peek(), Less, Less) { @@ -749,7 +749,7 @@ impl<'a, T: TotalOrd> Iterator<&'a T> for DifferenceItems<'a, T> { } } -impl<'a, T: TotalOrd> Iterator<&'a T> for SymDifferenceItems<'a, T> { +impl<'a, T: Ord> Iterator<&'a T> for SymDifferenceItems<'a, T> { fn next(&mut self) -> Option<&'a T> { loop { match cmp_opt(self.a.peek(), self.b.peek(), Greater, Less) { @@ -761,7 +761,7 @@ impl<'a, T: TotalOrd> Iterator<&'a T> for SymDifferenceItems<'a, T> { } } -impl<'a, T: TotalOrd> Iterator<&'a T> for IntersectionItems<'a, T> { +impl<'a, T: Ord> Iterator<&'a T> for IntersectionItems<'a, T> { fn next(&mut self) -> Option<&'a T> { loop { let o_cmp = match (self.a.peek(), self.b.peek()) { @@ -779,7 +779,7 @@ impl<'a, T: TotalOrd> Iterator<&'a T> for IntersectionItems<'a, T> { } } -impl<'a, T: TotalOrd> Iterator<&'a T> for UnionItems<'a, T> { +impl<'a, T: Ord> Iterator<&'a T> for UnionItems<'a, T> { fn next(&mut self) -> Option<&'a T> { loop { match cmp_opt(self.a.peek(), self.b.peek(), Greater, Less) { @@ -803,7 +803,7 @@ struct TreeNode { level: uint } -impl TreeNode { +impl TreeNode { /// Creates a new tree node. #[inline] pub fn new(key: K, value: V) -> TreeNode { @@ -812,7 +812,7 @@ impl TreeNode { } // Remove left horizontal link by rotating right -fn skew(node: &mut Box>) { +fn skew(node: &mut Box>) { if node.left.as_ref().map_or(false, |x| x.level == node.level) { let mut save = node.left.take_unwrap(); swap(&mut node.left, &mut save.right); // save.right now None @@ -823,7 +823,7 @@ fn skew(node: &mut Box>) { // Remove dual horizontal link by rotating left and increasing level of // the parent -fn split(node: &mut Box>) { +fn split(node: &mut Box>) { if node.right.as_ref().map_or(false, |x| x.right.as_ref().map_or(false, |y| y.level == node.level)) { let mut save = node.right.take_unwrap(); @@ -834,7 +834,7 @@ fn split(node: &mut Box>) { } } -fn find_mut<'r, K: TotalOrd, V>(node: &'r mut Option>>, +fn find_mut<'r, K: Ord, V>(node: &'r mut Option>>, key: &K) -> Option<&'r mut V> { match *node { @@ -849,7 +849,7 @@ fn find_mut<'r, K: TotalOrd, V>(node: &'r mut Option>>, } } -fn insert(node: &mut Option>>, +fn insert(node: &mut Option>>, key: K, value: V) -> Option { match *node { Some(ref mut save) => { @@ -879,9 +879,9 @@ fn insert(node: &mut Option>>, } } -fn remove(node: &mut Option>>, +fn remove(node: &mut Option>>, key: &K) -> Option { - fn heir_swap(node: &mut Box>, + fn heir_swap(node: &mut Box>, child: &mut Option>>) { // *could* be done without recursion, but it won't borrow check for x in child.mut_iter() { @@ -962,7 +962,7 @@ fn remove(node: &mut Option>>, }; } -impl FromIterator<(K, V)> for TreeMap { +impl FromIterator<(K, V)> for TreeMap { fn from_iter>(iter: T) -> TreeMap { let mut map = TreeMap::new(); map.extend(iter); @@ -970,7 +970,7 @@ impl FromIterator<(K, V)> for TreeMap { } } -impl Extendable<(K, V)> for TreeMap { +impl Extendable<(K, V)> for TreeMap { #[inline] fn extend>(&mut self, mut iter: T) { for (k, v) in iter { @@ -979,7 +979,7 @@ impl Extendable<(K, V)> for TreeMap { } } -impl FromIterator for TreeSet { +impl FromIterator for TreeSet { fn from_iter>(iter: Iter) -> TreeSet { let mut set = TreeSet::new(); set.extend(iter); @@ -987,7 +987,7 @@ impl FromIterator for TreeSet { } } -impl Extendable for TreeSet { +impl Extendable for TreeSet { #[inline] fn extend>(&mut self, mut iter: Iter) { for elem in iter { @@ -1070,7 +1070,7 @@ mod test_treemap { assert_eq!(m.find(&k1), Some(&v1)); } - fn check_equal(ctrl: &[(K, V)], + fn check_equal(ctrl: &[(K, V)], map: &TreeMap) { assert_eq!(ctrl.is_empty(), map.is_empty()); for x in ctrl.iter() { @@ -1091,7 +1091,7 @@ mod test_treemap { } } - fn check_left(node: &Option>>, + fn check_left(node: &Option>>, parent: &Box>) { match *node { Some(ref r) => { @@ -1104,7 +1104,7 @@ mod test_treemap { } } - fn check_right(node: &Option>>, + fn check_right(node: &Option>>, parent: &Box>, parent_red: bool) { match *node { @@ -1121,7 +1121,7 @@ mod test_treemap { } } - fn check_structure(map: &TreeMap) { + fn check_structure(map: &TreeMap) { match map.root { Some(ref r) => { check_left(&r.left, r); diff --git a/src/libcore/cmp.rs b/src/libcore/cmp.rs index 80bc4f31a13..ef00643177b 100644 --- a/src/libcore/cmp.rs +++ b/src/libcore/cmp.rs @@ -37,9 +37,6 @@ //! assert!(SketchyNum {num: 25} != SketchyNum {num: 57}); //! ``` -pub use Eq = self::TotalEq; -pub use Ord = self::TotalOrd; - /// Trait for values that can be compared for equality and inequality. /// /// This trait allows partial equality, where types can be unordered instead of @@ -51,7 +48,7 @@ pub use Ord = self::TotalOrd; /// default. /// /// Eventually, this will be implemented by default for types that implement -/// `TotalEq`. +/// `Eq`. #[lang="eq"] pub trait PartialEq { /// This method tests for `self` and `other` values to be equal, and is used by `==`. @@ -71,7 +68,7 @@ pub trait PartialEq { /// - reflexive: `a == a`; /// - symmetric: `a == b` implies `b == a`; and /// - transitive: `a == b` and `b == c` implies `a == c`. -pub trait TotalEq: PartialEq { +pub trait Eq: PartialEq { // FIXME #13101: this method is used solely by #[deriving] to // assert that every component of a type implements #[deriving] // itself, the current deriving infrastructure means doing this @@ -104,7 +101,7 @@ pub enum Ordering { /// true; and /// - transitive, `a < b` and `b < c` implies `a < c`. The same must hold for /// both `==` and `>`. -pub trait TotalOrd: TotalEq + PartialOrd { +pub trait Ord: Eq + PartialOrd { /// This method returns an ordering between `self` and `other` values. /// /// By convention, `self.cmp(&other)` returns the ordering matching @@ -118,9 +115,9 @@ pub trait TotalOrd: TotalEq + PartialOrd { fn cmp(&self, other: &Self) -> Ordering; } -impl TotalEq for Ordering {} +impl Eq for Ordering {} -impl TotalOrd for Ordering { +impl Ord for Ordering { #[inline] fn cmp(&self, other: &Ordering) -> Ordering { (*self as int).cmp(&(*other as int)) @@ -182,20 +179,20 @@ pub trait Equiv { /// Compare and return the minimum of two values. #[inline] -pub fn min(v1: T, v2: T) -> T { +pub fn min(v1: T, v2: T) -> T { if v1 < v2 { v1 } else { v2 } } /// Compare and return the maximum of two values. #[inline] -pub fn max(v1: T, v2: T) -> T { +pub fn max(v1: T, v2: T) -> T { if v1 > v2 { v1 } else { v2 } } -// Implementation of PartialEq, TotalEq, PartialOrd and TotalOrd for primitive types +// Implementation of PartialEq, Eq, PartialOrd and Ord for primitive types #[cfg(not(test))] mod impls { - use cmp::{PartialOrd, TotalOrd, PartialEq, TotalEq, Ordering, + use cmp::{PartialOrd, Ord, PartialEq, Eq, Ordering, Less, Greater, Equal}; macro_rules! eq_impl( @@ -220,7 +217,7 @@ mod impls { macro_rules! totaleq_impl( ($($t:ty)*) => ($( - impl TotalEq for $t {} + impl Eq for $t {} )*) ) @@ -257,7 +254,7 @@ mod impls { macro_rules! totalord_impl( ($($t:ty)*) => ($( - impl TotalOrd for $t { + impl Ord for $t { #[inline] fn cmp(&self, other: &$t) -> Ordering { if *self < *other { Less } @@ -268,12 +265,12 @@ mod impls { )*) ) - impl TotalOrd for () { + impl Ord for () { #[inline] fn cmp(&self, _other: &()) -> Ordering { Equal } } - impl TotalOrd for bool { + impl Ord for bool { #[inline] fn cmp(&self, other: &bool) -> Ordering { (*self as u8).cmp(&(*other as u8)) @@ -299,11 +296,11 @@ mod impls { #[inline] fn gt(&self, other: & &'a T) -> bool { *(*self) > *(*other) } } - impl<'a, T: TotalOrd> TotalOrd for &'a T { + impl<'a, T: Ord> Ord for &'a T { #[inline] fn cmp(&self, other: & &'a T) -> Ordering { (**self).cmp(*other) } } - impl<'a, T: TotalEq> TotalEq for &'a T {} + impl<'a, T: Eq> Eq for &'a T {} // &mut pointers impl<'a, T: PartialEq> PartialEq for &'a mut T { @@ -322,11 +319,11 @@ mod impls { #[inline] fn gt(&self, other: &&'a mut T) -> bool { **self > **other } } - impl<'a, T: TotalOrd> TotalOrd for &'a mut T { + impl<'a, T: Ord> Ord for &'a mut T { #[inline] fn cmp(&self, other: &&'a mut T) -> Ordering { (**self).cmp(*other) } } - impl<'a, T: TotalEq> TotalEq for &'a mut T {} + impl<'a, T: Eq> Eq for &'a mut T {} // @ pointers impl PartialEq for @T { @@ -345,11 +342,11 @@ mod impls { #[inline] fn gt(&self, other: &@T) -> bool { *(*self) > *(*other) } } - impl TotalOrd for @T { + impl Ord for @T { #[inline] fn cmp(&self, other: &@T) -> Ordering { (**self).cmp(*other) } } - impl TotalEq for @T {} + impl Eq for @T {} } #[cfg(test)] diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs index b36735713af..35c8afee4b6 100644 --- a/src/libcore/intrinsics.rs +++ b/src/libcore/intrinsics.rs @@ -550,7 +550,7 @@ extern "rust-intrinsic" { /// `TypeId` represents a globally unique identifier for a type #[lang="type_id"] // This needs to be kept in lockstep with the code in trans/intrinsic.rs and // middle/lang_items.rs -#[deriving(PartialEq, TotalEq, Show)] +#[deriving(PartialEq, Eq, Show)] #[cfg(not(test))] pub struct TypeId { t: u64, diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index 4438b6ec980..875c852d8ae 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -68,7 +68,7 @@ use cmp; use num::{Zero, One, CheckedAdd, CheckedSub, Saturating, ToPrimitive, Int}; use option::{Option, Some, None}; use ops::{Add, Mul, Sub}; -use cmp::{PartialEq, PartialOrd, TotalOrd}; +use cmp::{PartialEq, PartialOrd, Ord}; use clone::Clone; use uint; use mem; @@ -611,7 +611,7 @@ pub trait Iterator { /// assert_eq!(*xs.iter().max_by(|x| x.abs()).unwrap(), -10); /// ``` #[inline] - fn max_by(&mut self, f: |&A| -> B) -> Option { + fn max_by(&mut self, f: |&A| -> B) -> Option { self.fold(None, |max: Option<(A, B)>, x| { let x_val = f(&x); match max { @@ -635,7 +635,7 @@ pub trait Iterator { /// assert_eq!(*xs.iter().min_by(|x| x.abs()).unwrap(), 0); /// ``` #[inline] - fn min_by(&mut self, f: |&A| -> B) -> Option { + fn min_by(&mut self, f: |&A| -> B) -> Option { self.fold(None, |min: Option<(A, B)>, x| { let x_val = f(&x); match min { @@ -905,7 +905,7 @@ pub trait OrdIterator { fn min_max(&mut self) -> MinMaxResult; } -impl> OrdIterator for T { +impl> OrdIterator for T { #[inline] fn max(&mut self) -> Option { self.fold(None, |max, x| { @@ -2182,12 +2182,12 @@ impl RandomAccessIterator for Repeat { /// the shorter sequence compares less. pub mod order { use cmp; - use cmp::{TotalEq, TotalOrd, PartialOrd, PartialEq}; + use cmp::{Eq, Ord, PartialOrd, PartialEq}; use option::{Some, None}; use super::Iterator; - /// Compare `a` and `b` for equality using `TotalEq` - pub fn equals, S: Iterator>(mut a: T, mut b: S) -> bool { + /// Compare `a` and `b` for equality using `Eq` + pub fn equals, S: Iterator>(mut a: T, mut b: S) -> bool { loop { match (a.next(), b.next()) { (None, None) => return true, @@ -2197,8 +2197,8 @@ pub mod order { } } - /// Order `a` and `b` lexicographically using `TotalOrd` - pub fn cmp, S: Iterator>(mut a: T, mut b: S) -> cmp::Ordering { + /// Order `a` and `b` lexicographically using `Ord` + pub fn cmp, S: Iterator>(mut a: T, mut b: S) -> cmp::Ordering { loop { match (a.next(), b.next()) { (None, None) => return cmp::Equal, diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 379d14a6e6a..b91a8cebded 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -141,14 +141,14 @@ //! } //! ``` -use cmp::{PartialEq, TotalEq, TotalOrd}; +use cmp::{PartialEq, Eq, Ord}; use default::Default; use iter::{Iterator, DoubleEndedIterator, FromIterator, ExactSize}; use mem; use slice; /// The `Option` -#[deriving(Clone, PartialEq, PartialOrd, TotalEq, TotalOrd, Show)] +#[deriving(Clone, PartialEq, PartialOrd, Eq, Ord, Show)] pub enum Option { /// No value None, diff --git a/src/libcore/prelude.rs b/src/libcore/prelude.rs index 466f981c926..a6a8319ca02 100644 --- a/src/libcore/prelude.rs +++ b/src/libcore/prelude.rs @@ -45,7 +45,7 @@ pub use mem::drop; pub use char::Char; pub use clone::Clone; -pub use cmp::{PartialEq, PartialOrd, TotalEq, TotalOrd}; +pub use cmp::{PartialEq, PartialOrd, Eq, Ord}; pub use cmp::{Ordering, Less, Equal, Greater, Equiv}; pub use container::{Container, Mutable, Map, MutableMap, Set, MutableSet}; pub use iter::{FromIterator, Extendable}; @@ -59,6 +59,6 @@ pub use str::{Str, StrSlice}; pub use tuple::{Tuple1, Tuple2, Tuple3, Tuple4}; pub use tuple::{Tuple5, Tuple6, Tuple7, Tuple8}; pub use tuple::{Tuple9, Tuple10, Tuple11, Tuple12}; -pub use slice::{ImmutableEqVector, ImmutableTotalOrdVector}; +pub use slice::{ImmutableEqVector, ImmutableOrdVector}; pub use slice::{MutableVector}; pub use slice::{Vector, ImmutableVector}; diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index 442838b3d08..dacbba61856 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -93,7 +93,7 @@ use intrinsics; use iter::{range, Iterator}; use option::{Some, None, Option}; -#[cfg(not(test))] use cmp::{PartialEq, TotalEq, PartialOrd, Equiv}; +#[cfg(not(test))] use cmp::{PartialEq, Eq, PartialOrd, Equiv}; /// Return the offset of the first null pointer in `buf`. #[inline] @@ -396,7 +396,7 @@ impl PartialEq for *T { } #[cfg(not(test))] -impl TotalEq for *T {} +impl Eq for *T {} #[cfg(not(test))] impl PartialEq for *mut T { @@ -409,7 +409,7 @@ impl PartialEq for *mut T { } #[cfg(not(test))] -impl TotalEq for *mut T {} +impl Eq for *mut T {} // Equivalence for pointers #[cfg(not(test))] diff --git a/src/libcore/result.rs b/src/libcore/result.rs index 8928fa0ee04..c19c5d3145a 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -283,7 +283,7 @@ use option::{None, Option, Some}; /// `Result` is a type that represents either success (`Ok`) or failure (`Err`). /// /// See the [`std::result`](index.html) module documentation for details. -#[deriving(Clone, PartialEq, PartialOrd, TotalEq, TotalOrd, Show)] +#[deriving(Clone, PartialEq, PartialOrd, Eq, Ord, Show)] #[must_use] pub enum Result { /// Contains the success value diff --git a/src/libcore/slice.rs b/src/libcore/slice.rs index 8f885dafffa..5673d0c020d 100644 --- a/src/libcore/slice.rs +++ b/src/libcore/slice.rs @@ -17,7 +17,7 @@ use mem::transmute; use clone::Clone; use container::Container; -use cmp::{PartialEq, TotalOrd, Ordering, Less, Equal, Greater}; +use cmp::{PartialEq, Ord, Ordering, Less, Equal, Greater}; use cmp; use default::Default; use iter::*; @@ -251,7 +251,7 @@ impl<'a, T> RandomAccessIterator<&'a [T]> for Chunks<'a, T> { pub mod traits { use super::*; - use cmp::{PartialEq, PartialOrd, TotalEq, TotalOrd, Ordering, Equiv}; + use cmp::{PartialEq, PartialOrd, Eq, Ord, Ordering, Equiv}; use iter::{order, Iterator}; use container::Container; @@ -273,9 +273,9 @@ pub mod traits { fn ne(&self, other: &~[T]) -> bool { !self.eq(other) } } - impl<'a,T:TotalEq> TotalEq for &'a [T] {} + impl<'a,T:Eq> Eq for &'a [T] {} - impl TotalEq for ~[T] {} + impl Eq for ~[T] {} impl<'a,T:PartialEq, V: Vector> Equiv for &'a [T] { #[inline] @@ -287,13 +287,13 @@ pub mod traits { fn equiv(&self, other: &V) -> bool { self.as_slice() == other.as_slice() } } - impl<'a,T:TotalOrd> TotalOrd for &'a [T] { + impl<'a,T:Ord> Ord for &'a [T] { fn cmp(&self, other: & &'a [T]) -> Ordering { order::cmp(self.iter(), other.iter()) } } - impl TotalOrd for ~[T] { + impl Ord for ~[T] { #[inline] fn cmp(&self, other: &~[T]) -> Ordering { self.as_slice().cmp(&other.as_slice()) } } @@ -741,8 +741,8 @@ impl<'a,T:PartialEq> ImmutableEqVector for &'a [T] { } } -/// Extension methods for vectors containing `TotalOrd` elements. -pub trait ImmutableTotalOrdVector { +/// Extension methods for vectors containing `Ord` elements. +pub trait ImmutableOrdVector { /** * Binary search a sorted vector for a given element. * @@ -751,7 +751,7 @@ pub trait ImmutableTotalOrdVector { fn bsearch_elem(&self, x: &T) -> Option; } -impl<'a, T: TotalOrd> ImmutableTotalOrdVector for &'a [T] { +impl<'a, T: Ord> ImmutableOrdVector for &'a [T] { fn bsearch_elem(&self, x: &T) -> Option { self.bsearch(|p| p.cmp(x)) } diff --git a/src/libcore/str.rs b/src/libcore/str.rs index 21dbaf70597..c83b1d09283 100644 --- a/src/libcore/str.rs +++ b/src/libcore/str.rs @@ -18,7 +18,7 @@ use mem; use char; use clone::Clone; use cmp; -use cmp::{PartialEq, TotalEq}; +use cmp::{PartialEq, Eq}; use container::Container; use default::Default; use iter::{Filter, Map, Iterator}; @@ -698,7 +698,7 @@ pub struct Utf16Items<'a> { iter: slice::Items<'a, u16> } /// The possibilities for values decoded from a `u16` stream. -#[deriving(PartialEq, TotalEq, Clone, Show)] +#[deriving(PartialEq, Eq, Clone, Show)] pub enum Utf16Item { /// A valid codepoint. ScalarValue(char), @@ -932,12 +932,12 @@ Section: Trait implementations #[allow(missing_doc)] pub mod traits { use container::Container; - use cmp::{TotalOrd, Ordering, Less, Equal, Greater, PartialEq, PartialOrd, Equiv, TotalEq}; + use cmp::{Ord, Ordering, Less, Equal, Greater, PartialEq, PartialOrd, Equiv, Eq}; use iter::Iterator; use option::{Some, None}; use str::{Str, StrSlice, eq_slice}; - impl<'a> TotalOrd for &'a str { + impl<'a> Ord for &'a str { #[inline] fn cmp(&self, other: & &'a str) -> Ordering { for (s_b, o_b) in self.bytes().zip(other.bytes()) { @@ -961,7 +961,7 @@ pub mod traits { fn ne(&self, other: & &'a str) -> bool { !(*self).eq(other) } } - impl<'a> TotalEq for &'a str {} + impl<'a> Eq for &'a str {} impl<'a> PartialOrd for &'a str { #[inline] diff --git a/src/libcore/tuple.rs b/src/libcore/tuple.rs index f9a14b1de50..c8cbd49aa89 100644 --- a/src/libcore/tuple.rs +++ b/src/libcore/tuple.rs @@ -28,9 +28,9 @@ //! //! * `Clone` //! * `PartialEq` -//! * `TotalEq` +//! * `Eq` //! * `PartialOrd` -//! * `TotalOrd` +//! * `Ord` //! * `Default` //! //! # Examples @@ -123,7 +123,7 @@ macro_rules! tuple_impls { } #[cfg(not(test))] - impl<$($T:TotalEq),+> TotalEq for ($($T,)+) {} + impl<$($T:Eq),+> Eq for ($($T,)+) {} #[cfg(not(test))] impl<$($T:PartialOrd + PartialEq),+> PartialOrd for ($($T,)+) { @@ -146,7 +146,7 @@ macro_rules! tuple_impls { } #[cfg(not(test))] - impl<$($T:TotalOrd),+> TotalOrd for ($($T,)+) { + impl<$($T:Ord),+> Ord for ($($T,)+) { #[inline] fn cmp(&self, other: &($($T,)+)) -> Ordering { lexical_cmp!($(self.$refN(), other.$refN()),+) @@ -364,7 +364,7 @@ mod tests { assert!(((1.0, 2.0) < (2.0, nan))); assert!(!((2.0, 2.0) < (2.0, nan))); - // TotalOrd + // Ord assert!(small.cmp(&small) == Equal); assert!(big.cmp(&big) == Equal); assert!(small.cmp(&big) == Less); diff --git a/src/libfmt_macros/lib.rs b/src/libfmt_macros/lib.rs index bcdeb2bf329..28adfa86ccf 100644 --- a/src/libfmt_macros/lib.rs +++ b/src/libfmt_macros/lib.rs @@ -146,7 +146,7 @@ pub enum Method<'a> { } /// A selector for what pluralization a plural method should take -#[deriving(PartialEq, TotalEq, Hash)] +#[deriving(PartialEq, Eq, Hash)] pub enum PluralSelector { /// One of the plural keywords should be used Keyword(PluralKeyword), @@ -168,7 +168,7 @@ pub struct PluralArm<'a> { /// is specially placed in the `Plural` variant of `Method`. /// /// http://www.icu-project.org/apiref/icu4c/classicu_1_1PluralRules.html -#[deriving(PartialEq, TotalEq, Hash, Show)] +#[deriving(PartialEq, Eq, Hash, Show)] #[allow(missing_doc)] pub enum PluralKeyword { /// The plural form for zero objects. diff --git a/src/libglob/lib.rs b/src/libglob/lib.rs index 8db8f0dac10..86753fbb811 100644 --- a/src/libglob/lib.rs +++ b/src/libglob/lib.rs @@ -198,12 +198,12 @@ fn list_dir_sorted(path: &Path) -> Option> { /** * A compiled Unix shell style pattern. */ -#[deriving(Clone, PartialEq, TotalEq, PartialOrd, TotalOrd, Hash, Default)] +#[deriving(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] pub struct Pattern { tokens: Vec, } -#[deriving(Clone, PartialEq, TotalEq, PartialOrd, TotalOrd, Hash)] +#[deriving(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] enum PatternToken { Char(char), AnyChar, @@ -212,7 +212,7 @@ enum PatternToken { AnyExcept(Vec ) } -#[deriving(Clone, PartialEq, TotalEq, PartialOrd, TotalOrd, Hash)] +#[deriving(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] enum CharSpecifier { SingleChar(char), CharRange(char, char) @@ -596,7 +596,7 @@ fn chars_eq(a: char, b: char, case_sensitive: bool) -> bool { /** * Configuration options to modify the behaviour of `Pattern::matches_with(..)` */ -#[deriving(Clone, PartialEq, TotalEq, PartialOrd, TotalOrd, Hash, Default)] +#[deriving(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] pub struct MatchOptions { /** diff --git a/src/libnum/bigint.rs b/src/libnum/bigint.rs index 9264cb541a9..4a848535b8d 100644 --- a/src/libnum/bigint.rs +++ b/src/libnum/bigint.rs @@ -89,7 +89,7 @@ impl PartialEq for BigUint { match self.cmp(other) { Equal => true, _ => false } } } -impl TotalEq for BigUint {} +impl Eq for BigUint {} impl PartialOrd for BigUint { #[inline] @@ -98,7 +98,7 @@ impl PartialOrd for BigUint { } } -impl TotalOrd for BigUint { +impl Ord for BigUint { #[inline] fn cmp(&self, other: &BigUint) -> Ordering { let (s_len, o_len) = (self.data.len(), other.data.len()); @@ -786,7 +786,7 @@ fn get_radix_base(radix: uint) -> (DoubleBigDigit, uint) { } /// A Sign is a `BigInt`'s composing element. -#[deriving(PartialEq, PartialOrd, TotalEq, TotalOrd, Clone, Show)] +#[deriving(PartialEq, PartialOrd, Eq, Ord, Clone, Show)] pub enum Sign { Minus, Zero, Plus } impl Neg for Sign { @@ -815,7 +815,7 @@ impl PartialEq for BigInt { } } -impl TotalEq for BigInt {} +impl Eq for BigInt {} impl PartialOrd for BigInt { #[inline] @@ -824,7 +824,7 @@ impl PartialOrd for BigInt { } } -impl TotalOrd for BigInt { +impl Ord for BigInt { #[inline] fn cmp(&self, other: &BigInt) -> Ordering { let scmp = self.sign.cmp(&other.sign); diff --git a/src/libnum/rational.rs b/src/libnum/rational.rs index 71a23a23a26..3efc359fd3f 100644 --- a/src/libnum/rational.rs +++ b/src/libnum/rational.rs @@ -194,8 +194,8 @@ macro_rules! cmp_impl { } cmp_impl!(impl PartialEq, eq, ne) cmp_impl!(impl PartialOrd, lt, gt, le, ge) -cmp_impl!(impl TotalEq, ) -cmp_impl!(impl TotalOrd, cmp -> cmp::Ordering) +cmp_impl!(impl Eq, ) +cmp_impl!(impl Ord, cmp -> cmp::Ordering) /* Arithmetic */ // a/b * c/d = (a*c)/(b*d) diff --git a/src/librustc/back/link.rs b/src/librustc/back/link.rs index 95c08d6a41e..546182aac34 100644 --- a/src/librustc/back/link.rs +++ b/src/librustc/back/link.rs @@ -45,7 +45,7 @@ use syntax::attr::AttrMetaMethods; use syntax::crateid::CrateId; use syntax::parse::token; -#[deriving(Clone, PartialEq, PartialOrd, TotalOrd, TotalEq)] +#[deriving(Clone, PartialEq, PartialOrd, Ord, Eq)] pub enum OutputType { OutputTypeBitcode, OutputTypeAssembly, diff --git a/src/librustc/driver/config.rs b/src/librustc/driver/config.rs index db934c7a404..e22de8d235c 100644 --- a/src/librustc/driver/config.rs +++ b/src/librustc/driver/config.rs @@ -132,7 +132,7 @@ pub enum EntryFnType { EntryNone, } -#[deriving(PartialEq, PartialOrd, Clone, TotalOrd, TotalEq, Hash)] +#[deriving(PartialEq, PartialOrd, Clone, Ord, Eq, Hash)] pub enum CrateType { CrateTypeExecutable, CrateTypeDylib, diff --git a/src/librustc/middle/borrowck/mod.rs b/src/librustc/middle/borrowck/mod.rs index c1f8ea4d00c..ce111d3ae29 100644 --- a/src/librustc/middle/borrowck/mod.rs +++ b/src/librustc/middle/borrowck/mod.rs @@ -188,13 +188,13 @@ pub struct Loan { cause: euv::LoanCause, } -#[deriving(PartialEq, TotalEq, Hash)] +#[deriving(PartialEq, Eq, Hash)] pub enum LoanPath { LpVar(ast::NodeId), // `x` in doc.rs LpExtend(Rc, mc::MutabilityCategory, LoanPathElem) } -#[deriving(PartialEq, TotalEq, Hash)] +#[deriving(PartialEq, Eq, Hash)] pub enum LoanPathElem { LpDeref(mc::PointerKind), // `*LV` in doc.rs LpInterior(mc::InteriorKind) // `LV.f` in doc.rs diff --git a/src/librustc/middle/lang_items.rs b/src/librustc/middle/lang_items.rs index d5bd44fd27c..c3fcf037b26 100644 --- a/src/librustc/middle/lang_items.rs +++ b/src/librustc/middle/lang_items.rs @@ -42,7 +42,7 @@ macro_rules! lets_do_this { $( $variant:ident, $name:expr, $method:ident; )* ) => { -#[deriving(FromPrimitive, PartialEq, TotalEq, Hash)] +#[deriving(FromPrimitive, PartialEq, Eq, Hash)] pub enum LangItem { $($variant),* } diff --git a/src/librustc/middle/lint.rs b/src/librustc/middle/lint.rs index 6cffd15487d..a195e23e6ba 100644 --- a/src/librustc/middle/lint.rs +++ b/src/librustc/middle/lint.rs @@ -72,7 +72,7 @@ use syntax::parse::token; use syntax::visit::Visitor; use syntax::{ast, ast_util, visit}; -#[deriving(Clone, Show, PartialEq, PartialOrd, TotalEq, TotalOrd, Hash)] +#[deriving(Clone, Show, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum Lint { CTypes, UnusedImports, @@ -135,12 +135,12 @@ pub fn level_to_str(lv: Level) -> &'static str { } } -#[deriving(Clone, PartialEq, PartialOrd, TotalEq, TotalOrd)] +#[deriving(Clone, PartialEq, PartialOrd, Eq, Ord)] pub enum Level { Allow, Warn, Deny, Forbid } -#[deriving(Clone, PartialEq, PartialOrd, TotalEq, TotalOrd)] +#[deriving(Clone, PartialEq, PartialOrd, Eq, Ord)] pub struct LintSpec { pub default: Level, pub lint: Lint, diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs index c8cad58a191..e6b48f02483 100644 --- a/src/librustc/middle/mem_categorization.rs +++ b/src/librustc/middle/mem_categorization.rs @@ -99,7 +99,7 @@ pub struct CopiedUpvar { } // different kinds of pointers: -#[deriving(Clone, PartialEq, TotalEq, Hash)] +#[deriving(Clone, PartialEq, Eq, Hash)] pub enum PointerKind { OwnedPtr, GcPtr, @@ -109,26 +109,26 @@ pub enum PointerKind { // We use the term "interior" to mean "something reachable from the // base without a pointer dereference", e.g. a field -#[deriving(Clone, PartialEq, TotalEq, Hash)] +#[deriving(Clone, PartialEq, Eq, Hash)] pub enum InteriorKind { InteriorField(FieldName), InteriorElement(ElementKind), } -#[deriving(Clone, PartialEq, TotalEq, Hash)] +#[deriving(Clone, PartialEq, Eq, Hash)] pub enum FieldName { NamedField(ast::Name), PositionalField(uint) } -#[deriving(Clone, PartialEq, TotalEq, Hash)] +#[deriving(Clone, PartialEq, Eq, Hash)] pub enum ElementKind { VecElement, StrElement, OtherElement, } -#[deriving(Clone, PartialEq, TotalEq, Hash, Show)] +#[deriving(Clone, PartialEq, Eq, Hash, Show)] pub enum MutabilityCategory { McImmutable, // Immutable. McDeclared, // Directly declared as mutable. diff --git a/src/librustc/middle/resolve.rs b/src/librustc/middle/resolve.rs index 4db791ddf7b..f50a2090c23 100644 --- a/src/librustc/middle/resolve.rs +++ b/src/librustc/middle/resolve.rs @@ -109,7 +109,7 @@ enum PatternBindingMode { ArgumentIrrefutableMode, } -#[deriving(PartialEq, TotalEq, Hash)] +#[deriving(PartialEq, Eq, Hash)] enum Namespace { TypeNS, ValueNS diff --git a/src/librustc/middle/trans/datum.rs b/src/librustc/middle/trans/datum.rs index 1ea25665c1c..1142b67fdbf 100644 --- a/src/librustc/middle/trans/datum.rs +++ b/src/librustc/middle/trans/datum.rs @@ -82,7 +82,7 @@ impl Drop for Rvalue { fn drop(&mut self) { } } -#[deriving(PartialEq, TotalEq, Hash)] +#[deriving(PartialEq, Eq, Hash)] pub enum RvalueMode { /// `val` is a pointer to the actual value (and thus has type *T) ByRef, diff --git a/src/librustc/middle/trans/monomorphize.rs b/src/librustc/middle/trans/monomorphize.rs index 683fb39c9e9..913f333b0f3 100644 --- a/src/librustc/middle/trans/monomorphize.rs +++ b/src/librustc/middle/trans/monomorphize.rs @@ -312,14 +312,14 @@ pub fn monomorphic_fn(ccx: &CrateContext, } // Used to identify cached monomorphized functions and vtables -#[deriving(PartialEq, TotalEq, Hash)] +#[deriving(PartialEq, Eq, Hash)] pub struct MonoParamId { pub subst: ty::t, // Do we really need the vtables to be hashed? Isn't the type enough? pub vtables: Vec } -#[deriving(PartialEq, TotalEq, Hash)] +#[deriving(PartialEq, Eq, Hash)] pub struct MonoId { pub def: ast::DefId, pub params: Vec diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index 7d3c4beb674..1ee7ddb5483 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -65,7 +65,7 @@ pub static INITIAL_DISCRIMINANT_VALUE: Disr = 0; // Data types -#[deriving(PartialEq, TotalEq, Hash)] +#[deriving(PartialEq, Eq, Hash)] pub struct field { pub ident: ast::Ident, pub mt: mt @@ -121,13 +121,13 @@ impl Method { } } -#[deriving(Clone, PartialEq, TotalEq, Hash)] +#[deriving(Clone, PartialEq, Eq, Hash)] pub struct mt { pub ty: t, pub mutbl: ast::Mutability, } -#[deriving(Clone, PartialEq, TotalEq, Hash, Encodable, Decodable, Show)] +#[deriving(Clone, PartialEq, Eq, Hash, Encodable, Decodable, Show)] pub enum TraitStore { /// Box UniqTraitStore, @@ -145,7 +145,7 @@ pub struct field_ty { // Contains information needed to resolve types and (in the future) look up // the types of AST nodes. -#[deriving(PartialEq, TotalEq, Hash)] +#[deriving(PartialEq, Eq, Hash)] pub struct creader_cache_key { pub cnum: CrateNum, pub pos: uint, @@ -172,7 +172,7 @@ impl cmp::PartialEq for intern_key { } } -impl TotalEq for intern_key {} +impl Eq for intern_key {} impl Hash for intern_key { fn hash(&self, s: &mut W) { @@ -387,7 +387,7 @@ pub struct t_box_ { enum t_opaque {} #[allow(raw_pointer_deriving)] -#[deriving(Clone, PartialEq, TotalEq, Hash)] +#[deriving(Clone, PartialEq, Eq, Hash)] pub struct t { inner: *t_opaque } impl fmt::Show for t { @@ -415,14 +415,14 @@ pub fn type_needs_infer(t: t) -> bool { } pub fn type_id(t: t) -> uint { get(t).id } -#[deriving(Clone, PartialEq, TotalEq, Hash)] +#[deriving(Clone, PartialEq, Eq, Hash)] pub struct BareFnTy { pub fn_style: ast::FnStyle, pub abi: abi::Abi, pub sig: FnSig, } -#[deriving(Clone, PartialEq, TotalEq, Hash)] +#[deriving(Clone, PartialEq, Eq, Hash)] pub struct ClosureTy { pub fn_style: ast::FnStyle, pub onceness: ast::Onceness, @@ -443,7 +443,7 @@ pub struct ClosureTy { * - `output` is the return type. * - `variadic` indicates whether this is a varidic function. (only true for foreign fns) */ -#[deriving(Clone, PartialEq, TotalEq, Hash)] +#[deriving(Clone, PartialEq, Eq, Hash)] pub struct FnSig { pub binder_id: ast::NodeId, pub inputs: Vec, @@ -451,14 +451,14 @@ pub struct FnSig { pub variadic: bool } -#[deriving(Clone, PartialEq, TotalEq, Hash)] +#[deriving(Clone, PartialEq, Eq, Hash)] pub struct param_ty { pub idx: uint, pub def_id: DefId } /// Representation of regions: -#[deriving(Clone, PartialEq, TotalEq, Hash, Encodable, Decodable, Show)] +#[deriving(Clone, PartialEq, Eq, Hash, Encodable, Decodable, Show)] pub enum Region { // Region bound in a type or fn declaration which will be // substituted 'early' -- that is, at the same time when type @@ -499,13 +499,13 @@ pub enum Region { * the original var id (that is, the root variable that is referenced * by the upvar) and the id of the closure expression. */ -#[deriving(Clone, PartialEq, TotalEq, Hash)] +#[deriving(Clone, PartialEq, Eq, Hash)] pub struct UpvarId { pub var_id: ast::NodeId, pub closure_expr_id: ast::NodeId, } -#[deriving(Clone, PartialEq, TotalEq, Hash, Show)] +#[deriving(Clone, PartialEq, Eq, Hash, Show)] pub enum BorrowKind { /// Data must be immutable and is aliasable. ImmBorrow, @@ -618,13 +618,13 @@ impl Region { } } -#[deriving(Clone, PartialEq, PartialOrd, TotalEq, TotalOrd, Hash, Encodable, Decodable, Show)] +#[deriving(Clone, PartialEq, PartialOrd, Eq, Ord, Hash, Encodable, Decodable, Show)] pub struct FreeRegion { pub scope_id: NodeId, pub bound_region: BoundRegion } -#[deriving(Clone, PartialEq, PartialOrd, TotalEq, TotalOrd, Hash, Encodable, Decodable, Show)] +#[deriving(Clone, PartialEq, PartialOrd, Eq, Ord, Hash, Encodable, Decodable, Show)] pub enum BoundRegion { /// An anonymous region parameter for a given fn (&T) BrAnon(uint), @@ -643,7 +643,7 @@ pub enum BoundRegion { * Represents the values to use when substituting lifetime parameters. * If the value is `ErasedRegions`, then this subst is occurring during * trans, and all region parameters will be replaced with `ty::ReStatic`. */ -#[deriving(Clone, PartialEq, TotalEq, Hash)] +#[deriving(Clone, PartialEq, Eq, Hash)] pub enum RegionSubsts { ErasedRegions, NonerasedRegions(OwnedSlice) @@ -666,7 +666,7 @@ pub enum RegionSubsts { * - `self_ty` is the type to which `self` should be remapped, if any. The * `self` type is rather funny in that it can only appear on traits and is * always substituted away to the implementing type for a trait. */ -#[deriving(Clone, PartialEq, TotalEq, Hash)] +#[deriving(Clone, PartialEq, Eq, Hash)] pub struct substs { pub self_ty: Option, pub tps: Vec, @@ -722,7 +722,7 @@ mod primitives { // NB: If you change this, you'll probably want to change the corresponding // AST structure in libsyntax/ast.rs as well. -#[deriving(Clone, PartialEq, TotalEq, Hash)] +#[deriving(Clone, PartialEq, Eq, Hash)] pub enum sty { ty_nil, ty_bot, @@ -754,7 +754,7 @@ pub enum sty { // on non-useful type error messages) } -#[deriving(Clone, PartialEq, TotalEq, Hash)] +#[deriving(Clone, PartialEq, Eq, Hash)] pub struct TyTrait { pub def_id: DefId, pub substs: substs, @@ -762,7 +762,7 @@ pub struct TyTrait { pub bounds: BuiltinBounds } -#[deriving(PartialEq, TotalEq, Hash)] +#[deriving(PartialEq, Eq, Hash)] pub struct TraitRef { pub def_id: DefId, pub substs: substs @@ -822,7 +822,7 @@ pub enum type_err { terr_variadic_mismatch(expected_found) } -#[deriving(PartialEq, TotalEq, Hash)] +#[deriving(PartialEq, Eq, Hash)] pub struct ParamBounds { pub builtin_bounds: BuiltinBounds, pub trait_bounds: Vec> @@ -830,7 +830,7 @@ pub struct ParamBounds { pub type BuiltinBounds = EnumSet; -#[deriving(Clone, Encodable, PartialEq, TotalEq, Decodable, Hash, Show)] +#[deriving(Clone, Encodable, PartialEq, Eq, Decodable, Hash, Show)] #[repr(uint)] pub enum BuiltinBound { BoundStatic, @@ -862,28 +862,28 @@ impl CLike for BuiltinBound { } } -#[deriving(Clone, PartialEq, TotalEq, Hash)] +#[deriving(Clone, PartialEq, Eq, Hash)] pub struct TyVid(pub uint); -#[deriving(Clone, PartialEq, TotalEq, Hash)] +#[deriving(Clone, PartialEq, Eq, Hash)] pub struct IntVid(pub uint); -#[deriving(Clone, PartialEq, TotalEq, Hash)] +#[deriving(Clone, PartialEq, Eq, Hash)] pub struct FloatVid(pub uint); -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub struct RegionVid { pub id: uint } -#[deriving(Clone, PartialEq, TotalEq, Hash)] +#[deriving(Clone, PartialEq, Eq, Hash)] pub enum InferTy { TyVar(TyVid), IntVar(IntVid), FloatVar(FloatVid) } -#[deriving(Clone, Encodable, Decodable, TotalEq, Hash, Show)] +#[deriving(Clone, Encodable, Decodable, Eq, Hash, Show)] pub enum InferRegion { ReVar(RegionVid), ReSkolemized(uint, BoundRegion) diff --git a/src/librustc/middle/typeck/infer/region_inference/mod.rs b/src/librustc/middle/typeck/infer/region_inference/mod.rs index 8ec4b52ffd1..db551923622 100644 --- a/src/librustc/middle/typeck/infer/region_inference/mod.rs +++ b/src/librustc/middle/typeck/infer/region_inference/mod.rs @@ -31,7 +31,7 @@ use syntax::ast; mod doc; -#[deriving(PartialEq, TotalEq, Hash)] +#[deriving(PartialEq, Eq, Hash)] pub enum Constraint { ConstrainVarSubVar(RegionVid, RegionVid), ConstrainRegSubVar(Region, RegionVid), @@ -39,7 +39,7 @@ pub enum Constraint { ConstrainRegSubReg(Region, Region), } -#[deriving(PartialEq, TotalEq, Hash)] +#[deriving(PartialEq, Eq, Hash)] pub struct TwoRegions { a: Region, b: Region, diff --git a/src/librustc/middle/typeck/mod.rs b/src/librustc/middle/typeck/mod.rs index 156479dc7a3..b3cabbfb7e2 100644 --- a/src/librustc/middle/typeck/mod.rs +++ b/src/librustc/middle/typeck/mod.rs @@ -147,7 +147,7 @@ pub struct MethodCallee { pub substs: ty::substs } -#[deriving(Clone, PartialEq, TotalEq, Hash, Show)] +#[deriving(Clone, PartialEq, Eq, Hash, Show)] pub struct MethodCall { pub expr_id: ast::NodeId, pub autoderef: u32 diff --git a/src/librustc/util/nodemap.rs b/src/librustc/util/nodemap.rs index 7d7d5d16d74..06454adfb86 100644 --- a/src/librustc/util/nodemap.rs +++ b/src/librustc/util/nodemap.rs @@ -28,14 +28,14 @@ pub type DefIdSet = FnvHashSet; pub mod FnvHashMap { use std::hash::Hash; use collections::HashMap; - pub fn new + TotalEq, V>() -> super::FnvHashMap { + pub fn new + Eq, V>() -> super::FnvHashMap { HashMap::with_hasher(super::FnvHasher) } } pub mod FnvHashSet { use std::hash::Hash; use collections::HashSet; - pub fn new + TotalEq>() -> super::FnvHashSet { + pub fn new + Eq>() -> super::FnvHashSet { HashSet::with_hasher(super::FnvHasher) } } diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 856619882c5..35f1a89e871 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -1028,7 +1028,7 @@ pub enum Type { // region, raw, other boxes, mutable } -#[deriving(Clone, Encodable, Decodable, PartialEq, TotalEq, Hash)] +#[deriving(Clone, Encodable, Decodable, PartialEq, Eq, Hash)] pub enum Primitive { Int, I8, I16, I32, I64, Uint, U8, U16, U32, U64, diff --git a/src/libserialize/collection_impls.rs b/src/libserialize/collection_impls.rs index 7ca0f372891..04cd861d687 100644 --- a/src/libserialize/collection_impls.rs +++ b/src/libserialize/collection_impls.rs @@ -76,7 +76,7 @@ impl,T:Decodable> Decodable for RingBuf { impl< E, S: Encoder, - K: Encodable + PartialEq + TotalOrd, + K: Encodable + PartialEq + Ord, V: Encodable + PartialEq > Encodable for TreeMap { fn encode(&self, e: &mut S) -> Result<(), E> { @@ -95,7 +95,7 @@ impl< impl< E, D: Decoder, - K: Decodable + PartialEq + TotalOrd, + K: Decodable + PartialEq + Ord, V: Decodable + PartialEq > Decodable for TreeMap { fn decode(d: &mut D) -> Result, E> { @@ -114,7 +114,7 @@ impl< impl< E, S: Encoder, - T: Encodable + PartialEq + TotalOrd + T: Encodable + PartialEq + Ord > Encodable for TreeSet { fn encode(&self, s: &mut S) -> Result<(), E> { s.emit_seq(self.len(), |s| { @@ -131,7 +131,7 @@ impl< impl< E, D: Decoder, - T: Decodable + PartialEq + TotalOrd + T: Decodable + PartialEq + Ord > Decodable for TreeSet { fn decode(d: &mut D) -> Result, E> { d.read_seq(|d, len| { @@ -178,7 +178,7 @@ impl< impl< E, S: Encoder, - K: Encodable + Hash + TotalEq, + K: Encodable + Hash + Eq, V: Encodable, X, H: Hasher @@ -199,7 +199,7 @@ impl< impl< E, D: Decoder, - K: Decodable + Hash + TotalEq, + K: Decodable + Hash + Eq, V: Decodable, S, H: Hasher + Default @@ -221,7 +221,7 @@ impl< impl< E, S: Encoder, - T: Encodable + Hash + TotalEq, + T: Encodable + Hash + Eq, X, H: Hasher > Encodable for HashSet { @@ -240,7 +240,7 @@ impl< impl< E, D: Decoder, - T: Decodable + Hash + TotalEq, + T: Decodable + Hash + Eq, S, H: Hasher + Default > Decodable for HashSet { diff --git a/src/libstd/ascii.rs b/src/libstd/ascii.rs index 222297aaf0e..e9bb23a75c8 100644 --- a/src/libstd/ascii.rs +++ b/src/libstd/ascii.rs @@ -23,7 +23,7 @@ use to_str::{IntoStr}; use vec::Vec; /// Datatype to hold one ascii character. It wraps a `u8`, with the highest bit always zero. -#[deriving(Clone, PartialEq, PartialOrd, TotalOrd, TotalEq, Hash)] +#[deriving(Clone, PartialEq, PartialOrd, Ord, Eq, Hash)] pub struct Ascii { chr: u8 } impl Ascii { diff --git a/src/libstd/bitflags.rs b/src/libstd/bitflags.rs index eb8c7e7d283..7d821983075 100644 --- a/src/libstd/bitflags.rs +++ b/src/libstd/bitflags.rs @@ -112,7 +112,7 @@ macro_rules! bitflags( ($(#[$attr:meta])* flags $BitFlags:ident: $T:ty { $($(#[$Flag_attr:meta])* static $Flag:ident = $value:expr),+ }) => ( - #[deriving(PartialEq, TotalEq, Clone)] + #[deriving(PartialEq, Eq, Clone)] $(#[$attr])* pub struct $BitFlags { bits: $T, diff --git a/src/libstd/io/net/ip.rs b/src/libstd/io/net/ip.rs index 4d0e5e7f72d..bdc4b6071fa 100644 --- a/src/libstd/io/net/ip.rs +++ b/src/libstd/io/net/ip.rs @@ -25,7 +25,7 @@ use slice::{MutableCloneableVector, ImmutableVector, MutableVector}; pub type Port = u16; -#[deriving(PartialEq, TotalEq, Clone, Hash)] +#[deriving(PartialEq, Eq, Clone, Hash)] pub enum IpAddr { Ipv4Addr(u8, u8, u8, u8), Ipv6Addr(u16, u16, u16, u16, u16, u16, u16, u16) @@ -56,7 +56,7 @@ impl fmt::Show for IpAddr { } } -#[deriving(PartialEq, TotalEq, Clone, Hash)] +#[deriving(PartialEq, Eq, Clone, Hash)] pub struct SocketAddr { pub ip: IpAddr, pub port: Port, diff --git a/src/libstd/io/process.rs b/src/libstd/io/process.rs index 8325ee4ccd9..1ed46593562 100644 --- a/src/libstd/io/process.rs +++ b/src/libstd/io/process.rs @@ -317,7 +317,7 @@ impl fmt::Show for Command { } /// The output of a finished process. -#[deriving(PartialEq, TotalEq, Clone)] +#[deriving(PartialEq, Eq, Clone)] pub struct ProcessOutput { /// The status (exit code) of the process. pub status: ProcessExit, @@ -348,7 +348,7 @@ pub enum StdioContainer { /// Describes the result of a process after it has terminated. /// Note that Windows have no signals, so the result is usually ExitStatus. -#[deriving(PartialEq, TotalEq, Clone)] +#[deriving(PartialEq, Eq, Clone)] pub enum ProcessExit { /// Normal termination with an exit status. ExitStatus(int), diff --git a/src/libstd/path/posix.rs b/src/libstd/path/posix.rs index fbecbd7665b..a6bbf22b401 100644 --- a/src/libstd/path/posix.rs +++ b/src/libstd/path/posix.rs @@ -13,7 +13,7 @@ use container::Container; use c_str::{CString, ToCStr}; use clone::Clone; -use cmp::{PartialEq, TotalEq}; +use cmp::{PartialEq, Eq}; use from_str::FromStr; use io::Writer; use iter::{DoubleEndedIterator, AdditiveIterator, Extendable, Iterator, Map}; @@ -65,7 +65,7 @@ impl PartialEq for Path { } } -impl TotalEq for Path {} +impl Eq for Path {} impl FromStr for Path { fn from_str(s: &str) -> Option { diff --git a/src/libstd/path/windows.rs b/src/libstd/path/windows.rs index d46a373de4d..865e53cbe38 100644 --- a/src/libstd/path/windows.rs +++ b/src/libstd/path/windows.rs @@ -13,7 +13,7 @@ use ascii::AsciiCast; use c_str::{CString, ToCStr}; use clone::Clone; -use cmp::{PartialEq, TotalEq}; +use cmp::{PartialEq, Eq}; use container::Container; use from_str::FromStr; use io::Writer; @@ -86,7 +86,7 @@ impl PartialEq for Path { } } -impl TotalEq for Path {} +impl Eq for Path {} impl FromStr for Path { fn from_str(s: &str) -> Option { diff --git a/src/libstd/prelude.rs b/src/libstd/prelude.rs index ac1aaa2c6ca..cce2cce0d6e 100644 --- a/src/libstd/prelude.rs +++ b/src/libstd/prelude.rs @@ -58,7 +58,7 @@ #[doc(no_inline)] pub use c_str::ToCStr; #[doc(no_inline)] pub use char::Char; #[doc(no_inline)] pub use clone::Clone; -#[doc(no_inline)] pub use cmp::{PartialEq, PartialOrd, TotalEq, TotalOrd}; +#[doc(no_inline)] pub use cmp::{PartialEq, PartialOrd, Eq, Ord}; #[doc(no_inline)] pub use cmp::{Ordering, Less, Equal, Greater, Equiv}; #[doc(no_inline)] pub use container::{Container, Mutable, Map, MutableMap}; #[doc(no_inline)] pub use container::{Set, MutableSet}; @@ -81,9 +81,9 @@ #[doc(no_inline)] pub use tuple::{Tuple5, Tuple6, Tuple7, Tuple8}; #[doc(no_inline)] pub use tuple::{Tuple9, Tuple10, Tuple11, Tuple12}; #[doc(no_inline)] pub use slice::{CloneableVector, ImmutableCloneableVector}; -#[doc(no_inline)] pub use slice::{MutableCloneableVector, MutableTotalOrdVector}; +#[doc(no_inline)] pub use slice::{MutableCloneableVector, MutableOrdVector}; #[doc(no_inline)] pub use slice::{ImmutableVector, MutableVector}; -#[doc(no_inline)] pub use slice::{ImmutableEqVector, ImmutableTotalOrdVector}; +#[doc(no_inline)] pub use slice::{ImmutableEqVector, ImmutableOrdVector}; #[doc(no_inline)] pub use slice::{Vector, VectorVector, OwnedVector}; #[doc(no_inline)] pub use slice::MutableVectorAllocating; #[doc(no_inline)] pub use string::String; diff --git a/src/libstd/slice.rs b/src/libstd/slice.rs index 430629a1f88..5753663dd87 100644 --- a/src/libstd/slice.rs +++ b/src/libstd/slice.rs @@ -65,7 +65,7 @@ Vectors are a very useful type, and so there's several implementations of traits from other modules. Some notable examples: * `Clone` -* `Eq`, `Ord`, `TotalEq`, `TotalOrd` -- vectors can be compared, +* `Eq`, `Ord`, `Eq`, `Ord` -- vectors can be compared, if the element type defines the corresponding trait. ## Iteration @@ -101,7 +101,7 @@ There are a number of free functions that create or take vectors, for example: use mem::transmute; use clone::Clone; -use cmp::{TotalOrd, Ordering, Less, Greater}; +use cmp::{Ord, Ordering, Less, Greater}; use cmp; use container::Container; use iter::*; @@ -117,7 +117,7 @@ use vec::Vec; pub use core::slice::{ref_slice, mut_ref_slice, Splits, Windows}; pub use core::slice::{Chunks, Vector, ImmutableVector, ImmutableEqVector}; -pub use core::slice::{ImmutableTotalOrdVector, MutableVector, Items, MutItems}; +pub use core::slice::{ImmutableOrdVector, MutableVector, Items, MutItems}; pub use core::slice::{MutSplits, MutChunks}; pub use core::slice::{bytes, MutableCloneableVector}; @@ -698,7 +698,7 @@ impl<'a,T> MutableVectorAllocating<'a, T> for &'a mut [T] { /// Methods for mutable vectors with orderable elements, such as /// in-place sorting. -pub trait MutableTotalOrdVector { +pub trait MutableOrdVector { /// Sort the vector, in place. /// /// This is equivalent to `self.sort_by(|a, b| a.cmp(b))`. @@ -714,7 +714,7 @@ pub trait MutableTotalOrdVector { fn sort(self); } -impl<'a, T: TotalOrd> MutableTotalOrdVector for &'a mut [T] { +impl<'a, T: Ord> MutableOrdVector for &'a mut [T] { #[inline] fn sort(self) { self.sort_by(|a,b| a.cmp(b)) diff --git a/src/libstd/str.rs b/src/libstd/str.rs index 11b9d0e85ff..3af3821486f 100644 --- a/src/libstd/str.rs +++ b/src/libstd/str.rs @@ -70,7 +70,7 @@ is the same as `&[u8]`. use char::Char; use char; use clone::Clone; -use cmp::{PartialEq, TotalEq, PartialOrd, TotalOrd, Equiv, Ordering}; +use cmp::{PartialEq, Eq, PartialOrd, Ord, Equiv, Ordering}; use container::Container; use default::Default; use fmt; @@ -575,7 +575,7 @@ impl<'a> PartialEq for MaybeOwned<'a> { } } -impl<'a> TotalEq for MaybeOwned<'a> {} +impl<'a> Eq for MaybeOwned<'a> {} impl<'a> PartialOrd for MaybeOwned<'a> { #[inline] @@ -584,7 +584,7 @@ impl<'a> PartialOrd for MaybeOwned<'a> { } } -impl<'a> TotalOrd for MaybeOwned<'a> { +impl<'a> Ord for MaybeOwned<'a> { #[inline] fn cmp(&self, other: &MaybeOwned) -> Ordering { self.as_slice().cmp(&other.as_slice()) diff --git a/src/libstd/string.rs b/src/libstd/string.rs index 29d3c718682..80973bb5328 100644 --- a/src/libstd/string.rs +++ b/src/libstd/string.rs @@ -30,7 +30,7 @@ use str; use vec::Vec; /// A growable string stored as a UTF-8 encoded buffer. -#[deriving(Clone, PartialEq, PartialOrd, TotalEq, TotalOrd)] +#[deriving(Clone, PartialEq, PartialOrd, Eq, Ord)] pub struct String { vec: Vec, } diff --git a/src/libstd/vec.rs b/src/libstd/vec.rs index 3cac6fadb94..916ba083b3e 100644 --- a/src/libstd/vec.rs +++ b/src/libstd/vec.rs @@ -12,7 +12,7 @@ use RawVec = raw::Vec; use clone::Clone; -use cmp::{PartialOrd, PartialEq, Ordering, TotalEq, TotalOrd, max}; +use cmp::{PartialOrd, PartialEq, Ordering, Eq, Ord, max}; use container::{Container, Mutable}; use default::Default; use fmt; @@ -27,7 +27,7 @@ use ptr; use raw::Slice; use rt::heap::{allocate, reallocate, deallocate}; use slice::{ImmutableEqVector, ImmutableVector, Items, MutItems, MutableVector}; -use slice::{MutableTotalOrdVector, OwnedVector, Vector}; +use slice::{MutableOrdVector, OwnedVector, Vector}; use slice::{MutableVectorAllocating}; /// An owned, growable vector. @@ -388,9 +388,9 @@ impl PartialOrd for Vec { } } -impl TotalEq for Vec {} +impl Eq for Vec {} -impl TotalOrd for Vec { +impl Ord for Vec { #[inline] fn cmp(&self, other: &Vec) -> Ordering { self.as_slice().cmp(&other.as_slice()) @@ -1263,7 +1263,7 @@ impl Vec { } } -impl Vec { +impl Vec { /// Sorts the vector in place. /// /// This sort is `O(n log n)` worst-case and stable, but allocates diff --git a/src/libsyntax/abi.rs b/src/libsyntax/abi.rs index e61c1c24c2f..cfe85995df6 100644 --- a/src/libsyntax/abi.rs +++ b/src/libsyntax/abi.rs @@ -13,7 +13,7 @@ use std::fmt; #[deriving(PartialEq)] pub enum Os { OsWin32, OsMacos, OsLinux, OsAndroid, OsFreebsd, } -#[deriving(PartialEq, TotalEq, Hash, Encodable, Decodable, Clone)] +#[deriving(PartialEq, Eq, Hash, Encodable, Decodable, Clone)] pub enum Abi { // NB: This ordering MUST match the AbiDatas array below. // (This is ensured by the test indices_are_correct().) diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 5eb9308e443..9cbe7e0b5fc 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -39,7 +39,7 @@ pub fn P(value: T) -> P { // table) and a SyntaxContext to track renaming and // macro expansion per Flatt et al., "Macros // That Work Together" -#[deriving(Clone, Hash, PartialOrd, TotalEq, TotalOrd, Show)] +#[deriving(Clone, Hash, PartialOrd, Eq, Ord, Show)] pub struct Ident { pub name: Name, pub ctxt: SyntaxContext @@ -114,7 +114,7 @@ impl, E> Decodable for Ident { /// Function name (not all functions have names) pub type FnIdent = Option; -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub struct Lifetime { pub id: NodeId, pub span: Span, @@ -125,7 +125,7 @@ pub struct Lifetime { // for instance: std::cmp::PartialEq . It's represented // as a sequence of identifiers, along with a bunch // of supporting information. -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub struct Path { pub span: Span, /// A `::foo` path, is relative to the crate root rather than current @@ -137,7 +137,7 @@ pub struct Path { /// A segment of a path: an identifier, an optional lifetime, and a set of /// types. -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub struct PathSegment { /// The identifier portion of this path segment. pub identifier: Ident, @@ -151,7 +151,7 @@ pub type CrateNum = u32; pub type NodeId = u32; -#[deriving(Clone, TotalEq, TotalOrd, PartialOrd, PartialEq, Encodable, Decodable, Hash, Show)] +#[deriving(Clone, Eq, Ord, PartialOrd, PartialEq, Encodable, Decodable, Hash, Show)] pub struct DefId { pub krate: CrateNum, pub node: NodeId, @@ -171,14 +171,14 @@ pub static DUMMY_NODE_ID: NodeId = -1; // typeck::collect::compute_bounds matches these against // the "special" built-in traits (see middle::lang_items) and // detects Copy, Send and Share. -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub enum TyParamBound { TraitTyParamBound(TraitRef), StaticRegionTyParamBound, OtherRegionTyParamBound(Span) // FIXME -- just here until work for #5723 lands } -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub struct TyParam { pub ident: Ident, pub id: NodeId, @@ -188,7 +188,7 @@ pub struct TyParam { pub span: Span } -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub struct Generics { pub lifetimes: Vec, pub ty_params: OwnedSlice, @@ -206,13 +206,13 @@ impl Generics { } } -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub enum MethodProvenance { FromTrait(DefId), FromImpl(DefId), } -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub enum Def { DefFn(DefId, FnStyle), DefStaticMethod(/* method */ DefId, MethodProvenance, FnStyle), @@ -249,7 +249,7 @@ pub enum Def { DefMethod(DefId /* method */, Option /* trait */), } -#[deriving(Clone, PartialEq, TotalEq, Hash, Encodable, Decodable, Show)] +#[deriving(Clone, PartialEq, Eq, Hash, Encodable, Decodable, Show)] pub enum DefRegion { DefStaticRegion, DefEarlyBoundRegion(/* index */ uint, /* lifetime decl */ NodeId), @@ -261,7 +261,7 @@ pub enum DefRegion { // used to drive conditional compilation pub type CrateConfig = Vec<@MetaItem> ; -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub struct Crate { pub module: Mod, pub attrs: Vec, @@ -271,7 +271,7 @@ pub struct Crate { pub type MetaItem = Spanned; -#[deriving(Clone, Encodable, Decodable, TotalEq, Hash)] +#[deriving(Clone, Encodable, Decodable, Eq, Hash)] pub enum MetaItem_ { MetaWord(InternedString), MetaList(InternedString, Vec<@MetaItem> ), @@ -303,7 +303,7 @@ impl PartialEq for MetaItem_ { } } -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub struct Block { pub view_items: Vec, pub stmts: Vec<@Stmt>, @@ -313,26 +313,26 @@ pub struct Block { pub span: Span, } -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub struct Pat { pub id: NodeId, pub node: Pat_, pub span: Span, } -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub struct FieldPat { pub ident: Ident, pub pat: @Pat, } -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub enum BindingMode { BindByRef(Mutability), BindByValue(Mutability), } -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub enum Pat_ { PatWild, PatWildMulti, @@ -358,20 +358,20 @@ pub enum Pat_ { PatMac(Mac), } -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash, Show)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)] pub enum Mutability { MutMutable, MutImmutable, } -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub enum ExprVstore { ExprVstoreUniq, // ~[1,2,3,4] ExprVstoreSlice, // &[1,2,3,4] ExprVstoreMutSlice, // &mut [1,2,3,4] } -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub enum BinOp { BiAdd, BiSub, @@ -393,7 +393,7 @@ pub enum BinOp { BiGt, } -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub enum UnOp { UnBox, UnUniq, @@ -404,7 +404,7 @@ pub enum UnOp { pub type Stmt = Spanned; -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub enum Stmt_ { // could be an item or a local (let) binding: StmtDecl(@Decl, NodeId), @@ -421,7 +421,7 @@ pub enum Stmt_ { /// Where a local declaration came from: either a true `let ... = /// ...;`, or one desugared from the pattern of a for loop. -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub enum LocalSource { LocalLet, LocalFor, @@ -430,7 +430,7 @@ pub enum LocalSource { // FIXME (pending discussion of #1697, #2178...): local should really be // a refinement on pat. /// Local represents a `let` statement, e.g., `let : = ;` -#[deriving(PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(PartialEq, Eq, Encodable, Decodable, Hash)] pub struct Local { pub ty: P, pub pat: @Pat, @@ -442,7 +442,7 @@ pub struct Local { pub type Decl = Spanned; -#[deriving(PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(PartialEq, Eq, Encodable, Decodable, Hash)] pub enum Decl_ { // a local (let) binding: DeclLocal(@Local), @@ -450,7 +450,7 @@ pub enum Decl_ { DeclItem(@Item), } -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub struct Arm { pub attrs: Vec, pub pats: Vec<@Pat>, @@ -458,7 +458,7 @@ pub struct Arm { pub body: @Expr, } -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub struct Field { pub ident: SpannedIdent, pub expr: @Expr, @@ -467,26 +467,26 @@ pub struct Field { pub type SpannedIdent = Spanned; -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub enum BlockCheckMode { DefaultBlock, UnsafeBlock(UnsafeSource), } -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub enum UnsafeSource { CompilerGenerated, UserProvided, } -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub struct Expr { pub id: NodeId, pub node: Expr_, pub span: Span, } -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub enum Expr_ { ExprVstore(@Expr, ExprVstore), // First expr is the place; second expr is the value. @@ -555,7 +555,7 @@ pub enum Expr_ { // else knows what to do with them, so you'll probably get a syntax // error. // -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] #[doc="For macro invocations; parsing is delegated to the macro"] pub enum TokenTree { // a single token @@ -631,7 +631,7 @@ pub enum TokenTree { // pub type Matcher = Spanned; -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub enum Matcher_ { // match one token MatchTok(::parse::token::Token), @@ -648,12 +648,12 @@ pub type Mac = Spanned; // is being invoked, and the vector of token-trees contains the source // of the macro invocation. // There's only one flavor, now, so this could presumably be simplified. -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub enum Mac_ { MacInvocTT(Path, Vec , SyntaxContext), // new macro-invocation } -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub enum StrStyle { CookedStr, RawStr(uint) @@ -661,7 +661,7 @@ pub enum StrStyle { pub type Lit = Spanned; -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub enum Lit_ { LitStr(InternedString, StrStyle), LitBinary(Rc >), @@ -677,20 +677,20 @@ pub enum Lit_ { // NB: If you change this, you'll probably want to change the corresponding // type structure in middle/ty.rs as well. -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub struct MutTy { pub ty: P, pub mutbl: Mutability, } -#[deriving(PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(PartialEq, Eq, Encodable, Decodable, Hash)] pub struct TypeField { pub ident: Ident, pub mt: MutTy, pub span: Span, } -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub struct TypeMethod { pub ident: Ident, pub attrs: Vec, @@ -706,13 +706,13 @@ pub struct TypeMethod { // A trait method is either required (meaning it doesn't have an // implementation, just a signature) or provided (meaning it has a default // implementation). -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub enum TraitMethod { Required(TypeMethod), Provided(@Method), } -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub enum IntTy { TyI, TyI8, @@ -728,7 +728,7 @@ impl fmt::Show for IntTy { } } -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub enum UintTy { TyU, TyU8, @@ -744,7 +744,7 @@ impl fmt::Show for UintTy { } } -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub enum FloatTy { TyF32, TyF64, @@ -758,7 +758,7 @@ impl fmt::Show for FloatTy { } // NB PartialEq method appears below. -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub struct Ty { pub id: NodeId, pub node: Ty_, @@ -766,7 +766,7 @@ pub struct Ty { } // Not represented directly in the AST, referred to by name through a ty_path. -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub enum PrimTy { TyInt(IntTy), TyUint(UintTy), @@ -776,7 +776,7 @@ pub enum PrimTy { TyChar } -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub enum Onceness { Once, Many @@ -791,7 +791,7 @@ impl fmt::Show for Onceness { } } -#[deriving(PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(PartialEq, Eq, Encodable, Decodable, Hash)] pub struct ClosureTy { pub lifetimes: Vec, pub fn_style: FnStyle, @@ -804,7 +804,7 @@ pub struct ClosureTy { pub bounds: Option>, } -#[deriving(PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(PartialEq, Eq, Encodable, Decodable, Hash)] pub struct BareFnTy { pub fn_style: FnStyle, pub abi: Abi, @@ -812,7 +812,7 @@ pub struct BareFnTy { pub decl: P } -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub enum Ty_ { TyNil, TyBot, /* bottom type */ @@ -833,13 +833,13 @@ pub enum Ty_ { TyInfer, } -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub enum AsmDialect { AsmAtt, AsmIntel } -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub struct InlineAsm { pub asm: InternedString, pub asm_str_style: StrStyle, @@ -851,7 +851,7 @@ pub struct InlineAsm { pub dialect: AsmDialect } -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub struct Arg { pub ty: P, pub pat: @Pat, @@ -878,7 +878,7 @@ impl Arg { } } -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub struct FnDecl { pub inputs: Vec, pub output: P, @@ -886,7 +886,7 @@ pub struct FnDecl { pub variadic: bool } -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub enum FnStyle { UnsafeFn, // declared with "unsafe fn" NormalFn, // declared with "fn" @@ -901,14 +901,14 @@ impl fmt::Show for FnStyle { } } -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub enum RetStyle { NoReturn, // functions with return type _|_ that always // raise an error or exit (i.e. never return to the caller) Return, // everything else } -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub enum ExplicitSelf_ { SelfStatic, // no self SelfValue, // `self` @@ -918,7 +918,7 @@ pub enum ExplicitSelf_ { pub type ExplicitSelf = Spanned; -#[deriving(PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(PartialEq, Eq, Encodable, Decodable, Hash)] pub struct Method { pub ident: Ident, pub attrs: Vec, @@ -932,7 +932,7 @@ pub struct Method { pub vis: Visibility, } -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub struct Mod { /// A span from the first token past `{` to the last token until `}`. /// For `mod foo;`, the inner span ranges from the first token @@ -942,31 +942,31 @@ pub struct Mod { pub items: Vec<@Item>, } -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub struct ForeignMod { pub abi: Abi, pub view_items: Vec, pub items: Vec<@ForeignItem>, } -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub struct VariantArg { pub ty: P, pub id: NodeId, } -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub enum VariantKind { TupleVariantKind(Vec), StructVariantKind(@StructDef), } -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub struct EnumDef { pub variants: Vec>, } -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub struct Variant_ { pub name: Ident, pub attrs: Vec, @@ -978,7 +978,7 @@ pub struct Variant_ { pub type Variant = Spanned; -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub struct PathListIdent_ { pub name: Ident, pub id: NodeId, @@ -988,7 +988,7 @@ pub type PathListIdent = Spanned; pub type ViewPath = Spanned; -#[deriving(PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(PartialEq, Eq, Encodable, Decodable, Hash)] pub enum ViewPath_ { // quux = foo::bar::baz @@ -1005,7 +1005,7 @@ pub enum ViewPath_ { ViewPathList(Path, Vec , NodeId) } -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub struct ViewItem { pub node: ViewItem_, pub attrs: Vec, @@ -1013,7 +1013,7 @@ pub struct ViewItem { pub span: Span, } -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub enum ViewItem_ { // ident: name used to refer to this crate in the code // optional (InternedString,StrStyle): if present, this is a location @@ -1029,17 +1029,17 @@ pub type Attribute = Spanned; // Distinguishes between Attributes that decorate items and Attributes that // are contained as statements within items. These two cases need to be // distinguished for pretty-printing. -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub enum AttrStyle { AttrOuter, AttrInner, } -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub struct AttrId(pub uint); // doc-comments are promoted to attributes that have is_sugared_doc = true -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub struct Attribute_ { pub id: AttrId, pub style: AttrStyle, @@ -1054,13 +1054,13 @@ pub struct Attribute_ { If this impl is an ItemImpl, the impl_id is redundant (it could be the same as the impl's node id). */ -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub struct TraitRef { pub path: Path, pub ref_id: NodeId, } -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub enum Visibility { Public, Inherited, @@ -1075,13 +1075,13 @@ impl Visibility { } } -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub enum Sized { DynSize, StaticSize, } -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub struct StructField_ { pub kind: StructFieldKind, pub id: NodeId, @@ -1091,7 +1091,7 @@ pub struct StructField_ { pub type StructField = Spanned; -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub enum StructFieldKind { NamedField(Ident, Visibility), UnnamedField(Visibility), // element of a tuple-like struct @@ -1106,7 +1106,7 @@ impl StructFieldKind { } } -#[deriving(PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(PartialEq, Eq, Encodable, Decodable, Hash)] pub struct StructDef { pub fields: Vec, /* fields, not including ctor */ /* ID of the constructor. This is only used for tuple- or enum-like @@ -1120,7 +1120,7 @@ pub struct StructDef { FIXME (#3300): Should allow items to be anonymous. Right now we just use dummy names for anon items. */ -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub struct Item { pub ident: Ident, pub attrs: Vec, @@ -1130,7 +1130,7 @@ pub struct Item { pub span: Span, } -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub enum Item_ { ItemStatic(P, Mutability, @Expr), ItemFn(P, FnStyle, Abi, Generics, P), @@ -1148,7 +1148,7 @@ pub enum Item_ { ItemMac(Mac), } -#[deriving(PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(PartialEq, Eq, Encodable, Decodable, Hash)] pub struct ForeignItem { pub ident: Ident, pub attrs: Vec, @@ -1158,7 +1158,7 @@ pub struct ForeignItem { pub vis: Visibility, } -#[deriving(PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(PartialEq, Eq, Encodable, Decodable, Hash)] pub enum ForeignItem_ { ForeignItemFn(P, Generics), ForeignItemStatic(P, /* is_mutbl */ bool), @@ -1167,7 +1167,7 @@ pub enum ForeignItem_ { // The data we save and restore about an inlined item or method. This is not // part of the AST that we parse from a file, but it becomes part of the tree // that we trans. -#[deriving(PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(PartialEq, Eq, Encodable, Decodable, Hash)] pub enum InlinedItem { IIItem(@Item), IIMethod(DefId /* impl id */, bool /* is provided */, @Method), diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs index 59bf9608a09..f31d0d86940 100644 --- a/src/libsyntax/codemap.rs +++ b/src/libsyntax/codemap.rs @@ -33,7 +33,7 @@ pub trait Pos { /// A byte offset. Keep this small (currently 32-bits), as AST contains /// a lot of them. -#[deriving(Clone, PartialEq, TotalEq, Hash, PartialOrd, Show)] +#[deriving(Clone, PartialEq, Eq, Hash, PartialOrd, Show)] pub struct BytePos(pub u32); /// A character offset. Because of multibyte utf8 characters, a byte offset @@ -96,7 +96,7 @@ pub struct Span { pub static DUMMY_SP: Span = Span { lo: BytePos(0), hi: BytePos(0), expn_info: None }; -#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] pub struct Spanned { pub node: T, pub span: Span, @@ -109,7 +109,7 @@ impl PartialEq for Span { fn ne(&self, other: &Span) -> bool { !(*self).eq(other) } } -impl TotalEq for Span {} +impl Eq for Span {} impl, E> Encodable for Span { /* Note #1972 -- spans are encoded but not decoded */ diff --git a/src/libsyntax/ext/deriving/generic/mod.rs b/src/libsyntax/ext/deriving/generic/mod.rs index aecfe935d30..7bf4df357f4 100644 --- a/src/libsyntax/ext/deriving/generic/mod.rs +++ b/src/libsyntax/ext/deriving/generic/mod.rs @@ -28,7 +28,7 @@ Supported features (fairly exhaustive): moment. (`TraitDef.additional_bounds`) Unsupported: FIXME #6257: calling methods on reference fields, -e.g. deriving TotalEq/TotalOrd/Clone don't work on `struct A(&int)`, +e.g. deriving Eq/Ord/Clone don't work on `struct A(&int)`, because of how the auto-dereferencing happens. The most important thing for implementers is the `Substructure` and diff --git a/src/libsyntax/ext/deriving/mod.rs b/src/libsyntax/ext/deriving/mod.rs index 1d8081e2ae3..445b21551fd 100644 --- a/src/libsyntax/ext/deriving/mod.rs +++ b/src/libsyntax/ext/deriving/mod.rs @@ -79,9 +79,9 @@ pub fn expand_meta_deriving(cx: &mut ExtCtxt, // NOTE: after a stage0 snap this needs treatment "PartialEq" => expand!(eq::expand_deriving_eq), - "Eq" | "TotalEq" => expand!(totaleq::expand_deriving_totaleq), + "Eq" => expand!(totaleq::expand_deriving_totaleq), "PartialOrd" => expand!(ord::expand_deriving_ord), - "Ord" | "TotalOrd" => expand!(totalord::expand_deriving_totalord), + "Ord" => expand!(totalord::expand_deriving_totalord), "Rand" => expand!(rand::expand_deriving_rand), diff --git a/src/libsyntax/owned_slice.rs b/src/libsyntax/owned_slice.rs index c04c10e0d72..a514c1e9c5d 100644 --- a/src/libsyntax/owned_slice.rs +++ b/src/libsyntax/owned_slice.rs @@ -119,7 +119,7 @@ impl PartialEq for OwnedSlice { } } -impl TotalEq for OwnedSlice {} +impl Eq for OwnedSlice {} impl Container for OwnedSlice { fn len(&self) -> uint { self.len } diff --git a/src/libsyntax/parse/obsolete.rs b/src/libsyntax/parse/obsolete.rs index b7121c6b32c..bba400742b5 100644 --- a/src/libsyntax/parse/obsolete.rs +++ b/src/libsyntax/parse/obsolete.rs @@ -23,7 +23,7 @@ use parse::parser; use parse::token; /// The specific types of unsupported syntax -#[deriving(PartialEq, TotalEq, Hash)] +#[deriving(PartialEq, Eq, Hash)] pub enum ObsoleteSyntax { ObsoleteOwnedType, ObsoleteOwnedExpr, diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index 192adfe7829..34f508e42a1 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -24,7 +24,7 @@ use std::rc::Rc; use std::string::String; #[allow(non_camel_case_types)] -#[deriving(Clone, Encodable, Decodable, PartialEq, TotalEq, Hash, Show)] +#[deriving(Clone, Encodable, Decodable, PartialEq, Eq, Hash, Show)] pub enum BinOp { PLUS, MINUS, @@ -39,7 +39,7 @@ pub enum BinOp { } #[allow(non_camel_case_types)] -#[deriving(Clone, Encodable, Decodable, PartialEq, TotalEq, Hash, Show)] +#[deriving(Clone, Encodable, Decodable, PartialEq, Eq, Hash, Show)] pub enum Token { /* Expression-operator symbols. */ EQ, @@ -102,7 +102,7 @@ pub enum Token { EOF, } -#[deriving(Clone, Encodable, Decodable, PartialEq, TotalEq, Hash)] +#[deriving(Clone, Encodable, Decodable, PartialEq, Eq, Hash)] /// For interpolation during macro expansion. pub enum Nonterminal { NtItem(@ast::Item), @@ -552,7 +552,7 @@ pub fn get_ident_interner() -> Rc { /// destroyed. In particular, they must not access string contents. This can /// be fixed in the future by just leaking all strings until task death /// somehow. -#[deriving(Clone, PartialEq, Hash, PartialOrd, TotalEq, TotalOrd)] +#[deriving(Clone, PartialEq, Hash, PartialOrd, Eq, Ord)] pub struct InternedString { string: RcStr, } diff --git a/src/libsyntax/util/interner.rs b/src/libsyntax/util/interner.rs index d2361810a24..66260e50208 100644 --- a/src/libsyntax/util/interner.rs +++ b/src/libsyntax/util/interner.rs @@ -28,7 +28,7 @@ pub struct Interner { } // when traits can extend traits, we should extend index to get [] -impl Interner { +impl Interner { pub fn new() -> Interner { Interner { map: RefCell::new(HashMap::new()), @@ -95,9 +95,9 @@ pub struct RcStr { string: Rc, } -impl TotalEq for RcStr {} +impl Eq for RcStr {} -impl TotalOrd for RcStr { +impl Ord for RcStr { fn cmp(&self, other: &RcStr) -> Ordering { self.as_slice().cmp(&other.as_slice()) } diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index 35911949ea4..4d408864dc5 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -83,7 +83,7 @@ pub mod stats; // colons. This way if some test runner wants to arrange the tests // hierarchically it may. -#[deriving(Clone, PartialEq, TotalEq, Hash)] +#[deriving(Clone, PartialEq, Eq, Hash)] pub enum TestName { StaticTestName(&'static str), DynTestName(String) @@ -183,7 +183,7 @@ pub struct Bencher { // The definition of a single test. A test runner will run a list of // these. -#[deriving(Clone, Show, PartialEq, TotalEq, Hash)] +#[deriving(Clone, Show, PartialEq, Eq, Hash)] pub struct TestDesc { pub name: TestName, pub ignore: bool, diff --git a/src/libtest/stats.rs b/src/libtest/stats.rs index 16a96d9f606..b446a587bb9 100644 --- a/src/libtest/stats.rs +++ b/src/libtest/stats.rs @@ -441,7 +441,7 @@ pub fn write_boxplot( /// Returns a HashMap with the number of occurrences of every element in the /// sequence that the iterator exposes. -pub fn freq_count, U: TotalEq+Hash>(mut iter: T) -> hashmap::HashMap { +pub fn freq_count, U: Eq+Hash>(mut iter: T) -> hashmap::HashMap { let mut map: hashmap::HashMap = hashmap::HashMap::new(); for elem in iter { map.insert_or_update_with(elem, 1, |_, count| *count += 1); diff --git a/src/libtime/lib.rs b/src/libtime/lib.rs index 91e608360bc..a478aa931d4 100644 --- a/src/libtime/lib.rs +++ b/src/libtime/lib.rs @@ -74,7 +74,7 @@ mod imp { } /// A record specifying a time value in seconds and nanoseconds. -#[deriving(Clone, PartialEq, TotalEq, PartialOrd, TotalOrd, Encodable, Decodable, Show)] +#[deriving(Clone, PartialEq, Eq, PartialOrd, Ord, Encodable, Decodable, Show)] pub struct Timespec { pub sec: i64, pub nsec: i32 } /* * Timespec assumes that pre-epoch Timespecs have negative sec and positive diff --git a/src/liburl/lib.rs b/src/liburl/lib.rs index 482d7ca899b..5da6c5afe42 100644 --- a/src/liburl/lib.rs +++ b/src/liburl/lib.rs @@ -48,7 +48,7 @@ use std::uint; /// fragment: Some("quz".to_string()) }; /// // https://username@example.com:8080/foo/bar?baz=qux#quz /// ``` -#[deriving(Clone, PartialEq, TotalEq)] +#[deriving(Clone, PartialEq, Eq)] pub struct Url { /// The scheme part of a URL, such as `https` in the above example. pub scheme: String, @@ -81,7 +81,7 @@ pub struct Path { } /// An optional subcomponent of a URI authority component. -#[deriving(Clone, PartialEq, TotalEq)] +#[deriving(Clone, PartialEq, Eq)] pub struct UserInfo { /// The user name. pub user: String, diff --git a/src/libuuid/lib.rs b/src/libuuid/lib.rs index a5b28b73023..0a2b3744824 100644 --- a/src/libuuid/lib.rs +++ b/src/libuuid/lib.rs @@ -487,7 +487,7 @@ impl PartialEq for Uuid { } } -impl TotalEq for Uuid {} +impl Eq for Uuid {} // FIXME #9845: Test these more thoroughly impl, E> Encodable for Uuid { diff --git a/src/snapshots.txt b/src/snapshots.txt index 15c1405c4ce..854c60a3f1b 100644 --- a/src/snapshots.txt +++ b/src/snapshots.txt @@ -1,3 +1,11 @@ +S 2014-05-30 60a43f9 + freebsd-x86_64 59067eb9e89bde3e20a1078104f4b1105e4b56fc + linux-i386 c1a81811e8e104c91c35d94a140e3cf8463c7655 + linux-x86_64 5c7167a2f964118103af5735a9215e8421803406 + macos-i386 872b9818badefda412c7513b93742369f969094d + macos-x86_64 78c0f2ead6287c433d0cd18e1860404526ba5049 + winnt-i386 63ca814f86493a8f06ab616b5e31d49a19bec1b2 + S 2014-05-29 50b8528 freebsd-x86_64 cfa0dcc98a57f03a53bb53df6fd5db02143e2bee linux-i386 baf7c6ab5792f3d560a0f2adc94d7ff96d0cab3d diff --git a/src/test/bench/shootout-k-nucleotide.rs b/src/test/bench/shootout-k-nucleotide.rs index 45cd93188b2..6c038e28bb9 100644 --- a/src/test/bench/shootout-k-nucleotide.rs +++ b/src/test/bench/shootout-k-nucleotide.rs @@ -30,7 +30,7 @@ static OCCURRENCES: [&'static str, ..5] = [ // Code implementation -#[deriving(PartialEq, PartialOrd, TotalOrd, TotalEq)] +#[deriving(PartialEq, PartialOrd, Ord, Eq)] struct Code(u64); impl Code { diff --git a/src/test/compile-fail/deriving-span-TotalEq-enum-struct-variant.rs b/src/test/compile-fail/deriving-span-TotalEq-enum-struct-variant.rs index 07fc3d5c5d9..964e7d8c811 100644 --- a/src/test/compile-fail/deriving-span-TotalEq-enum-struct-variant.rs +++ b/src/test/compile-fail/deriving-span-TotalEq-enum-struct-variant.rs @@ -16,7 +16,7 @@ extern crate rand; #[deriving(PartialEq)] struct Error; -#[deriving(TotalEq,PartialEq)] +#[deriving(Eq,PartialEq)] enum Enum { A { x: Error //~ ERROR diff --git a/src/test/compile-fail/deriving-span-TotalEq-enum.rs b/src/test/compile-fail/deriving-span-TotalEq-enum.rs index e25ebaf7f1b..96e87ca2006 100644 --- a/src/test/compile-fail/deriving-span-TotalEq-enum.rs +++ b/src/test/compile-fail/deriving-span-TotalEq-enum.rs @@ -16,7 +16,7 @@ extern crate rand; #[deriving(PartialEq)] struct Error; -#[deriving(TotalEq,PartialEq)] +#[deriving(Eq,PartialEq)] enum Enum { A( Error //~ ERROR diff --git a/src/test/compile-fail/deriving-span-TotalEq-struct.rs b/src/test/compile-fail/deriving-span-TotalEq-struct.rs index b9b50e5d60b..784c766c057 100644 --- a/src/test/compile-fail/deriving-span-TotalEq-struct.rs +++ b/src/test/compile-fail/deriving-span-TotalEq-struct.rs @@ -16,7 +16,7 @@ extern crate rand; #[deriving(PartialEq)] struct Error; -#[deriving(TotalEq,PartialEq)] +#[deriving(Eq,PartialEq)] struct Struct { x: Error //~ ERROR } diff --git a/src/test/compile-fail/deriving-span-TotalEq-tuple-struct.rs b/src/test/compile-fail/deriving-span-TotalEq-tuple-struct.rs index b6123df4506..3dcff5f80ce 100644 --- a/src/test/compile-fail/deriving-span-TotalEq-tuple-struct.rs +++ b/src/test/compile-fail/deriving-span-TotalEq-tuple-struct.rs @@ -16,7 +16,7 @@ extern crate rand; #[deriving(PartialEq)] struct Error; -#[deriving(TotalEq,PartialEq)] +#[deriving(Eq,PartialEq)] struct Struct( Error //~ ERROR ); diff --git a/src/test/compile-fail/deriving-span-TotalOrd-enum-struct-variant.rs b/src/test/compile-fail/deriving-span-TotalOrd-enum-struct-variant.rs index a8116a817a8..c16e64829dd 100644 --- a/src/test/compile-fail/deriving-span-TotalOrd-enum-struct-variant.rs +++ b/src/test/compile-fail/deriving-span-TotalOrd-enum-struct-variant.rs @@ -13,10 +13,10 @@ #![feature(struct_variant)] extern crate rand; -#[deriving(TotalEq,PartialOrd,PartialEq)] +#[deriving(Eq,PartialOrd,PartialEq)] struct Error; -#[deriving(TotalOrd,TotalEq,PartialOrd,PartialEq)] +#[deriving(Ord,Eq,PartialOrd,PartialEq)] enum Enum { A { x: Error //~ ERROR diff --git a/src/test/compile-fail/deriving-span-TotalOrd-enum.rs b/src/test/compile-fail/deriving-span-TotalOrd-enum.rs index 0e1dc003fbb..4b3f0ce52c7 100644 --- a/src/test/compile-fail/deriving-span-TotalOrd-enum.rs +++ b/src/test/compile-fail/deriving-span-TotalOrd-enum.rs @@ -13,10 +13,10 @@ #![feature(struct_variant)] extern crate rand; -#[deriving(TotalEq,PartialOrd,PartialEq)] +#[deriving(Eq,PartialOrd,PartialEq)] struct Error; -#[deriving(TotalOrd,TotalEq,PartialOrd,PartialEq)] +#[deriving(Ord,Eq,PartialOrd,PartialEq)] enum Enum { A( Error //~ ERROR diff --git a/src/test/compile-fail/deriving-span-TotalOrd-struct.rs b/src/test/compile-fail/deriving-span-TotalOrd-struct.rs index af6f09c4a2c..56d62742378 100644 --- a/src/test/compile-fail/deriving-span-TotalOrd-struct.rs +++ b/src/test/compile-fail/deriving-span-TotalOrd-struct.rs @@ -13,10 +13,10 @@ #![feature(struct_variant)] extern crate rand; -#[deriving(TotalEq,PartialOrd,PartialEq)] +#[deriving(Eq,PartialOrd,PartialEq)] struct Error; -#[deriving(TotalOrd,TotalEq,PartialOrd,PartialEq)] +#[deriving(Ord,Eq,PartialOrd,PartialEq)] struct Struct { x: Error //~ ERROR } diff --git a/src/test/compile-fail/deriving-span-TotalOrd-tuple-struct.rs b/src/test/compile-fail/deriving-span-TotalOrd-tuple-struct.rs index b58dc56a261..2330fdd8b89 100644 --- a/src/test/compile-fail/deriving-span-TotalOrd-tuple-struct.rs +++ b/src/test/compile-fail/deriving-span-TotalOrd-tuple-struct.rs @@ -13,10 +13,10 @@ #![feature(struct_variant)] extern crate rand; -#[deriving(TotalEq,PartialOrd,PartialEq)] +#[deriving(Eq,PartialOrd,PartialEq)] struct Error; -#[deriving(TotalOrd,TotalEq,PartialOrd,PartialEq)] +#[deriving(Ord,Eq,PartialOrd,PartialEq)] struct Struct( Error //~ ERROR ); diff --git a/src/test/run-pass/deriving-cmp-generic-enum.rs b/src/test/run-pass/deriving-cmp-generic-enum.rs index e280da10990..48e6cae706e 100644 --- a/src/test/run-pass/deriving-cmp-generic-enum.rs +++ b/src/test/run-pass/deriving-cmp-generic-enum.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[deriving(PartialEq, TotalEq, PartialOrd, TotalOrd)] +#[deriving(PartialEq, Eq, PartialOrd, Ord)] enum E { E0, E1(T), @@ -22,7 +22,7 @@ pub fn main() { let e21 = E2(1, 1); let e22 = E2(1, 2); - // in order for both PartialOrd and TotalOrd + // in order for both PartialOrd and Ord let es = [e0, e11, e12, e21, e22]; for (i, e1) in es.iter().enumerate() { @@ -46,7 +46,7 @@ pub fn main() { assert_eq!(*e1 <= *e2, le); assert_eq!(*e1 >= *e2, ge); - // TotalOrd + // Ord assert_eq!(e1.cmp(e2), ord); } } diff --git a/src/test/run-pass/deriving-cmp-generic-struct-enum.rs b/src/test/run-pass/deriving-cmp-generic-struct-enum.rs index a6040049a2f..5958538d80e 100644 --- a/src/test/run-pass/deriving-cmp-generic-struct-enum.rs +++ b/src/test/run-pass/deriving-cmp-generic-struct-enum.rs @@ -10,7 +10,7 @@ #![feature(struct_variant)] -#[deriving(PartialEq, TotalEq, PartialOrd, TotalOrd)] +#[deriving(PartialEq, Eq, PartialOrd, Ord)] enum ES { ES1 { x: T }, ES2 { x: T, y: T } @@ -20,7 +20,7 @@ enum ES { pub fn main() { let (es11, es12, es21, es22) = (ES1 {x: 1}, ES1 {x: 2}, ES2 {x: 1, y: 1}, ES2 {x: 1, y: 2}); - // in order for both PartialOrd and TotalOrd + // in order for both PartialOrd and Ord let ess = [es11, es12, es21, es22]; for (i, es1) in ess.iter().enumerate() { @@ -42,7 +42,7 @@ pub fn main() { assert_eq!(*es1 <= *es2, le); assert_eq!(*es1 >= *es2, ge); - // TotalOrd + // Ord assert_eq!(es1.cmp(es2), ord); } } diff --git a/src/test/run-pass/deriving-cmp-generic-struct.rs b/src/test/run-pass/deriving-cmp-generic-struct.rs index 36ec0e834ba..5a6daa6d520 100644 --- a/src/test/run-pass/deriving-cmp-generic-struct.rs +++ b/src/test/run-pass/deriving-cmp-generic-struct.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[deriving(PartialEq, TotalEq, PartialOrd, TotalOrd)] +#[deriving(PartialEq, Eq, PartialOrd, Ord)] struct S { x: T, y: T @@ -18,7 +18,7 @@ pub fn main() { let s1 = S {x: 1, y: 1}; let s2 = S {x: 1, y: 2}; - // in order for both PartialOrd and TotalOrd + // in order for both PartialOrd and Ord let ss = [s1, s2]; for (i, s1) in ss.iter().enumerate() { @@ -42,7 +42,7 @@ pub fn main() { assert_eq!(*s1 <= *s2, le); assert_eq!(*s1 >= *s2, ge); - // TotalOrd + // Ord assert_eq!(s1.cmp(s2), ord); } } diff --git a/src/test/run-pass/deriving-cmp-generic-tuple-struct.rs b/src/test/run-pass/deriving-cmp-generic-tuple-struct.rs index b67da8940ff..875c33b9810 100644 --- a/src/test/run-pass/deriving-cmp-generic-tuple-struct.rs +++ b/src/test/run-pass/deriving-cmp-generic-tuple-struct.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[deriving(PartialEq, TotalEq, PartialOrd, TotalOrd)] +#[deriving(PartialEq, Eq, PartialOrd, Ord)] struct TS(T,T); @@ -16,7 +16,7 @@ pub fn main() { let ts1 = TS(1, 1); let ts2 = TS(1, 2); - // in order for both PartialOrd and TotalOrd + // in order for both PartialOrd and Ord let tss = [ts1, ts2]; for (i, ts1) in tss.iter().enumerate() { @@ -40,7 +40,7 @@ pub fn main() { assert_eq!(*ts1 <= *ts2, le); assert_eq!(*ts1 >= *ts2, ge); - // TotalOrd + // Ord assert_eq!(ts1.cmp(ts2), ord); } } diff --git a/src/test/run-pass/deriving-cmp-shortcircuit.rs b/src/test/run-pass/deriving-cmp-shortcircuit.rs index 45beda9684d..69ee47fd1d9 100644 --- a/src/test/run-pass/deriving-cmp-shortcircuit.rs +++ b/src/test/run-pass/deriving-cmp-shortcircuit.rs @@ -21,13 +21,13 @@ impl PartialOrd for FailCmp { fn lt(&self, _: &FailCmp) -> bool { fail!("lt") } } -impl TotalEq for FailCmp {} +impl Eq for FailCmp {} -impl TotalOrd for FailCmp { +impl Ord for FailCmp { fn cmp(&self, _: &FailCmp) -> Ordering { fail!("cmp") } } -#[deriving(PartialEq,PartialOrd,TotalEq,TotalOrd)] +#[deriving(PartialEq,PartialOrd,Eq,Ord)] struct ShortCircuit { x: int, y: FailCmp diff --git a/src/test/run-pass/deriving-global.rs b/src/test/run-pass/deriving-global.rs index 1f9a5cab3b7..2322675661c 100644 --- a/src/test/run-pass/deriving-global.rs +++ b/src/test/run-pass/deriving-global.rs @@ -15,21 +15,21 @@ mod submod { // if any of these are implemented without global calls for any // function calls, then being in a submodule will (correctly) // cause errors about unrecognised module `std` (or `extra`) - #[deriving(PartialEq, PartialOrd, TotalEq, TotalOrd, + #[deriving(PartialEq, PartialOrd, Eq, Ord, Hash, Clone, Show, Rand, Encodable, Decodable)] enum A { A1(uint), A2(int) } - #[deriving(PartialEq, PartialOrd, TotalEq, TotalOrd, + #[deriving(PartialEq, PartialOrd, Eq, Ord, Hash, Clone, Show, Rand, Encodable, Decodable)] struct B { x: uint, y: int } - #[deriving(PartialEq, PartialOrd, TotalEq, TotalOrd, + #[deriving(PartialEq, PartialOrd, Eq, Ord, Hash, Clone, Show, Rand, diff --git a/src/test/run-pass/deriving-self-lifetime-totalord-totaleq.rs b/src/test/run-pass/deriving-self-lifetime-totalord-totaleq.rs index 1c921041042..1187a9a8bc4 100644 --- a/src/test/run-pass/deriving-self-lifetime-totalord-totaleq.rs +++ b/src/test/run-pass/deriving-self-lifetime-totalord-totaleq.rs @@ -12,7 +12,7 @@ use std::cmp::{Less,Equal,Greater}; -#[deriving(TotalEq,TotalOrd)] +#[deriving(Eq,Ord)] struct A<'a> { x: &'a int } diff --git a/src/test/run-pass/issue-12860.rs b/src/test/run-pass/issue-12860.rs index 863245d42f0..b133f627439 100644 --- a/src/test/run-pass/issue-12860.rs +++ b/src/test/run-pass/issue-12860.rs @@ -13,7 +13,7 @@ extern crate collections; use collections::HashSet; -#[deriving(PartialEq, TotalEq, Hash)] +#[deriving(PartialEq, Eq, Hash)] struct XYZ { x: int, y: int, diff --git a/src/test/run-pass/regions-mock-tcx.rs b/src/test/run-pass/regions-mock-tcx.rs index 1d7521b7450..b8e6a5fb03e 100644 --- a/src/test/run-pass/regions-mock-tcx.rs +++ b/src/test/run-pass/regions-mock-tcx.rs @@ -40,7 +40,7 @@ impl<'tcx> PartialEq for TypeStructure<'tcx> { } } -impl<'tcx> TotalEq for TypeStructure<'tcx> {} +impl<'tcx> Eq for TypeStructure<'tcx> {} struct TypeContext<'tcx, 'ast> { ty_arena: &'tcx Arena, @@ -86,7 +86,7 @@ impl<'tcx,'ast> TypeContext<'tcx, 'ast> { } } -#[deriving(PartialEq, TotalEq, Hash)] +#[deriving(PartialEq, Eq, Hash)] struct NodeId { id: uint } diff --git a/src/test/run-pass/vector-sort-failure-safe.rs b/src/test/run-pass/vector-sort-failure-safe.rs index e4e419e4988..2575e53b6a3 100644 --- a/src/test/run-pass/vector-sort-failure-safe.rs +++ b/src/test/run-pass/vector-sort-failure-safe.rs @@ -15,7 +15,7 @@ static MAX_LEN: uint = 20; static mut drop_counts: [uint, .. MAX_LEN] = [0, .. MAX_LEN]; static mut clone_count: uint = 0; -#[deriving(Rand, PartialEq, PartialOrd, TotalEq, TotalOrd)] +#[deriving(Rand, PartialEq, PartialOrd, Eq, Ord)] struct DropCounter { x: uint, clone_num: uint } impl Clone for DropCounter {