1
Fork 0

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]
This commit is contained in:
Alex Crichton 2014-05-31 10:43:52 -07:00
parent c605c2b57b
commit bba701c59d
83 changed files with 436 additions and 431 deletions

View file

@ -12,7 +12,7 @@
use core::any::{Any, AnyRefExt}; use core::any::{Any, AnyRefExt};
use core::clone::Clone; 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::default::Default;
use core::fmt; use core::fmt;
use core::intrinsics; use core::intrinsics;
@ -67,11 +67,11 @@ impl<T:PartialOrd> PartialOrd for Box<T> {
#[inline] #[inline]
fn gt(&self, other: &Box<T>) -> bool { *(*self) > *(*other) } fn gt(&self, other: &Box<T>) -> bool { *(*self) > *(*other) }
} }
impl<T: TotalOrd> TotalOrd for Box<T> { impl<T: Ord> Ord for Box<T> {
#[inline] #[inline]
fn cmp(&self, other: &Box<T>) -> Ordering { (**self).cmp(*other) } fn cmp(&self, other: &Box<T>) -> Ordering { (**self).cmp(*other) }
} }
impl<T: TotalEq> TotalEq for Box<T> {} impl<T: Eq> Eq for Box<T> {}
/// Extension methods for an owning `Any` trait object /// Extension methods for an owning `Any` trait object
pub trait AnyOwnExt { pub trait AnyOwnExt {

View file

@ -26,7 +26,7 @@ pointers, and then storing the parent pointers as `Weak` pointers.
use core::mem::transmute; use core::mem::transmute;
use core::cell::Cell; use core::cell::Cell;
use core::clone::Clone; 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::kinds::marker;
use core::ops::{Deref, Drop}; use core::ops::{Deref, Drop};
use core::option::{Option, Some, None}; use core::option::{Option, Some, None};
@ -157,7 +157,7 @@ impl<T: PartialEq> PartialEq for Rc<T> {
fn ne(&self, other: &Rc<T>) -> bool { **self != **other } fn ne(&self, other: &Rc<T>) -> bool { **self != **other }
} }
impl<T: TotalEq> TotalEq for Rc<T> {} impl<T: Eq> Eq for Rc<T> {}
impl<T: PartialOrd> PartialOrd for Rc<T> { impl<T: PartialOrd> PartialOrd for Rc<T> {
#[inline(always)] #[inline(always)]
@ -173,7 +173,7 @@ impl<T: PartialOrd> PartialOrd for Rc<T> {
fn ge(&self, other: &Rc<T>) -> bool { **self >= **other } fn ge(&self, other: &Rc<T>) -> bool { **self >= **other }
} }
impl<T: TotalOrd> TotalOrd for Rc<T> { impl<T: Ord> Ord for Rc<T> {
#[inline] #[inline]
fn cmp(&self, other: &Rc<T>) -> Ordering { (**self).cmp(&**other) } fn cmp(&self, other: &Rc<T>) -> Ordering { (**self).cmp(&**other) }
} }

View file

@ -29,7 +29,7 @@ pub struct BTree<K, V> {
upper_bound: uint upper_bound: uint
} }
impl<K: TotalOrd, V> BTree<K, V> { impl<K: Ord, V> BTree<K, V> {
///Returns new BTree with root node (leaf) and user-supplied lower bound ///Returns new BTree with root node (leaf) and user-supplied lower bound
///The lower bound applies to every node except the root node. ///The lower bound applies to every node except the root node.
@ -59,7 +59,7 @@ impl<K: TotalOrd, V> BTree<K, V> {
//We would probably want to remove the dependence on the Clone trait in the future. //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 //It is here as a crutch to ensure values can be passed around through the tree's nodes
//especially during insertions and deletions. //especially during insertions and deletions.
impl<K: Clone + TotalOrd, V: Clone> BTree<K, V> { impl<K: Clone + Ord, V: Clone> BTree<K, V> {
///Returns the value of a given key, which may not exist in the tree. ///Returns the value of a given key, which may not exist in the tree.
///Calls the root node's get method. ///Calls the root node's get method.
pub fn get(self, k: K) -> Option<V> { pub fn get(self, k: K) -> Option<V> {
@ -84,7 +84,7 @@ impl<K: Clone + TotalOrd, V: Clone> BTree<K, V> {
} }
} }
impl<K: Clone + TotalOrd, V: Clone> Clone for BTree<K, V> { impl<K: Clone + Ord, V: Clone> Clone for BTree<K, V> {
///Implements the Clone trait for the BTree. ///Implements the Clone trait for the BTree.
///Uses a helper function/constructor to produce a new BTree. ///Uses a helper function/constructor to produce a new BTree.
fn clone(&self) -> BTree<K, V> { fn clone(&self) -> BTree<K, V> {
@ -92,28 +92,28 @@ impl<K: Clone + TotalOrd, V: Clone> Clone for BTree<K, V> {
} }
} }
impl<K: TotalOrd, V: TotalEq> PartialEq for BTree<K, V> { impl<K: Ord, V: Eq> PartialEq for BTree<K, V> {
fn eq(&self, other: &BTree<K, V>) -> bool { fn eq(&self, other: &BTree<K, V>) -> bool {
self.root.cmp(&other.root) == Equal self.root.cmp(&other.root) == Equal
} }
} }
impl<K: TotalOrd, V: TotalEq> TotalEq for BTree<K, V> {} impl<K: Ord, V: Eq> Eq for BTree<K, V> {}
impl<K: TotalOrd, V: TotalEq> PartialOrd for BTree<K, V> { impl<K: Ord, V: Eq> PartialOrd for BTree<K, V> {
fn lt(&self, other: &BTree<K, V>) -> bool { fn lt(&self, other: &BTree<K, V>) -> bool {
self.cmp(other) == Less self.cmp(other) == Less
} }
} }
impl<K: TotalOrd, V: TotalEq> TotalOrd for BTree<K, V> { impl<K: Ord, V: Eq> Ord for BTree<K, V> {
///Returns an ordering based on the root nodes of each BTree. ///Returns an ordering based on the root nodes of each BTree.
fn cmp(&self, other: &BTree<K, V>) -> Ordering { fn cmp(&self, other: &BTree<K, V>) -> Ordering {
self.root.cmp(&other.root) self.root.cmp(&other.root)
} }
} }
impl<K: fmt::Show + TotalOrd, V: fmt::Show> fmt::Show for BTree<K, V> { impl<K: fmt::Show + Ord, V: fmt::Show> fmt::Show for BTree<K, V> {
///Returns a string representation of the BTree ///Returns a string representation of the BTree
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
self.root.fmt(f) self.root.fmt(f)
@ -133,7 +133,7 @@ enum Node<K, V> {
//Node functions/methods //Node functions/methods
impl<K: TotalOrd, V> Node<K, V> { impl<K: Ord, V> Node<K, V> {
///Creates a new leaf node given a vector of elements. ///Creates a new leaf node given a vector of elements.
fn new_leaf(vec: Vec<LeafElt<K, V>>) -> Node<K,V> { fn new_leaf(vec: Vec<LeafElt<K, V>>) -> Node<K,V> {
LeafNode(Leaf::new(vec)) LeafNode(Leaf::new(vec))
@ -164,7 +164,7 @@ impl<K: TotalOrd, V> Node<K, V> {
} }
} }
impl<K: Clone + TotalOrd, V: Clone> Node<K, V> { impl<K: Clone + Ord, V: Clone> Node<K, V> {
///Returns the corresponding value to the provided key. ///Returns the corresponding value to the provided key.
///get() is called in different ways on a branch or a leaf. ///get() is called in different ways on a branch or a leaf.
fn get(&self, k: K) -> Option<V> { fn get(&self, k: K) -> Option<V> {
@ -183,7 +183,7 @@ impl<K: Clone + TotalOrd, V: Clone> Node<K, V> {
} }
} }
impl<K: Clone + TotalOrd, V: Clone> Clone for Node<K, V> { impl<K: Clone + Ord, V: Clone> Clone for Node<K, V> {
///Returns a new node based on whether or not it is a branch or a leaf. ///Returns a new node based on whether or not it is a branch or a leaf.
fn clone(&self) -> Node<K, V> { fn clone(&self) -> Node<K, V> {
match *self { match *self {
@ -198,7 +198,7 @@ impl<K: Clone + TotalOrd, V: Clone> Clone for Node<K, V> {
} }
} }
impl<K: TotalOrd, V: TotalEq> PartialEq for Node<K, V> { impl<K: Ord, V: Eq> PartialEq for Node<K, V> {
fn eq(&self, other: &Node<K, V>) -> bool { fn eq(&self, other: &Node<K, V>) -> bool {
match *self{ match *self{
BranchNode(ref branch) => { BranchNode(ref branch) => {
@ -220,16 +220,16 @@ impl<K: TotalOrd, V: TotalEq> PartialEq for Node<K, V> {
} }
} }
impl<K: TotalOrd, V: TotalEq> TotalEq for Node<K, V> {} impl<K: Ord, V: Eq> Eq for Node<K, V> {}
impl<K: TotalOrd, V: TotalEq> PartialOrd for Node<K, V> { impl<K: Ord, V: Eq> PartialOrd for Node<K, V> {
fn lt(&self, other: &Node<K, V>) -> bool { fn lt(&self, other: &Node<K, V>) -> bool {
self.cmp(other) == Less self.cmp(other) == Less
} }
} }
impl<K: TotalOrd, V: TotalEq> TotalOrd for Node<K, V> { impl<K: Ord, V: Eq> Ord for Node<K, V> {
///Implementation of TotalOrd for Nodes. ///Implementation of Ord for Nodes.
fn cmp(&self, other: &Node<K, V>) -> Ordering { fn cmp(&self, other: &Node<K, V>) -> Ordering {
match *self { match *self {
LeafNode(ref leaf) => { LeafNode(ref leaf) => {
@ -248,7 +248,7 @@ impl<K: TotalOrd, V: TotalEq> TotalOrd for Node<K, V> {
} }
} }
impl<K: fmt::Show + TotalOrd, V: fmt::Show> fmt::Show for Node<K, V> { impl<K: fmt::Show + Ord, V: fmt::Show> fmt::Show for Node<K, V> {
///Returns a string representation of a Node. ///Returns a string representation of a Node.
///Will iterate over the Node and show "Key: x, value: y, child: () // " ///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 ///for all elements in the Node. "Child" only exists if the Node contains
@ -275,7 +275,7 @@ struct Branch<K, V> {
} }
impl<K: TotalOrd, V> Leaf<K, V> { impl<K: Ord, V> Leaf<K, V> {
///Creates a new Leaf from a vector of LeafElts. ///Creates a new Leaf from a vector of LeafElts.
fn new(vec: Vec<LeafElt<K, V>>) -> Leaf<K, V> { fn new(vec: Vec<LeafElt<K, V>>) -> Leaf<K, V> {
Leaf { Leaf {
@ -335,7 +335,7 @@ impl<K: TotalOrd, V> Leaf<K, V> {
} }
impl<K: Clone + TotalOrd, V: Clone> Leaf<K, V> { impl<K: Clone + Ord, V: Clone> Leaf<K, V> {
///Returns the corresponding value to the supplied key. ///Returns the corresponding value to the supplied key.
fn get(&self, k: K) -> Option<V> { fn get(&self, k: K) -> Option<V> {
for s in self.elts.iter() { for s in self.elts.iter() {
@ -386,28 +386,28 @@ impl<K: Clone + TotalOrd, V: Clone> Leaf<K, V> {
} }
} }
impl<K: Clone + TotalOrd, V: Clone> Clone for Leaf<K, V> { impl<K: Clone + Ord, V: Clone> Clone for Leaf<K, V> {
///Returns a new Leaf with the same elts. ///Returns a new Leaf with the same elts.
fn clone(&self) -> Leaf<K, V> { fn clone(&self) -> Leaf<K, V> {
Leaf::new(self.elts.clone()) Leaf::new(self.elts.clone())
} }
} }
impl<K: TotalOrd, V: TotalEq> PartialEq for Leaf<K, V> { impl<K: Ord, V: Eq> PartialEq for Leaf<K, V> {
fn eq(&self, other: &Leaf<K, V>) -> bool { fn eq(&self, other: &Leaf<K, V>) -> bool {
self.elts == other.elts self.elts == other.elts
} }
} }
impl<K: TotalOrd, V: TotalEq> TotalEq for Leaf<K, V> {} impl<K: Ord, V: Eq> Eq for Leaf<K, V> {}
impl<K: TotalOrd, V: TotalEq> PartialOrd for Leaf<K, V> { impl<K: Ord, V: Eq> PartialOrd for Leaf<K, V> {
fn lt(&self, other: &Leaf<K, V>) -> bool { fn lt(&self, other: &Leaf<K, V>) -> bool {
self.cmp(other) == Less self.cmp(other) == Less
} }
} }
impl<K: TotalOrd, V: TotalEq> TotalOrd for Leaf<K, V> { impl<K: Ord, V: Eq> Ord for Leaf<K, V> {
///Returns an ordering based on the first element of each Leaf. ///Returns an ordering based on the first element of each Leaf.
fn cmp(&self, other: &Leaf<K, V>) -> Ordering { fn cmp(&self, other: &Leaf<K, V>) -> Ordering {
if self.elts.len() > other.elts.len() { if self.elts.len() > other.elts.len() {
@ -421,7 +421,7 @@ impl<K: TotalOrd, V: TotalEq> TotalOrd for Leaf<K, V> {
} }
impl<K: fmt::Show + TotalOrd, V: fmt::Show> fmt::Show for Leaf<K, V> { impl<K: fmt::Show + Ord, V: fmt::Show> fmt::Show for Leaf<K, V> {
///Returns a string representation of a Leaf. ///Returns a string representation of a Leaf.
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
for (i, s) in self.elts.iter().enumerate() { for (i, s) in self.elts.iter().enumerate() {
@ -433,7 +433,7 @@ impl<K: fmt::Show + TotalOrd, V: fmt::Show> fmt::Show for Leaf<K, V> {
} }
impl<K: TotalOrd, V> Branch<K, V> { impl<K: Ord, V> Branch<K, V> {
///Creates a new Branch from a vector of BranchElts and a rightmost child (a node). ///Creates a new Branch from a vector of BranchElts and a rightmost child (a node).
fn new(vec: Vec<BranchElt<K, V>>, right: Box<Node<K, V>>) fn new(vec: Vec<BranchElt<K, V>>, right: Box<Node<K, V>>)
-> Branch<K, V> { -> Branch<K, V> {
@ -492,7 +492,7 @@ impl<K: TotalOrd, V> Branch<K, V> {
} }
} }
impl<K: Clone + TotalOrd, V: Clone> Branch<K, V> { impl<K: Clone + Ord, V: Clone> Branch<K, V> {
///Returns the corresponding value to the supplied key. ///Returns the corresponding value to the supplied key.
///If the key is not there, find the child that might hold it. ///If the key is not there, find the child that might hold it.
fn get(&self, k: K) -> Option<V> { fn get(&self, k: K) -> Option<V> {
@ -616,28 +616,28 @@ impl<K: Clone + TotalOrd, V: Clone> Branch<K, V> {
} }
} }
impl<K: Clone + TotalOrd, V: Clone> Clone for Branch<K, V> { impl<K: Clone + Ord, V: Clone> Clone for Branch<K, V> {
///Returns a new branch using the clone methods of the Branch's internal variables. ///Returns a new branch using the clone methods of the Branch's internal variables.
fn clone(&self) -> Branch<K, V> { fn clone(&self) -> Branch<K, V> {
Branch::new(self.elts.clone(), self.rightmost_child.clone()) Branch::new(self.elts.clone(), self.rightmost_child.clone())
} }
} }
impl<K: TotalOrd, V: TotalEq> PartialEq for Branch<K, V> { impl<K: Ord, V: Eq> PartialEq for Branch<K, V> {
fn eq(&self, other: &Branch<K, V>) -> bool { fn eq(&self, other: &Branch<K, V>) -> bool {
self.elts == other.elts self.elts == other.elts
} }
} }
impl<K: TotalOrd, V: TotalEq> TotalEq for Branch<K, V> {} impl<K: Ord, V: Eq> Eq for Branch<K, V> {}
impl<K: TotalOrd, V: TotalEq> PartialOrd for Branch<K, V> { impl<K: Ord, V: Eq> PartialOrd for Branch<K, V> {
fn lt(&self, other: &Branch<K, V>) -> bool { fn lt(&self, other: &Branch<K, V>) -> bool {
self.cmp(other) == Less self.cmp(other) == Less
} }
} }
impl<K: TotalOrd, V: TotalEq> TotalOrd for Branch<K, V> { impl<K: Ord, V: Eq> Ord for Branch<K, V> {
///Compares the first elements of two branches to determine an ordering ///Compares the first elements of two branches to determine an ordering
fn cmp(&self, other: &Branch<K, V>) -> Ordering { fn cmp(&self, other: &Branch<K, V>) -> Ordering {
if self.elts.len() > other.elts.len() { if self.elts.len() > other.elts.len() {
@ -650,7 +650,7 @@ impl<K: TotalOrd, V: TotalEq> TotalOrd for Branch<K, V> {
} }
} }
impl<K: fmt::Show + TotalOrd, V: fmt::Show> fmt::Show for Branch<K, V> { impl<K: fmt::Show + Ord, V: fmt::Show> fmt::Show for Branch<K, V> {
///Returns a string representation of a Branch. ///Returns a string representation of a Branch.
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
for (i, s) in self.elts.iter().enumerate() { for (i, s) in self.elts.iter().enumerate() {
@ -674,7 +674,7 @@ struct BranchElt<K, V> {
value: V value: V
} }
impl<K: TotalOrd, V> LeafElt<K, V> { impl<K: Ord, V> LeafElt<K, V> {
///Creates a new LeafElt from a supplied key-value pair. ///Creates a new LeafElt from a supplied key-value pair.
fn new(k: K, v: V) -> LeafElt<K, V> { fn new(k: K, v: V) -> LeafElt<K, V> {
LeafElt { LeafElt {
@ -684,42 +684,42 @@ impl<K: TotalOrd, V> LeafElt<K, V> {
} }
} }
impl<K: Clone + TotalOrd, V: Clone> Clone for LeafElt<K, V> { impl<K: Clone + Ord, V: Clone> Clone for LeafElt<K, V> {
///Returns a new LeafElt by cloning the key and value. ///Returns a new LeafElt by cloning the key and value.
fn clone(&self) -> LeafElt<K, V> { fn clone(&self) -> LeafElt<K, V> {
LeafElt::new(self.key.clone(), self.value.clone()) LeafElt::new(self.key.clone(), self.value.clone())
} }
} }
impl<K: TotalOrd, V: TotalEq> PartialEq for LeafElt<K, V> { impl<K: Ord, V: Eq> PartialEq for LeafElt<K, V> {
fn eq(&self, other: &LeafElt<K, V>) -> bool { fn eq(&self, other: &LeafElt<K, V>) -> bool {
self.key == other.key && self.value == other.value self.key == other.key && self.value == other.value
} }
} }
impl<K: TotalOrd, V: TotalEq> TotalEq for LeafElt<K, V> {} impl<K: Ord, V: Eq> Eq for LeafElt<K, V> {}
impl<K: TotalOrd, V: TotalEq> PartialOrd for LeafElt<K, V> { impl<K: Ord, V: Eq> PartialOrd for LeafElt<K, V> {
fn lt(&self, other: &LeafElt<K, V>) -> bool { fn lt(&self, other: &LeafElt<K, V>) -> bool {
self.cmp(other) == Less self.cmp(other) == Less
} }
} }
impl<K: TotalOrd, V: TotalEq> TotalOrd for LeafElt<K, V> { impl<K: Ord, V: Eq> Ord for LeafElt<K, V> {
///Returns an ordering based on the keys of the LeafElts. ///Returns an ordering based on the keys of the LeafElts.
fn cmp(&self, other: &LeafElt<K, V>) -> Ordering { fn cmp(&self, other: &LeafElt<K, V>) -> Ordering {
self.key.cmp(&other.key) self.key.cmp(&other.key)
} }
} }
impl<K: fmt::Show + TotalOrd, V: fmt::Show> fmt::Show for LeafElt<K, V> { impl<K: fmt::Show + Ord, V: fmt::Show> fmt::Show for LeafElt<K, V> {
///Returns a string representation of a LeafElt. ///Returns a string representation of a LeafElt.
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "Key: {}, value: {};", self.key, self.value) write!(f, "Key: {}, value: {};", self.key, self.value)
} }
} }
impl<K: TotalOrd, V> BranchElt<K, V> { impl<K: Ord, V> BranchElt<K, V> {
///Creates a new BranchElt from a supplied key, value, and left child. ///Creates a new BranchElt from a supplied key, value, and left child.
fn new(k: K, v: V, n: Box<Node<K, V>>) -> BranchElt<K, V> { fn new(k: K, v: V, n: Box<Node<K, V>>) -> BranchElt<K, V> {
BranchElt { BranchElt {
@ -731,7 +731,7 @@ impl<K: TotalOrd, V> BranchElt<K, V> {
} }
impl<K: Clone + TotalOrd, V: Clone> Clone for BranchElt<K, V> { impl<K: Clone + Ord, V: Clone> Clone for BranchElt<K, V> {
///Returns a new BranchElt by cloning the key, value, and left child. ///Returns a new BranchElt by cloning the key, value, and left child.
fn clone(&self) -> BranchElt<K, V> { fn clone(&self) -> BranchElt<K, V> {
BranchElt::new(self.key.clone(), BranchElt::new(self.key.clone(),
@ -740,28 +740,28 @@ impl<K: Clone + TotalOrd, V: Clone> Clone for BranchElt<K, V> {
} }
} }
impl<K: TotalOrd, V: TotalEq> PartialEq for BranchElt<K, V>{ impl<K: Ord, V: Eq> PartialEq for BranchElt<K, V>{
fn eq(&self, other: &BranchElt<K, V>) -> bool { fn eq(&self, other: &BranchElt<K, V>) -> bool {
self.key == other.key && self.value == other.value self.key == other.key && self.value == other.value
} }
} }
impl<K: TotalOrd, V: TotalEq> TotalEq for BranchElt<K, V>{} impl<K: Ord, V: Eq> Eq for BranchElt<K, V>{}
impl<K: TotalOrd, V: TotalEq> PartialOrd for BranchElt<K, V> { impl<K: Ord, V: Eq> PartialOrd for BranchElt<K, V> {
fn lt(&self, other: &BranchElt<K, V>) -> bool { fn lt(&self, other: &BranchElt<K, V>) -> bool {
self.cmp(other) == Less self.cmp(other) == Less
} }
} }
impl<K: TotalOrd, V: TotalEq> TotalOrd for BranchElt<K, V> { impl<K: Ord, V: Eq> Ord for BranchElt<K, V> {
///Fulfills TotalOrd for BranchElts ///Fulfills Ord for BranchElts
fn cmp(&self, other: &BranchElt<K, V>) -> Ordering { fn cmp(&self, other: &BranchElt<K, V>) -> Ordering {
self.key.cmp(&other.key) self.key.cmp(&other.key)
} }
} }
impl<K: fmt::Show + TotalOrd, V: fmt::Show> fmt::Show for BranchElt<K, V> { impl<K: fmt::Show + Ord, V: fmt::Show> fmt::Show for BranchElt<K, V> {
/// Returns string containing key, value, and child (which should recur to a /// Returns string containing key, value, and child (which should recur to a
/// leaf) Consider changing in future to be more readable. /// leaf) Consider changing in future to be more readable.
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {

View file

@ -388,7 +388,7 @@ impl<T> DList<T> {
} }
} }
impl<T: TotalOrd> DList<T> { impl<T: Ord> DList<T> {
/// Insert `elt` sorted in ascending order /// Insert `elt` sorted in ascending order
/// ///
/// O(N) /// O(N)

View file

@ -15,7 +15,7 @@
use std::num::Bitwise; use std::num::Bitwise;
#[deriving(Clone, PartialEq, TotalEq, Hash, Show)] #[deriving(Clone, PartialEq, Eq, Hash, Show)]
/// A specialized Set implementation to use enum types. /// A specialized Set implementation to use enum types.
pub struct EnumSet<E> { pub struct EnumSet<E> {
// We must maintain the invariant that no bits are set // We must maintain the invariant that no bits are set

View file

@ -12,7 +12,7 @@
use std::container::{Container, Mutable, Map, MutableMap, Set, MutableSet}; use std::container::{Container, Mutable, Map, MutableMap, Set, MutableSet};
use std::clone::Clone; use std::clone::Clone;
use std::cmp::{PartialEq, TotalEq, Equiv, max}; use std::cmp::{PartialEq, Eq, Equiv, max};
use std::default::Default; use std::default::Default;
use std::fmt; use std::fmt;
use std::fmt::Show; use std::fmt::Show;
@ -733,7 +733,7 @@ fn grow_at(capacity: uint, load_factor: Fraction) -> uint {
fraction_mul(capacity, load_factor) fraction_mul(capacity, load_factor)
} }
impl<K: TotalEq + Hash<S>, V, S, H: Hasher<S>> HashMap<K, V, H> { impl<K: Eq + Hash<S>, V, S, H: Hasher<S>> HashMap<K, V, H> {
/// Get the number of elements which will force the capacity to shrink. /// Get the number of elements which will force the capacity to shrink.
/// When size == self.shrink_at(), we halve the capacity. /// When size == self.shrink_at(), we halve the capacity.
fn shrink_at(&self) -> uint { fn shrink_at(&self) -> uint {
@ -925,12 +925,12 @@ impl<K: TotalEq + Hash<S>, V, S, H: Hasher<S>> HashMap<K, V, H> {
} }
} }
impl<K: TotalEq + Hash<S>, V, S, H: Hasher<S>> Container for HashMap<K, V, H> { impl<K: Eq + Hash<S>, V, S, H: Hasher<S>> Container for HashMap<K, V, H> {
/// Return the number of elements in the map /// Return the number of elements in the map
fn len(&self) -> uint { self.table.size() } fn len(&self) -> uint { self.table.size() }
} }
impl<K: TotalEq + Hash<S>, V, S, H: Hasher<S>> Mutable for HashMap<K, V, H> { impl<K: Eq + Hash<S>, V, S, H: Hasher<S>> Mutable for HashMap<K, V, H> {
/// Clear the map, removing all key-value pairs. /// Clear the map, removing all key-value pairs.
fn clear(&mut self) { fn clear(&mut self) {
self.minimum_capacity = self.table.size(); self.minimum_capacity = self.table.size();
@ -945,7 +945,7 @@ impl<K: TotalEq + Hash<S>, V, S, H: Hasher<S>> Mutable for HashMap<K, V, H> {
} }
impl<K: TotalEq + Hash<S>, V, S, H: Hasher<S>> Map<K, V> for HashMap<K, V, H> { impl<K: Eq + Hash<S>, V, S, H: Hasher<S>> Map<K, V> for HashMap<K, V, H> {
fn find<'a>(&'a self, k: &K) -> Option<&'a V> { fn find<'a>(&'a self, k: &K) -> Option<&'a V> {
self.search(k).map(|idx| { self.search(k).map(|idx| {
let (_, v) = self.table.read(&idx); let (_, v) = self.table.read(&idx);
@ -958,7 +958,7 @@ impl<K: TotalEq + Hash<S>, V, S, H: Hasher<S>> Map<K, V> for HashMap<K, V, H> {
} }
} }
impl<K: TotalEq + Hash<S>, V, S, H: Hasher<S>> MutableMap<K, V> for HashMap<K, V, H> { impl<K: Eq + Hash<S>, V, S, H: Hasher<S>> MutableMap<K, V> for HashMap<K, V, H> {
fn find_mut<'a>(&'a mut self, k: &K) -> Option<&'a mut V> { fn find_mut<'a>(&'a mut self, k: &K) -> Option<&'a mut V> {
match self.search(k) { match self.search(k) {
None => None, None => None,
@ -1027,7 +1027,7 @@ impl<K: TotalEq + Hash<S>, V, S, H: Hasher<S>> MutableMap<K, V> for HashMap<K, V
} }
impl<K: Hash + TotalEq, V> HashMap<K, V, sip::SipHasher> { impl<K: Hash + Eq, V> HashMap<K, V, sip::SipHasher> {
/// Create an empty HashMap. /// Create an empty HashMap.
pub fn new() -> HashMap<K, V, sip::SipHasher> { pub fn new() -> HashMap<K, V, sip::SipHasher> {
HashMap::with_capacity(INITIAL_CAPACITY) HashMap::with_capacity(INITIAL_CAPACITY)
@ -1042,7 +1042,7 @@ impl<K: Hash + TotalEq, V> HashMap<K, V, sip::SipHasher> {
} }
} }
impl<K: TotalEq + Hash<S>, V, S, H: Hasher<S>> HashMap<K, V, H> { impl<K: Eq + Hash<S>, V, S, H: Hasher<S>> HashMap<K, V, H> {
pub fn with_hasher(hasher: H) -> HashMap<K, V, H> { pub fn with_hasher(hasher: H) -> HashMap<K, V, H> {
HashMap::with_capacity_and_hasher(INITIAL_CAPACITY, hasher) HashMap::with_capacity_and_hasher(INITIAL_CAPACITY, hasher)
} }
@ -1390,7 +1390,7 @@ impl<K: TotalEq + Hash<S>, V, S, H: Hasher<S>> HashMap<K, V, H> {
} }
} }
impl<K: TotalEq + Hash<S>, V: Clone, S, H: Hasher<S>> HashMap<K, V, H> { impl<K: Eq + Hash<S>, V: Clone, S, H: Hasher<S>> HashMap<K, V, H> {
/// Like `find`, but returns a copy of the value. /// Like `find`, but returns a copy of the value.
pub fn find_copy(&self, k: &K) -> Option<V> { pub fn find_copy(&self, k: &K) -> Option<V> {
self.find(k).map(|v| (*v).clone()) self.find(k).map(|v| (*v).clone())
@ -1402,7 +1402,7 @@ impl<K: TotalEq + Hash<S>, V: Clone, S, H: Hasher<S>> HashMap<K, V, H> {
} }
} }
impl<K: TotalEq + Hash<S>, V: PartialEq, S, H: Hasher<S>> PartialEq for HashMap<K, V, H> { impl<K: Eq + Hash<S>, V: PartialEq, S, H: Hasher<S>> PartialEq for HashMap<K, V, H> {
fn eq(&self, other: &HashMap<K, V, H>) -> bool { fn eq(&self, other: &HashMap<K, V, H>) -> bool {
if self.len() != other.len() { return false; } if self.len() != other.len() { return false; }
@ -1416,7 +1416,7 @@ impl<K: TotalEq + Hash<S>, V: PartialEq, S, H: Hasher<S>> PartialEq for HashMap<
} }
} }
impl<K: TotalEq + Hash<S> + Show, V: Show, S, H: Hasher<S>> Show for HashMap<K, V, H> { impl<K: Eq + Hash<S> + Show, V: Show, S, H: Hasher<S>> Show for HashMap<K, V, H> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
try!(write!(f, r"\{")); try!(write!(f, r"\{"));
@ -1429,7 +1429,7 @@ impl<K: TotalEq + Hash<S> + Show, V: Show, S, H: Hasher<S>> Show for HashMap<K,
} }
} }
impl<K: TotalEq + Hash<S>, V, S, H: Hasher<S> + Default> Default for HashMap<K, V, H> { impl<K: Eq + Hash<S>, V, S, H: Hasher<S> + Default> Default for HashMap<K, V, H> {
fn default() -> HashMap<K, V, H> { fn default() -> HashMap<K, V, H> {
HashMap::with_hasher(Default::default()) HashMap::with_hasher(Default::default())
} }
@ -1453,7 +1453,7 @@ pub type Keys<'a, K, V> =
pub type Values<'a, K, V> = pub type Values<'a, K, V> =
iter::Map<'static, (&'a K, &'a V), &'a V, Entries<'a, K, V>>; iter::Map<'static, (&'a K, &'a V), &'a V, Entries<'a, K, V>>;
impl<K: TotalEq + Hash<S>, V, S, H: Hasher<S> + Default> FromIterator<(K, V)> for HashMap<K, V, H> { impl<K: Eq + Hash<S>, V, S, H: Hasher<S> + Default> FromIterator<(K, V)> for HashMap<K, V, H> {
fn from_iter<T: Iterator<(K, V)>>(iter: T) -> HashMap<K, V, H> { fn from_iter<T: Iterator<(K, V)>>(iter: T) -> HashMap<K, V, H> {
let (lower, _) = iter.size_hint(); let (lower, _) = iter.size_hint();
let mut map = HashMap::with_capacity_and_hasher(lower, Default::default()); let mut map = HashMap::with_capacity_and_hasher(lower, Default::default());
@ -1462,7 +1462,7 @@ impl<K: TotalEq + Hash<S>, V, S, H: Hasher<S> + Default> FromIterator<(K, V)> fo
} }
} }
impl<K: TotalEq + Hash<S>, V, S, H: Hasher<S> + Default> Extendable<(K, V)> for HashMap<K, V, H> { impl<K: Eq + Hash<S>, V, S, H: Hasher<S> + Default> Extendable<(K, V)> for HashMap<K, V, H> {
fn extend<T: Iterator<(K, V)>>(&mut self, mut iter: T) { fn extend<T: Iterator<(K, V)>>(&mut self, mut iter: T) {
for (k, v) in iter { for (k, v) in iter {
self.insert(k, v); self.insert(k, v);
@ -1486,7 +1486,7 @@ pub struct HashSet<T, H = sip::SipHasher> {
map: HashMap<T, (), H> map: HashMap<T, (), H>
} }
impl<T: TotalEq + Hash<S>, S, H: Hasher<S>> PartialEq for HashSet<T, H> { impl<T: Eq + Hash<S>, S, H: Hasher<S>> PartialEq for HashSet<T, H> {
fn eq(&self, other: &HashSet<T, H>) -> bool { fn eq(&self, other: &HashSet<T, H>) -> bool {
if self.len() != other.len() { return false; } if self.len() != other.len() { return false; }
@ -1494,15 +1494,15 @@ impl<T: TotalEq + Hash<S>, S, H: Hasher<S>> PartialEq for HashSet<T, H> {
} }
} }
impl<T: TotalEq + Hash<S>, S, H: Hasher<S>> Container for HashSet<T, H> { impl<T: Eq + Hash<S>, S, H: Hasher<S>> Container for HashSet<T, H> {
fn len(&self) -> uint { self.map.len() } fn len(&self) -> uint { self.map.len() }
} }
impl<T: TotalEq + Hash<S>, S, H: Hasher<S>> Mutable for HashSet<T, H> { impl<T: Eq + Hash<S>, S, H: Hasher<S>> Mutable for HashSet<T, H> {
fn clear(&mut self) { self.map.clear() } fn clear(&mut self) { self.map.clear() }
} }
impl<T: TotalEq + Hash<S>, S, H: Hasher<S>> Set<T> for HashSet<T, H> { impl<T: Eq + Hash<S>, S, H: Hasher<S>> Set<T> for HashSet<T, H> {
fn contains(&self, value: &T) -> bool { self.map.contains_key(value) } fn contains(&self, value: &T) -> bool { self.map.contains_key(value) }
fn is_disjoint(&self, other: &HashSet<T, H>) -> bool { fn is_disjoint(&self, other: &HashSet<T, H>) -> bool {
@ -1514,13 +1514,13 @@ impl<T: TotalEq + Hash<S>, S, H: Hasher<S>> Set<T> for HashSet<T, H> {
} }
} }
impl<T: TotalEq + Hash<S>, S, H: Hasher<S>> MutableSet<T> for HashSet<T, H> { impl<T: Eq + Hash<S>, S, H: Hasher<S>> MutableSet<T> for HashSet<T, H> {
fn insert(&mut self, value: T) -> bool { self.map.insert(value, ()) } fn insert(&mut self, value: T) -> bool { self.map.insert(value, ()) }
fn remove(&mut self, value: &T) -> bool { self.map.remove(value) } fn remove(&mut self, value: &T) -> bool { self.map.remove(value) }
} }
impl<T: Hash + TotalEq> HashSet<T, sip::SipHasher> { impl<T: Hash + Eq> HashSet<T, sip::SipHasher> {
/// Create an empty HashSet /// Create an empty HashSet
pub fn new() -> HashSet<T, sip::SipHasher> { pub fn new() -> HashSet<T, sip::SipHasher> {
HashSet::with_capacity(INITIAL_CAPACITY) HashSet::with_capacity(INITIAL_CAPACITY)
@ -1533,7 +1533,7 @@ impl<T: Hash + TotalEq> HashSet<T, sip::SipHasher> {
} }
} }
impl<T: TotalEq + Hash<S>, S, H: Hasher<S>> HashSet<T, H> { impl<T: Eq + Hash<S>, S, H: Hasher<S>> HashSet<T, H> {
pub fn with_hasher(hasher: H) -> HashSet<T, H> { pub fn with_hasher(hasher: H) -> HashSet<T, H> {
HashSet::with_capacity_and_hasher(INITIAL_CAPACITY, hasher) HashSet::with_capacity_and_hasher(INITIAL_CAPACITY, hasher)
} }
@ -1603,7 +1603,7 @@ impl<T: TotalEq + Hash<S>, S, H: Hasher<S>> HashSet<T, H> {
} }
} }
impl<T: TotalEq + Hash<S> + fmt::Show, S, H: Hasher<S>> fmt::Show for HashSet<T, H> { impl<T: Eq + Hash<S> + fmt::Show, S, H: Hasher<S>> fmt::Show for HashSet<T, H> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
try!(write!(f, r"\{")); try!(write!(f, r"\{"));
@ -1616,7 +1616,7 @@ impl<T: TotalEq + Hash<S> + fmt::Show, S, H: Hasher<S>> fmt::Show for HashSet<T,
} }
} }
impl<T: TotalEq + Hash<S>, S, H: Hasher<S> + Default> FromIterator<T> for HashSet<T, H> { impl<T: Eq + Hash<S>, S, H: Hasher<S> + Default> FromIterator<T> for HashSet<T, H> {
fn from_iter<I: Iterator<T>>(iter: I) -> HashSet<T, H> { fn from_iter<I: Iterator<T>>(iter: I) -> HashSet<T, H> {
let (lower, _) = iter.size_hint(); let (lower, _) = iter.size_hint();
let mut set = HashSet::with_capacity_and_hasher(lower, Default::default()); let mut set = HashSet::with_capacity_and_hasher(lower, Default::default());
@ -1625,7 +1625,7 @@ impl<T: TotalEq + Hash<S>, S, H: Hasher<S> + Default> FromIterator<T> for HashSe
} }
} }
impl<T: TotalEq + Hash<S>, S, H: Hasher<S> + Default> Extendable<T> for HashSet<T, H> { impl<T: Eq + Hash<S>, S, H: Hasher<S> + Default> Extendable<T> for HashSet<T, H> {
fn extend<I: Iterator<T>>(&mut self, mut iter: I) { fn extend<I: Iterator<T>>(&mut self, mut iter: I) {
for k in iter { for k in iter {
self.insert(k); self.insert(k);
@ -1633,7 +1633,7 @@ impl<T: TotalEq + Hash<S>, S, H: Hasher<S> + Default> Extendable<T> for HashSet<
} }
} }
impl<T: TotalEq + Hash> Default for HashSet<T, sip::SipHasher> { impl<T: Eq + Hash> Default for HashSet<T, sip::SipHasher> {
fn default() -> HashSet<T> { HashSet::new() } fn default() -> HashSet<T> { HashSet::new() }
} }
@ -1691,7 +1691,7 @@ mod test_map {
local_data_key!(drop_vector: RefCell<Vec<int>>) local_data_key!(drop_vector: RefCell<Vec<int>>)
#[deriving(Hash, PartialEq, TotalEq)] #[deriving(Hash, PartialEq, Eq)]
struct Dropable { struct Dropable {
k: uint k: uint
} }

View file

@ -73,7 +73,7 @@ impl<K: PartialEq> PartialEq for KeyRef<K> {
} }
} }
impl<K: TotalEq> TotalEq for KeyRef<K> {} impl<K: Eq> Eq for KeyRef<K> {}
impl<K, V> LruEntry<K, V> { impl<K, V> LruEntry<K, V> {
fn new(k: K, v: V) -> LruEntry<K, V> { fn new(k: K, v: V) -> LruEntry<K, V> {
@ -86,7 +86,7 @@ impl<K, V> LruEntry<K, V> {
} }
} }
impl<K: Hash + TotalEq, V> LruCache<K, V> { impl<K: Hash + Eq, V> LruCache<K, V> {
/// Create an LRU Cache that holds at most `capacity` items. /// Create an LRU Cache that holds at most `capacity` items.
pub fn new(capacity: uint) -> LruCache<K, V> { pub fn new(capacity: uint) -> LruCache<K, V> {
let cache = LruCache { let cache = LruCache {
@ -201,7 +201,7 @@ impl<K: Hash + TotalEq, V> LruCache<K, V> {
} }
} }
impl<A: fmt::Show + Hash + TotalEq, B: fmt::Show> fmt::Show for LruCache<A, B> { impl<A: fmt::Show + Hash + Eq, B: fmt::Show> fmt::Show for LruCache<A, B> {
/// Return a string that lists the key-value pairs from most-recently /// Return a string that lists the key-value pairs from most-recently
/// used to least-recently used. /// used to least-recently used.
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
@ -222,14 +222,14 @@ impl<A: fmt::Show + Hash + TotalEq, B: fmt::Show> fmt::Show for LruCache<A, B> {
} }
} }
impl<K: Hash + TotalEq, V> Container for LruCache<K, V> { impl<K: Hash + Eq, V> Container for LruCache<K, V> {
/// Return the number of key-value pairs in the cache. /// Return the number of key-value pairs in the cache.
fn len(&self) -> uint { fn len(&self) -> uint {
self.map.len() self.map.len()
} }
} }
impl<K: Hash + TotalEq, V> Mutable for LruCache<K, V> { impl<K: Hash + Eq, V> Mutable for LruCache<K, V> {
/// Clear the cache of all key-value pairs. /// Clear the cache of all key-value pairs.
fn clear(&mut self) { fn clear(&mut self) {
self.map.clear(); self.map.clear();

View file

@ -22,17 +22,17 @@ pub struct PriorityQueue<T> {
data: Vec<T>, data: Vec<T>,
} }
impl<T: TotalOrd> Container for PriorityQueue<T> { impl<T: Ord> Container for PriorityQueue<T> {
/// Returns the length of the queue /// Returns the length of the queue
fn len(&self) -> uint { self.data.len() } fn len(&self) -> uint { self.data.len() }
} }
impl<T: TotalOrd> Mutable for PriorityQueue<T> { impl<T: Ord> Mutable for PriorityQueue<T> {
/// Drop all items from the queue /// Drop all items from the queue
fn clear(&mut self) { self.data.truncate(0) } fn clear(&mut self) { self.data.truncate(0) }
} }
impl<T: TotalOrd> PriorityQueue<T> { impl<T: Ord> PriorityQueue<T> {
/// An iterator visiting all values in underlying vector, in /// An iterator visiting all values in underlying vector, in
/// arbitrary order. /// arbitrary order.
pub fn iter<'a>(&'a self) -> Items<'a, T> { 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<uint>) { self.iter.size_hint() } fn size_hint(&self) -> (uint, Option<uint>) { self.iter.size_hint() }
} }
impl<T: TotalOrd> FromIterator<T> for PriorityQueue<T> { impl<T: Ord> FromIterator<T> for PriorityQueue<T> {
fn from_iter<Iter: Iterator<T>>(iter: Iter) -> PriorityQueue<T> { fn from_iter<Iter: Iterator<T>>(iter: Iter) -> PriorityQueue<T> {
let mut q = PriorityQueue::new(); let mut q = PriorityQueue::new();
q.extend(iter); q.extend(iter);
@ -222,7 +222,7 @@ impl<T: TotalOrd> FromIterator<T> for PriorityQueue<T> {
} }
} }
impl<T: TotalOrd> Extendable<T> for PriorityQueue<T> { impl<T: Ord> Extendable<T> for PriorityQueue<T> {
fn extend<Iter: Iterator<T>>(&mut self, mut iter: Iter) { fn extend<Iter: Iterator<T>>(&mut self, mut iter: Iter) {
let (lower, _) = iter.size_hint(); let (lower, _) = iter.size_hint();

View file

@ -10,7 +10,7 @@
//! An ordered map and set implemented as self-balancing binary search //! An ordered map and set implemented as self-balancing binary search
//! trees. The only requirement for the types is that the key implements //! trees. The only requirement for the types is that the key implements
//! `TotalOrd`. //! `Ord`.
use std::cmp::Ordering; use std::cmp::Ordering;
use std::fmt::Show; use std::fmt::Show;
@ -43,7 +43,7 @@ pub struct TreeMap<K, V> {
length: uint length: uint
} }
impl<K: PartialEq + TotalOrd, V: PartialEq> PartialEq for TreeMap<K, V> { impl<K: PartialEq + Ord, V: PartialEq> PartialEq for TreeMap<K, V> {
fn eq(&self, other: &TreeMap<K, V>) -> bool { fn eq(&self, other: &TreeMap<K, V>) -> bool {
self.len() == other.len() && self.len() == other.len() &&
self.iter().zip(other.iter()).all(|(a, b)| a == b) self.iter().zip(other.iter()).all(|(a, b)| a == b)
@ -51,7 +51,7 @@ impl<K: PartialEq + TotalOrd, V: PartialEq> PartialEq for TreeMap<K, V> {
} }
// Lexicographical comparison // Lexicographical comparison
fn lt<K: PartialOrd + TotalOrd, V: PartialOrd>(a: &TreeMap<K, V>, fn lt<K: PartialOrd + Ord, V: PartialOrd>(a: &TreeMap<K, V>,
b: &TreeMap<K, V>) -> bool { b: &TreeMap<K, V>) -> bool {
// the Zip iterator is as long as the shortest of a and b. // 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()) { for ((key_a, value_a), (key_b, value_b)) in a.iter().zip(b.iter()) {
@ -64,12 +64,12 @@ fn lt<K: PartialOrd + TotalOrd, V: PartialOrd>(a: &TreeMap<K, V>,
a.len() < b.len() a.len() < b.len()
} }
impl<K: PartialOrd + TotalOrd, V: PartialOrd> PartialOrd for TreeMap<K, V> { impl<K: PartialOrd + Ord, V: PartialOrd> PartialOrd for TreeMap<K, V> {
#[inline] #[inline]
fn lt(&self, other: &TreeMap<K, V>) -> bool { lt(self, other) } fn lt(&self, other: &TreeMap<K, V>) -> bool { lt(self, other) }
} }
impl<K: TotalOrd + Show, V: Show> Show for TreeMap<K, V> { impl<K: Ord + Show, V: Show> Show for TreeMap<K, V> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
try!(write!(f, r"\{")); try!(write!(f, r"\{"));
@ -82,18 +82,18 @@ impl<K: TotalOrd + Show, V: Show> Show for TreeMap<K, V> {
} }
} }
impl<K: TotalOrd, V> Container for TreeMap<K, V> { impl<K: Ord, V> Container for TreeMap<K, V> {
fn len(&self) -> uint { self.length } fn len(&self) -> uint { self.length }
} }
impl<K: TotalOrd, V> Mutable for TreeMap<K, V> { impl<K: Ord, V> Mutable for TreeMap<K, V> {
fn clear(&mut self) { fn clear(&mut self) {
self.root = None; self.root = None;
self.length = 0 self.length = 0
} }
} }
impl<K: TotalOrd, V> Map<K, V> for TreeMap<K, V> { impl<K: Ord, V> Map<K, V> for TreeMap<K, V> {
fn find<'a>(&'a self, key: &K) -> Option<&'a V> { fn find<'a>(&'a self, key: &K) -> Option<&'a V> {
let mut current: &'a Option<Box<TreeNode<K, V>>> = &self.root; let mut current: &'a Option<Box<TreeNode<K, V>>> = &self.root;
loop { loop {
@ -111,7 +111,7 @@ impl<K: TotalOrd, V> Map<K, V> for TreeMap<K, V> {
} }
} }
impl<K: TotalOrd, V> MutableMap<K, V> for TreeMap<K, V> { impl<K: Ord, V> MutableMap<K, V> for TreeMap<K, V> {
#[inline] #[inline]
fn find_mut<'a>(&'a mut self, key: &K) -> Option<&'a mut V> { fn find_mut<'a>(&'a mut self, key: &K) -> Option<&'a mut V> {
find_mut(&mut self.root, key) find_mut(&mut self.root, key)
@ -130,7 +130,7 @@ impl<K: TotalOrd, V> MutableMap<K, V> for TreeMap<K, V> {
} }
} }
impl<K: TotalOrd, V> TreeMap<K, V> { impl<K: Ord, V> TreeMap<K, V> {
/// Create an empty TreeMap /// Create an empty TreeMap
pub fn new() -> TreeMap<K, V> { TreeMap{root: None, length: 0} } pub fn new() -> TreeMap<K, V> { TreeMap{root: None, length: 0} }
@ -216,7 +216,7 @@ macro_rules! bound_setup {
} }
impl<K: TotalOrd, V> TreeMap<K, V> { impl<K: Ord, V> TreeMap<K, V> {
/// Get a lazy iterator that should be initialized using /// Get a lazy iterator that should be initialized using
/// `traverse_left`/`traverse_right`/`traverse_complete`. /// `traverse_left`/`traverse_right`/`traverse_complete`.
fn iter_for_traversal<'a>(&'a self) -> Entries<'a, K, V> { 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 /// 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 /// only requirement is that the type of the elements contained ascribes to the
/// `TotalOrd` trait. /// `Ord` trait.
#[deriving(Clone)] #[deriving(Clone)]
pub struct TreeSet<T> { pub struct TreeSet<T> {
map: TreeMap<T, ()> map: TreeMap<T, ()>
} }
impl<T: PartialEq + TotalOrd> PartialEq for TreeSet<T> { impl<T: PartialEq + Ord> PartialEq for TreeSet<T> {
#[inline] #[inline]
fn eq(&self, other: &TreeSet<T>) -> bool { self.map == other.map } fn eq(&self, other: &TreeSet<T>) -> bool { self.map == other.map }
} }
impl<T: PartialOrd + TotalOrd> PartialOrd for TreeSet<T> { impl<T: PartialOrd + Ord> PartialOrd for TreeSet<T> {
#[inline] #[inline]
fn lt(&self, other: &TreeSet<T>) -> bool { self.map < other.map } fn lt(&self, other: &TreeSet<T>) -> bool { self.map < other.map }
} }
impl<T: TotalOrd + Show> Show for TreeSet<T> { impl<T: Ord + Show> Show for TreeSet<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
try!(write!(f, r"\{")); try!(write!(f, r"\{"));
@ -575,17 +575,17 @@ impl<T: TotalOrd + Show> Show for TreeSet<T> {
} }
} }
impl<T: TotalOrd> Container for TreeSet<T> { impl<T: Ord> Container for TreeSet<T> {
#[inline] #[inline]
fn len(&self) -> uint { self.map.len() } fn len(&self) -> uint { self.map.len() }
} }
impl<T: TotalOrd> Mutable for TreeSet<T> { impl<T: Ord> Mutable for TreeSet<T> {
#[inline] #[inline]
fn clear(&mut self) { self.map.clear() } fn clear(&mut self) { self.map.clear() }
} }
impl<T: TotalOrd> Set<T> for TreeSet<T> { impl<T: Ord> Set<T> for TreeSet<T> {
#[inline] #[inline]
fn contains(&self, value: &T) -> bool { fn contains(&self, value: &T) -> bool {
self.map.contains_key(value) self.map.contains_key(value)
@ -620,7 +620,7 @@ impl<T: TotalOrd> Set<T> for TreeSet<T> {
} }
} }
impl<T: TotalOrd> MutableSet<T> for TreeSet<T> { impl<T: Ord> MutableSet<T> for TreeSet<T> {
#[inline] #[inline]
fn insert(&mut self, value: T) -> bool { self.map.insert(value, ()) } fn insert(&mut self, value: T) -> bool { self.map.insert(value, ()) }
@ -628,7 +628,7 @@ impl<T: TotalOrd> MutableSet<T> for TreeSet<T> {
fn remove(&mut self, value: &T) -> bool { self.map.remove(value) } fn remove(&mut self, value: &T) -> bool { self.map.remove(value) }
} }
impl<T: TotalOrd> TreeSet<T> { impl<T: Ord> TreeSet<T> {
/// Create an empty TreeSet /// Create an empty TreeSet
#[inline] #[inline]
pub fn new() -> TreeSet<T> { TreeSet{map: TreeMap::new()} } pub fn new() -> TreeSet<T> { 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 /// Compare `x` and `y`, but return `short` if x is None and `long` if y is None
fn cmp_opt<T: TotalOrd>(x: Option<&T>, y: Option<&T>, fn cmp_opt<T: Ord>(x: Option<&T>, y: Option<&T>,
short: Ordering, long: Ordering) -> Ordering { short: Ordering, long: Ordering) -> Ordering {
match (x, y) { match (x, y) {
(None , _ ) => short, (None , _ ) => short,
@ -737,7 +737,7 @@ fn cmp_opt<T: TotalOrd>(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> { fn next(&mut self) -> Option<&'a T> {
loop { loop {
match cmp_opt(self.a.peek(), self.b.peek(), Less, Less) { 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> { fn next(&mut self) -> Option<&'a T> {
loop { loop {
match cmp_opt(self.a.peek(), self.b.peek(), Greater, Less) { 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> { fn next(&mut self) -> Option<&'a T> {
loop { loop {
let o_cmp = match (self.a.peek(), self.b.peek()) { 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> { fn next(&mut self) -> Option<&'a T> {
loop { loop {
match cmp_opt(self.a.peek(), self.b.peek(), Greater, Less) { match cmp_opt(self.a.peek(), self.b.peek(), Greater, Less) {
@ -803,7 +803,7 @@ struct TreeNode<K, V> {
level: uint level: uint
} }
impl<K: TotalOrd, V> TreeNode<K, V> { impl<K: Ord, V> TreeNode<K, V> {
/// Creates a new tree node. /// Creates a new tree node.
#[inline] #[inline]
pub fn new(key: K, value: V) -> TreeNode<K, V> { pub fn new(key: K, value: V) -> TreeNode<K, V> {
@ -812,7 +812,7 @@ impl<K: TotalOrd, V> TreeNode<K, V> {
} }
// Remove left horizontal link by rotating right // Remove left horizontal link by rotating right
fn skew<K: TotalOrd, V>(node: &mut Box<TreeNode<K, V>>) { fn skew<K: Ord, V>(node: &mut Box<TreeNode<K, V>>) {
if node.left.as_ref().map_or(false, |x| x.level == node.level) { if node.left.as_ref().map_or(false, |x| x.level == node.level) {
let mut save = node.left.take_unwrap(); let mut save = node.left.take_unwrap();
swap(&mut node.left, &mut save.right); // save.right now None swap(&mut node.left, &mut save.right); // save.right now None
@ -823,7 +823,7 @@ fn skew<K: TotalOrd, V>(node: &mut Box<TreeNode<K, V>>) {
// Remove dual horizontal link by rotating left and increasing level of // Remove dual horizontal link by rotating left and increasing level of
// the parent // the parent
fn split<K: TotalOrd, V>(node: &mut Box<TreeNode<K, V>>) { fn split<K: Ord, V>(node: &mut Box<TreeNode<K, V>>) {
if node.right.as_ref().map_or(false, if node.right.as_ref().map_or(false,
|x| x.right.as_ref().map_or(false, |y| y.level == node.level)) { |x| x.right.as_ref().map_or(false, |y| y.level == node.level)) {
let mut save = node.right.take_unwrap(); let mut save = node.right.take_unwrap();
@ -834,7 +834,7 @@ fn split<K: TotalOrd, V>(node: &mut Box<TreeNode<K, V>>) {
} }
} }
fn find_mut<'r, K: TotalOrd, V>(node: &'r mut Option<Box<TreeNode<K, V>>>, fn find_mut<'r, K: Ord, V>(node: &'r mut Option<Box<TreeNode<K, V>>>,
key: &K) key: &K)
-> Option<&'r mut V> { -> Option<&'r mut V> {
match *node { match *node {
@ -849,7 +849,7 @@ fn find_mut<'r, K: TotalOrd, V>(node: &'r mut Option<Box<TreeNode<K, V>>>,
} }
} }
fn insert<K: TotalOrd, V>(node: &mut Option<Box<TreeNode<K, V>>>, fn insert<K: Ord, V>(node: &mut Option<Box<TreeNode<K, V>>>,
key: K, value: V) -> Option<V> { key: K, value: V) -> Option<V> {
match *node { match *node {
Some(ref mut save) => { Some(ref mut save) => {
@ -879,9 +879,9 @@ fn insert<K: TotalOrd, V>(node: &mut Option<Box<TreeNode<K, V>>>,
} }
} }
fn remove<K: TotalOrd, V>(node: &mut Option<Box<TreeNode<K, V>>>, fn remove<K: Ord, V>(node: &mut Option<Box<TreeNode<K, V>>>,
key: &K) -> Option<V> { key: &K) -> Option<V> {
fn heir_swap<K: TotalOrd, V>(node: &mut Box<TreeNode<K, V>>, fn heir_swap<K: Ord, V>(node: &mut Box<TreeNode<K, V>>,
child: &mut Option<Box<TreeNode<K, V>>>) { child: &mut Option<Box<TreeNode<K, V>>>) {
// *could* be done without recursion, but it won't borrow check // *could* be done without recursion, but it won't borrow check
for x in child.mut_iter() { for x in child.mut_iter() {
@ -962,7 +962,7 @@ fn remove<K: TotalOrd, V>(node: &mut Option<Box<TreeNode<K, V>>>,
}; };
} }
impl<K: TotalOrd, V> FromIterator<(K, V)> for TreeMap<K, V> { impl<K: Ord, V> FromIterator<(K, V)> for TreeMap<K, V> {
fn from_iter<T: Iterator<(K, V)>>(iter: T) -> TreeMap<K, V> { fn from_iter<T: Iterator<(K, V)>>(iter: T) -> TreeMap<K, V> {
let mut map = TreeMap::new(); let mut map = TreeMap::new();
map.extend(iter); map.extend(iter);
@ -970,7 +970,7 @@ impl<K: TotalOrd, V> FromIterator<(K, V)> for TreeMap<K, V> {
} }
} }
impl<K: TotalOrd, V> Extendable<(K, V)> for TreeMap<K, V> { impl<K: Ord, V> Extendable<(K, V)> for TreeMap<K, V> {
#[inline] #[inline]
fn extend<T: Iterator<(K, V)>>(&mut self, mut iter: T) { fn extend<T: Iterator<(K, V)>>(&mut self, mut iter: T) {
for (k, v) in iter { for (k, v) in iter {
@ -979,7 +979,7 @@ impl<K: TotalOrd, V> Extendable<(K, V)> for TreeMap<K, V> {
} }
} }
impl<T: TotalOrd> FromIterator<T> for TreeSet<T> { impl<T: Ord> FromIterator<T> for TreeSet<T> {
fn from_iter<Iter: Iterator<T>>(iter: Iter) -> TreeSet<T> { fn from_iter<Iter: Iterator<T>>(iter: Iter) -> TreeSet<T> {
let mut set = TreeSet::new(); let mut set = TreeSet::new();
set.extend(iter); set.extend(iter);
@ -987,7 +987,7 @@ impl<T: TotalOrd> FromIterator<T> for TreeSet<T> {
} }
} }
impl<T: TotalOrd> Extendable<T> for TreeSet<T> { impl<T: Ord> Extendable<T> for TreeSet<T> {
#[inline] #[inline]
fn extend<Iter: Iterator<T>>(&mut self, mut iter: Iter) { fn extend<Iter: Iterator<T>>(&mut self, mut iter: Iter) {
for elem in iter { for elem in iter {
@ -1070,7 +1070,7 @@ mod test_treemap {
assert_eq!(m.find(&k1), Some(&v1)); assert_eq!(m.find(&k1), Some(&v1));
} }
fn check_equal<K: PartialEq + TotalOrd, V: PartialEq>(ctrl: &[(K, V)], fn check_equal<K: PartialEq + Ord, V: PartialEq>(ctrl: &[(K, V)],
map: &TreeMap<K, V>) { map: &TreeMap<K, V>) {
assert_eq!(ctrl.is_empty(), map.is_empty()); assert_eq!(ctrl.is_empty(), map.is_empty());
for x in ctrl.iter() { for x in ctrl.iter() {
@ -1091,7 +1091,7 @@ mod test_treemap {
} }
} }
fn check_left<K: TotalOrd, V>(node: &Option<Box<TreeNode<K, V>>>, fn check_left<K: Ord, V>(node: &Option<Box<TreeNode<K, V>>>,
parent: &Box<TreeNode<K, V>>) { parent: &Box<TreeNode<K, V>>) {
match *node { match *node {
Some(ref r) => { Some(ref r) => {
@ -1104,7 +1104,7 @@ mod test_treemap {
} }
} }
fn check_right<K: TotalOrd, V>(node: &Option<Box<TreeNode<K, V>>>, fn check_right<K: Ord, V>(node: &Option<Box<TreeNode<K, V>>>,
parent: &Box<TreeNode<K, V>>, parent: &Box<TreeNode<K, V>>,
parent_red: bool) { parent_red: bool) {
match *node { match *node {
@ -1121,7 +1121,7 @@ mod test_treemap {
} }
} }
fn check_structure<K: TotalOrd, V>(map: &TreeMap<K, V>) { fn check_structure<K: Ord, V>(map: &TreeMap<K, V>) {
match map.root { match map.root {
Some(ref r) => { Some(ref r) => {
check_left(&r.left, r); check_left(&r.left, r);

View file

@ -37,9 +37,6 @@
//! assert!(SketchyNum {num: 25} != SketchyNum {num: 57}); //! 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. /// Trait for values that can be compared for equality and inequality.
/// ///
/// This trait allows partial equality, where types can be unordered instead of /// This trait allows partial equality, where types can be unordered instead of
@ -51,7 +48,7 @@ pub use Ord = self::TotalOrd;
/// default. /// default.
/// ///
/// Eventually, this will be implemented by default for types that implement /// Eventually, this will be implemented by default for types that implement
/// `TotalEq`. /// `Eq`.
#[lang="eq"] #[lang="eq"]
pub trait PartialEq { pub trait PartialEq {
/// This method tests for `self` and `other` values to be equal, and is used by `==`. /// 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`; /// - reflexive: `a == a`;
/// - symmetric: `a == b` implies `b == a`; and /// - symmetric: `a == b` implies `b == a`; and
/// - transitive: `a == b` and `b == c` implies `a == c`. /// - 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 // FIXME #13101: this method is used solely by #[deriving] to
// assert that every component of a type implements #[deriving] // assert that every component of a type implements #[deriving]
// itself, the current deriving infrastructure means doing this // itself, the current deriving infrastructure means doing this
@ -104,7 +101,7 @@ pub enum Ordering {
/// true; and /// true; and
/// - transitive, `a < b` and `b < c` implies `a < c`. The same must hold for /// - transitive, `a < b` and `b < c` implies `a < c`. The same must hold for
/// both `==` and `>`. /// both `==` and `>`.
pub trait TotalOrd: TotalEq + PartialOrd { pub trait Ord: Eq + PartialOrd {
/// This method returns an ordering between `self` and `other` values. /// This method returns an ordering between `self` and `other` values.
/// ///
/// By convention, `self.cmp(&other)` returns the ordering matching /// By convention, `self.cmp(&other)` returns the ordering matching
@ -118,9 +115,9 @@ pub trait TotalOrd: TotalEq + PartialOrd {
fn cmp(&self, other: &Self) -> Ordering; fn cmp(&self, other: &Self) -> Ordering;
} }
impl TotalEq for Ordering {} impl Eq for Ordering {}
impl TotalOrd for Ordering { impl Ord for Ordering {
#[inline] #[inline]
fn cmp(&self, other: &Ordering) -> Ordering { fn cmp(&self, other: &Ordering) -> Ordering {
(*self as int).cmp(&(*other as int)) (*self as int).cmp(&(*other as int))
@ -182,20 +179,20 @@ pub trait Equiv<T> {
/// Compare and return the minimum of two values. /// Compare and return the minimum of two values.
#[inline] #[inline]
pub fn min<T: TotalOrd>(v1: T, v2: T) -> T { pub fn min<T: Ord>(v1: T, v2: T) -> T {
if v1 < v2 { v1 } else { v2 } if v1 < v2 { v1 } else { v2 }
} }
/// Compare and return the maximum of two values. /// Compare and return the maximum of two values.
#[inline] #[inline]
pub fn max<T: TotalOrd>(v1: T, v2: T) -> T { pub fn max<T: Ord>(v1: T, v2: T) -> T {
if v1 > v2 { v1 } else { v2 } 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))] #[cfg(not(test))]
mod impls { mod impls {
use cmp::{PartialOrd, TotalOrd, PartialEq, TotalEq, Ordering, use cmp::{PartialOrd, Ord, PartialEq, Eq, Ordering,
Less, Greater, Equal}; Less, Greater, Equal};
macro_rules! eq_impl( macro_rules! eq_impl(
@ -220,7 +217,7 @@ mod impls {
macro_rules! totaleq_impl( macro_rules! totaleq_impl(
($($t:ty)*) => ($( ($($t:ty)*) => ($(
impl TotalEq for $t {} impl Eq for $t {}
)*) )*)
) )
@ -257,7 +254,7 @@ mod impls {
macro_rules! totalord_impl( macro_rules! totalord_impl(
($($t:ty)*) => ($( ($($t:ty)*) => ($(
impl TotalOrd for $t { impl Ord for $t {
#[inline] #[inline]
fn cmp(&self, other: &$t) -> Ordering { fn cmp(&self, other: &$t) -> Ordering {
if *self < *other { Less } if *self < *other { Less }
@ -268,12 +265,12 @@ mod impls {
)*) )*)
) )
impl TotalOrd for () { impl Ord for () {
#[inline] #[inline]
fn cmp(&self, _other: &()) -> Ordering { Equal } fn cmp(&self, _other: &()) -> Ordering { Equal }
} }
impl TotalOrd for bool { impl Ord for bool {
#[inline] #[inline]
fn cmp(&self, other: &bool) -> Ordering { fn cmp(&self, other: &bool) -> Ordering {
(*self as u8).cmp(&(*other as u8)) (*self as u8).cmp(&(*other as u8))
@ -299,11 +296,11 @@ mod impls {
#[inline] #[inline]
fn gt(&self, other: & &'a T) -> bool { *(*self) > *(*other) } 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] #[inline]
fn cmp(&self, other: & &'a T) -> Ordering { (**self).cmp(*other) } 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 // &mut pointers
impl<'a, T: PartialEq> PartialEq for &'a mut T { impl<'a, T: PartialEq> PartialEq for &'a mut T {
@ -322,11 +319,11 @@ mod impls {
#[inline] #[inline]
fn gt(&self, other: &&'a mut T) -> bool { **self > **other } 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] #[inline]
fn cmp(&self, other: &&'a mut T) -> Ordering { (**self).cmp(*other) } 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 // @ pointers
impl<T:PartialEq> PartialEq for @T { impl<T:PartialEq> PartialEq for @T {
@ -345,11 +342,11 @@ mod impls {
#[inline] #[inline]
fn gt(&self, other: &@T) -> bool { *(*self) > *(*other) } fn gt(&self, other: &@T) -> bool { *(*self) > *(*other) }
} }
impl<T: TotalOrd> TotalOrd for @T { impl<T: Ord> Ord for @T {
#[inline] #[inline]
fn cmp(&self, other: &@T) -> Ordering { (**self).cmp(*other) } fn cmp(&self, other: &@T) -> Ordering { (**self).cmp(*other) }
} }
impl<T: TotalEq> TotalEq for @T {} impl<T: Eq> Eq for @T {}
} }
#[cfg(test)] #[cfg(test)]

View file

@ -550,7 +550,7 @@ extern "rust-intrinsic" {
/// `TypeId` represents a globally unique identifier for a type /// `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 #[lang="type_id"] // This needs to be kept in lockstep with the code in trans/intrinsic.rs and
// middle/lang_items.rs // middle/lang_items.rs
#[deriving(PartialEq, TotalEq, Show)] #[deriving(PartialEq, Eq, Show)]
#[cfg(not(test))] #[cfg(not(test))]
pub struct TypeId { pub struct TypeId {
t: u64, t: u64,

View file

@ -68,7 +68,7 @@ use cmp;
use num::{Zero, One, CheckedAdd, CheckedSub, Saturating, ToPrimitive, Int}; use num::{Zero, One, CheckedAdd, CheckedSub, Saturating, ToPrimitive, Int};
use option::{Option, Some, None}; use option::{Option, Some, None};
use ops::{Add, Mul, Sub}; use ops::{Add, Mul, Sub};
use cmp::{PartialEq, PartialOrd, TotalOrd}; use cmp::{PartialEq, PartialOrd, Ord};
use clone::Clone; use clone::Clone;
use uint; use uint;
use mem; use mem;
@ -611,7 +611,7 @@ pub trait Iterator<A> {
/// assert_eq!(*xs.iter().max_by(|x| x.abs()).unwrap(), -10); /// assert_eq!(*xs.iter().max_by(|x| x.abs()).unwrap(), -10);
/// ``` /// ```
#[inline] #[inline]
fn max_by<B: TotalOrd>(&mut self, f: |&A| -> B) -> Option<A> { fn max_by<B: Ord>(&mut self, f: |&A| -> B) -> Option<A> {
self.fold(None, |max: Option<(A, B)>, x| { self.fold(None, |max: Option<(A, B)>, x| {
let x_val = f(&x); let x_val = f(&x);
match max { match max {
@ -635,7 +635,7 @@ pub trait Iterator<A> {
/// assert_eq!(*xs.iter().min_by(|x| x.abs()).unwrap(), 0); /// assert_eq!(*xs.iter().min_by(|x| x.abs()).unwrap(), 0);
/// ``` /// ```
#[inline] #[inline]
fn min_by<B: TotalOrd>(&mut self, f: |&A| -> B) -> Option<A> { fn min_by<B: Ord>(&mut self, f: |&A| -> B) -> Option<A> {
self.fold(None, |min: Option<(A, B)>, x| { self.fold(None, |min: Option<(A, B)>, x| {
let x_val = f(&x); let x_val = f(&x);
match min { match min {
@ -905,7 +905,7 @@ pub trait OrdIterator<A> {
fn min_max(&mut self) -> MinMaxResult<A>; fn min_max(&mut self) -> MinMaxResult<A>;
} }
impl<A: TotalOrd, T: Iterator<A>> OrdIterator<A> for T { impl<A: Ord, T: Iterator<A>> OrdIterator<A> for T {
#[inline] #[inline]
fn max(&mut self) -> Option<A> { fn max(&mut self) -> Option<A> {
self.fold(None, |max, x| { self.fold(None, |max, x| {
@ -2182,12 +2182,12 @@ impl<A: Clone> RandomAccessIterator<A> for Repeat<A> {
/// the shorter sequence compares less. /// the shorter sequence compares less.
pub mod order { pub mod order {
use cmp; use cmp;
use cmp::{TotalEq, TotalOrd, PartialOrd, PartialEq}; use cmp::{Eq, Ord, PartialOrd, PartialEq};
use option::{Some, None}; use option::{Some, None};
use super::Iterator; use super::Iterator;
/// Compare `a` and `b` for equality using `TotalEq` /// Compare `a` and `b` for equality using `Eq`
pub fn equals<A: TotalEq, T: Iterator<A>, S: Iterator<A>>(mut a: T, mut b: S) -> bool { pub fn equals<A: Eq, T: Iterator<A>, S: Iterator<A>>(mut a: T, mut b: S) -> bool {
loop { loop {
match (a.next(), b.next()) { match (a.next(), b.next()) {
(None, None) => return true, (None, None) => return true,
@ -2197,8 +2197,8 @@ pub mod order {
} }
} }
/// Order `a` and `b` lexicographically using `TotalOrd` /// Order `a` and `b` lexicographically using `Ord`
pub fn cmp<A: TotalOrd, T: Iterator<A>, S: Iterator<A>>(mut a: T, mut b: S) -> cmp::Ordering { pub fn cmp<A: Ord, T: Iterator<A>, S: Iterator<A>>(mut a: T, mut b: S) -> cmp::Ordering {
loop { loop {
match (a.next(), b.next()) { match (a.next(), b.next()) {
(None, None) => return cmp::Equal, (None, None) => return cmp::Equal,

View file

@ -141,14 +141,14 @@
//! } //! }
//! ``` //! ```
use cmp::{PartialEq, TotalEq, TotalOrd}; use cmp::{PartialEq, Eq, Ord};
use default::Default; use default::Default;
use iter::{Iterator, DoubleEndedIterator, FromIterator, ExactSize}; use iter::{Iterator, DoubleEndedIterator, FromIterator, ExactSize};
use mem; use mem;
use slice; use slice;
/// The `Option` /// The `Option`
#[deriving(Clone, PartialEq, PartialOrd, TotalEq, TotalOrd, Show)] #[deriving(Clone, PartialEq, PartialOrd, Eq, Ord, Show)]
pub enum Option<T> { pub enum Option<T> {
/// No value /// No value
None, None,

View file

@ -45,7 +45,7 @@ pub use mem::drop;
pub use char::Char; pub use char::Char;
pub use clone::Clone; 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 cmp::{Ordering, Less, Equal, Greater, Equiv};
pub use container::{Container, Mutable, Map, MutableMap, Set, MutableSet}; pub use container::{Container, Mutable, Map, MutableMap, Set, MutableSet};
pub use iter::{FromIterator, Extendable}; pub use iter::{FromIterator, Extendable};
@ -59,6 +59,6 @@ pub use str::{Str, StrSlice};
pub use tuple::{Tuple1, Tuple2, Tuple3, Tuple4}; pub use tuple::{Tuple1, Tuple2, Tuple3, Tuple4};
pub use tuple::{Tuple5, Tuple6, Tuple7, Tuple8}; pub use tuple::{Tuple5, Tuple6, Tuple7, Tuple8};
pub use tuple::{Tuple9, Tuple10, Tuple11, Tuple12}; pub use tuple::{Tuple9, Tuple10, Tuple11, Tuple12};
pub use slice::{ImmutableEqVector, ImmutableTotalOrdVector}; pub use slice::{ImmutableEqVector, ImmutableOrdVector};
pub use slice::{MutableVector}; pub use slice::{MutableVector};
pub use slice::{Vector, ImmutableVector}; pub use slice::{Vector, ImmutableVector};

View file

@ -93,7 +93,7 @@ use intrinsics;
use iter::{range, Iterator}; use iter::{range, Iterator};
use option::{Some, None, Option}; 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`. /// Return the offset of the first null pointer in `buf`.
#[inline] #[inline]
@ -396,7 +396,7 @@ impl<T> PartialEq for *T {
} }
#[cfg(not(test))] #[cfg(not(test))]
impl<T> TotalEq for *T {} impl<T> Eq for *T {}
#[cfg(not(test))] #[cfg(not(test))]
impl<T> PartialEq for *mut T { impl<T> PartialEq for *mut T {
@ -409,7 +409,7 @@ impl<T> PartialEq for *mut T {
} }
#[cfg(not(test))] #[cfg(not(test))]
impl<T> TotalEq for *mut T {} impl<T> Eq for *mut T {}
// Equivalence for pointers // Equivalence for pointers
#[cfg(not(test))] #[cfg(not(test))]

View file

@ -283,7 +283,7 @@ use option::{None, Option, Some};
/// `Result` is a type that represents either success (`Ok`) or failure (`Err`). /// `Result` is a type that represents either success (`Ok`) or failure (`Err`).
/// ///
/// See the [`std::result`](index.html) module documentation for details. /// 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] #[must_use]
pub enum Result<T, E> { pub enum Result<T, E> {
/// Contains the success value /// Contains the success value

View file

@ -17,7 +17,7 @@
use mem::transmute; use mem::transmute;
use clone::Clone; use clone::Clone;
use container::Container; use container::Container;
use cmp::{PartialEq, TotalOrd, Ordering, Less, Equal, Greater}; use cmp::{PartialEq, Ord, Ordering, Less, Equal, Greater};
use cmp; use cmp;
use default::Default; use default::Default;
use iter::*; use iter::*;
@ -251,7 +251,7 @@ impl<'a, T> RandomAccessIterator<&'a [T]> for Chunks<'a, T> {
pub mod traits { pub mod traits {
use super::*; use super::*;
use cmp::{PartialEq, PartialOrd, TotalEq, TotalOrd, Ordering, Equiv}; use cmp::{PartialEq, PartialOrd, Eq, Ord, Ordering, Equiv};
use iter::{order, Iterator}; use iter::{order, Iterator};
use container::Container; use container::Container;
@ -273,9 +273,9 @@ pub mod traits {
fn ne(&self, other: &~[T]) -> bool { !self.eq(other) } 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<T:TotalEq> TotalEq for ~[T] {} impl<T:Eq> Eq for ~[T] {}
impl<'a,T:PartialEq, V: Vector<T>> Equiv<V> for &'a [T] { impl<'a,T:PartialEq, V: Vector<T>> Equiv<V> for &'a [T] {
#[inline] #[inline]
@ -287,13 +287,13 @@ pub mod traits {
fn equiv(&self, other: &V) -> bool { self.as_slice() == other.as_slice() } 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 { fn cmp(&self, other: & &'a [T]) -> Ordering {
order::cmp(self.iter(), other.iter()) order::cmp(self.iter(), other.iter())
} }
} }
impl<T: TotalOrd> TotalOrd for ~[T] { impl<T: Ord> Ord for ~[T] {
#[inline] #[inline]
fn cmp(&self, other: &~[T]) -> Ordering { self.as_slice().cmp(&other.as_slice()) } fn cmp(&self, other: &~[T]) -> Ordering { self.as_slice().cmp(&other.as_slice()) }
} }
@ -741,8 +741,8 @@ impl<'a,T:PartialEq> ImmutableEqVector<T> for &'a [T] {
} }
} }
/// Extension methods for vectors containing `TotalOrd` elements. /// Extension methods for vectors containing `Ord` elements.
pub trait ImmutableTotalOrdVector<T: TotalOrd> { pub trait ImmutableOrdVector<T: Ord> {
/** /**
* Binary search a sorted vector for a given element. * Binary search a sorted vector for a given element.
* *
@ -751,7 +751,7 @@ pub trait ImmutableTotalOrdVector<T: TotalOrd> {
fn bsearch_elem(&self, x: &T) -> Option<uint>; fn bsearch_elem(&self, x: &T) -> Option<uint>;
} }
impl<'a, T: TotalOrd> ImmutableTotalOrdVector<T> for &'a [T] { impl<'a, T: Ord> ImmutableOrdVector<T> for &'a [T] {
fn bsearch_elem(&self, x: &T) -> Option<uint> { fn bsearch_elem(&self, x: &T) -> Option<uint> {
self.bsearch(|p| p.cmp(x)) self.bsearch(|p| p.cmp(x))
} }

View file

@ -18,7 +18,7 @@ use mem;
use char; use char;
use clone::Clone; use clone::Clone;
use cmp; use cmp;
use cmp::{PartialEq, TotalEq}; use cmp::{PartialEq, Eq};
use container::Container; use container::Container;
use default::Default; use default::Default;
use iter::{Filter, Map, Iterator}; use iter::{Filter, Map, Iterator};
@ -698,7 +698,7 @@ pub struct Utf16Items<'a> {
iter: slice::Items<'a, u16> iter: slice::Items<'a, u16>
} }
/// The possibilities for values decoded from a `u16` stream. /// The possibilities for values decoded from a `u16` stream.
#[deriving(PartialEq, TotalEq, Clone, Show)] #[deriving(PartialEq, Eq, Clone, Show)]
pub enum Utf16Item { pub enum Utf16Item {
/// A valid codepoint. /// A valid codepoint.
ScalarValue(char), ScalarValue(char),
@ -932,12 +932,12 @@ Section: Trait implementations
#[allow(missing_doc)] #[allow(missing_doc)]
pub mod traits { pub mod traits {
use container::Container; 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 iter::Iterator;
use option::{Some, None}; use option::{Some, None};
use str::{Str, StrSlice, eq_slice}; use str::{Str, StrSlice, eq_slice};
impl<'a> TotalOrd for &'a str { impl<'a> Ord for &'a str {
#[inline] #[inline]
fn cmp(&self, other: & &'a str) -> Ordering { fn cmp(&self, other: & &'a str) -> Ordering {
for (s_b, o_b) in self.bytes().zip(other.bytes()) { 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) } 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 { impl<'a> PartialOrd for &'a str {
#[inline] #[inline]

View file

@ -28,9 +28,9 @@
//! //!
//! * `Clone` //! * `Clone`
//! * `PartialEq` //! * `PartialEq`
//! * `TotalEq` //! * `Eq`
//! * `PartialOrd` //! * `PartialOrd`
//! * `TotalOrd` //! * `Ord`
//! * `Default` //! * `Default`
//! //!
//! # Examples //! # Examples
@ -123,7 +123,7 @@ macro_rules! tuple_impls {
} }
#[cfg(not(test))] #[cfg(not(test))]
impl<$($T:TotalEq),+> TotalEq for ($($T,)+) {} impl<$($T:Eq),+> Eq for ($($T,)+) {}
#[cfg(not(test))] #[cfg(not(test))]
impl<$($T:PartialOrd + PartialEq),+> PartialOrd for ($($T,)+) { impl<$($T:PartialOrd + PartialEq),+> PartialOrd for ($($T,)+) {
@ -146,7 +146,7 @@ macro_rules! tuple_impls {
} }
#[cfg(not(test))] #[cfg(not(test))]
impl<$($T:TotalOrd),+> TotalOrd for ($($T,)+) { impl<$($T:Ord),+> Ord for ($($T,)+) {
#[inline] #[inline]
fn cmp(&self, other: &($($T,)+)) -> Ordering { fn cmp(&self, other: &($($T,)+)) -> Ordering {
lexical_cmp!($(self.$refN(), other.$refN()),+) lexical_cmp!($(self.$refN(), other.$refN()),+)
@ -364,7 +364,7 @@ mod tests {
assert!(((1.0, 2.0) < (2.0, nan))); assert!(((1.0, 2.0) < (2.0, nan)));
assert!(!((2.0, 2.0) < (2.0, nan))); assert!(!((2.0, 2.0) < (2.0, nan)));
// TotalOrd // Ord
assert!(small.cmp(&small) == Equal); assert!(small.cmp(&small) == Equal);
assert!(big.cmp(&big) == Equal); assert!(big.cmp(&big) == Equal);
assert!(small.cmp(&big) == Less); assert!(small.cmp(&big) == Less);

View file

@ -146,7 +146,7 @@ pub enum Method<'a> {
} }
/// A selector for what pluralization a plural method should take /// A selector for what pluralization a plural method should take
#[deriving(PartialEq, TotalEq, Hash)] #[deriving(PartialEq, Eq, Hash)]
pub enum PluralSelector { pub enum PluralSelector {
/// One of the plural keywords should be used /// One of the plural keywords should be used
Keyword(PluralKeyword), Keyword(PluralKeyword),
@ -168,7 +168,7 @@ pub struct PluralArm<'a> {
/// is specially placed in the `Plural` variant of `Method`. /// is specially placed in the `Plural` variant of `Method`.
/// ///
/// http://www.icu-project.org/apiref/icu4c/classicu_1_1PluralRules.html /// http://www.icu-project.org/apiref/icu4c/classicu_1_1PluralRules.html
#[deriving(PartialEq, TotalEq, Hash, Show)] #[deriving(PartialEq, Eq, Hash, Show)]
#[allow(missing_doc)] #[allow(missing_doc)]
pub enum PluralKeyword { pub enum PluralKeyword {
/// The plural form for zero objects. /// The plural form for zero objects.

View file

@ -198,12 +198,12 @@ fn list_dir_sorted(path: &Path) -> Option<Vec<Path>> {
/** /**
* A compiled Unix shell style pattern. * 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 { pub struct Pattern {
tokens: Vec<PatternToken>, tokens: Vec<PatternToken>,
} }
#[deriving(Clone, PartialEq, TotalEq, PartialOrd, TotalOrd, Hash)] #[deriving(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
enum PatternToken { enum PatternToken {
Char(char), Char(char),
AnyChar, AnyChar,
@ -212,7 +212,7 @@ enum PatternToken {
AnyExcept(Vec<CharSpecifier> ) AnyExcept(Vec<CharSpecifier> )
} }
#[deriving(Clone, PartialEq, TotalEq, PartialOrd, TotalOrd, Hash)] #[deriving(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
enum CharSpecifier { enum CharSpecifier {
SingleChar(char), SingleChar(char),
CharRange(char, 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(..)` * 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 { pub struct MatchOptions {
/** /**

View file

@ -89,7 +89,7 @@ impl PartialEq for BigUint {
match self.cmp(other) { Equal => true, _ => false } match self.cmp(other) { Equal => true, _ => false }
} }
} }
impl TotalEq for BigUint {} impl Eq for BigUint {}
impl PartialOrd for BigUint { impl PartialOrd for BigUint {
#[inline] #[inline]
@ -98,7 +98,7 @@ impl PartialOrd for BigUint {
} }
} }
impl TotalOrd for BigUint { impl Ord for BigUint {
#[inline] #[inline]
fn cmp(&self, other: &BigUint) -> Ordering { fn cmp(&self, other: &BigUint) -> Ordering {
let (s_len, o_len) = (self.data.len(), other.data.len()); 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. /// 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 } pub enum Sign { Minus, Zero, Plus }
impl Neg<Sign> for Sign { impl Neg<Sign> for Sign {
@ -815,7 +815,7 @@ impl PartialEq for BigInt {
} }
} }
impl TotalEq for BigInt {} impl Eq for BigInt {}
impl PartialOrd for BigInt { impl PartialOrd for BigInt {
#[inline] #[inline]
@ -824,7 +824,7 @@ impl PartialOrd for BigInt {
} }
} }
impl TotalOrd for BigInt { impl Ord for BigInt {
#[inline] #[inline]
fn cmp(&self, other: &BigInt) -> Ordering { fn cmp(&self, other: &BigInt) -> Ordering {
let scmp = self.sign.cmp(&other.sign); let scmp = self.sign.cmp(&other.sign);

View file

@ -194,8 +194,8 @@ macro_rules! cmp_impl {
} }
cmp_impl!(impl PartialEq, eq, ne) cmp_impl!(impl PartialEq, eq, ne)
cmp_impl!(impl PartialOrd, lt, gt, le, ge) cmp_impl!(impl PartialOrd, lt, gt, le, ge)
cmp_impl!(impl TotalEq, ) cmp_impl!(impl Eq, )
cmp_impl!(impl TotalOrd, cmp -> cmp::Ordering) cmp_impl!(impl Ord, cmp -> cmp::Ordering)
/* Arithmetic */ /* Arithmetic */
// a/b * c/d = (a*c)/(b*d) // a/b * c/d = (a*c)/(b*d)

View file

@ -45,7 +45,7 @@ use syntax::attr::AttrMetaMethods;
use syntax::crateid::CrateId; use syntax::crateid::CrateId;
use syntax::parse::token; use syntax::parse::token;
#[deriving(Clone, PartialEq, PartialOrd, TotalOrd, TotalEq)] #[deriving(Clone, PartialEq, PartialOrd, Ord, Eq)]
pub enum OutputType { pub enum OutputType {
OutputTypeBitcode, OutputTypeBitcode,
OutputTypeAssembly, OutputTypeAssembly,

View file

@ -132,7 +132,7 @@ pub enum EntryFnType {
EntryNone, EntryNone,
} }
#[deriving(PartialEq, PartialOrd, Clone, TotalOrd, TotalEq, Hash)] #[deriving(PartialEq, PartialOrd, Clone, Ord, Eq, Hash)]
pub enum CrateType { pub enum CrateType {
CrateTypeExecutable, CrateTypeExecutable,
CrateTypeDylib, CrateTypeDylib,

View file

@ -188,13 +188,13 @@ pub struct Loan {
cause: euv::LoanCause, cause: euv::LoanCause,
} }
#[deriving(PartialEq, TotalEq, Hash)] #[deriving(PartialEq, Eq, Hash)]
pub enum LoanPath { pub enum LoanPath {
LpVar(ast::NodeId), // `x` in doc.rs LpVar(ast::NodeId), // `x` in doc.rs
LpExtend(Rc<LoanPath>, mc::MutabilityCategory, LoanPathElem) LpExtend(Rc<LoanPath>, mc::MutabilityCategory, LoanPathElem)
} }
#[deriving(PartialEq, TotalEq, Hash)] #[deriving(PartialEq, Eq, Hash)]
pub enum LoanPathElem { pub enum LoanPathElem {
LpDeref(mc::PointerKind), // `*LV` in doc.rs LpDeref(mc::PointerKind), // `*LV` in doc.rs
LpInterior(mc::InteriorKind) // `LV.f` in doc.rs LpInterior(mc::InteriorKind) // `LV.f` in doc.rs

View file

@ -42,7 +42,7 @@ macro_rules! lets_do_this {
$( $variant:ident, $name:expr, $method:ident; )* $( $variant:ident, $name:expr, $method:ident; )*
) => { ) => {
#[deriving(FromPrimitive, PartialEq, TotalEq, Hash)] #[deriving(FromPrimitive, PartialEq, Eq, Hash)]
pub enum LangItem { pub enum LangItem {
$($variant),* $($variant),*
} }

View file

@ -72,7 +72,7 @@ use syntax::parse::token;
use syntax::visit::Visitor; use syntax::visit::Visitor;
use syntax::{ast, ast_util, visit}; 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 { pub enum Lint {
CTypes, CTypes,
UnusedImports, 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 { pub enum Level {
Allow, Warn, Deny, Forbid Allow, Warn, Deny, Forbid
} }
#[deriving(Clone, PartialEq, PartialOrd, TotalEq, TotalOrd)] #[deriving(Clone, PartialEq, PartialOrd, Eq, Ord)]
pub struct LintSpec { pub struct LintSpec {
pub default: Level, pub default: Level,
pub lint: Lint, pub lint: Lint,

View file

@ -99,7 +99,7 @@ pub struct CopiedUpvar {
} }
// different kinds of pointers: // different kinds of pointers:
#[deriving(Clone, PartialEq, TotalEq, Hash)] #[deriving(Clone, PartialEq, Eq, Hash)]
pub enum PointerKind { pub enum PointerKind {
OwnedPtr, OwnedPtr,
GcPtr, GcPtr,
@ -109,26 +109,26 @@ pub enum PointerKind {
// We use the term "interior" to mean "something reachable from the // We use the term "interior" to mean "something reachable from the
// base without a pointer dereference", e.g. a field // base without a pointer dereference", e.g. a field
#[deriving(Clone, PartialEq, TotalEq, Hash)] #[deriving(Clone, PartialEq, Eq, Hash)]
pub enum InteriorKind { pub enum InteriorKind {
InteriorField(FieldName), InteriorField(FieldName),
InteriorElement(ElementKind), InteriorElement(ElementKind),
} }
#[deriving(Clone, PartialEq, TotalEq, Hash)] #[deriving(Clone, PartialEq, Eq, Hash)]
pub enum FieldName { pub enum FieldName {
NamedField(ast::Name), NamedField(ast::Name),
PositionalField(uint) PositionalField(uint)
} }
#[deriving(Clone, PartialEq, TotalEq, Hash)] #[deriving(Clone, PartialEq, Eq, Hash)]
pub enum ElementKind { pub enum ElementKind {
VecElement, VecElement,
StrElement, StrElement,
OtherElement, OtherElement,
} }
#[deriving(Clone, PartialEq, TotalEq, Hash, Show)] #[deriving(Clone, PartialEq, Eq, Hash, Show)]
pub enum MutabilityCategory { pub enum MutabilityCategory {
McImmutable, // Immutable. McImmutable, // Immutable.
McDeclared, // Directly declared as mutable. McDeclared, // Directly declared as mutable.

View file

@ -109,7 +109,7 @@ enum PatternBindingMode {
ArgumentIrrefutableMode, ArgumentIrrefutableMode,
} }
#[deriving(PartialEq, TotalEq, Hash)] #[deriving(PartialEq, Eq, Hash)]
enum Namespace { enum Namespace {
TypeNS, TypeNS,
ValueNS ValueNS

View file

@ -82,7 +82,7 @@ impl Drop for Rvalue {
fn drop(&mut self) { } fn drop(&mut self) { }
} }
#[deriving(PartialEq, TotalEq, Hash)] #[deriving(PartialEq, Eq, Hash)]
pub enum RvalueMode { pub enum RvalueMode {
/// `val` is a pointer to the actual value (and thus has type *T) /// `val` is a pointer to the actual value (and thus has type *T)
ByRef, ByRef,

View file

@ -312,14 +312,14 @@ pub fn monomorphic_fn(ccx: &CrateContext,
} }
// Used to identify cached monomorphized functions and vtables // Used to identify cached monomorphized functions and vtables
#[deriving(PartialEq, TotalEq, Hash)] #[deriving(PartialEq, Eq, Hash)]
pub struct MonoParamId { pub struct MonoParamId {
pub subst: ty::t, pub subst: ty::t,
// Do we really need the vtables to be hashed? Isn't the type enough? // Do we really need the vtables to be hashed? Isn't the type enough?
pub vtables: Vec<MonoId> pub vtables: Vec<MonoId>
} }
#[deriving(PartialEq, TotalEq, Hash)] #[deriving(PartialEq, Eq, Hash)]
pub struct MonoId { pub struct MonoId {
pub def: ast::DefId, pub def: ast::DefId,
pub params: Vec<MonoParamId> pub params: Vec<MonoParamId>

View file

@ -65,7 +65,7 @@ pub static INITIAL_DISCRIMINANT_VALUE: Disr = 0;
// Data types // Data types
#[deriving(PartialEq, TotalEq, Hash)] #[deriving(PartialEq, Eq, Hash)]
pub struct field { pub struct field {
pub ident: ast::Ident, pub ident: ast::Ident,
pub mt: mt pub mt: mt
@ -121,13 +121,13 @@ impl Method {
} }
} }
#[deriving(Clone, PartialEq, TotalEq, Hash)] #[deriving(Clone, PartialEq, Eq, Hash)]
pub struct mt { pub struct mt {
pub ty: t, pub ty: t,
pub mutbl: ast::Mutability, pub mutbl: ast::Mutability,
} }
#[deriving(Clone, PartialEq, TotalEq, Hash, Encodable, Decodable, Show)] #[deriving(Clone, PartialEq, Eq, Hash, Encodable, Decodable, Show)]
pub enum TraitStore { pub enum TraitStore {
/// Box<Trait> /// Box<Trait>
UniqTraitStore, UniqTraitStore,
@ -145,7 +145,7 @@ pub struct field_ty {
// Contains information needed to resolve types and (in the future) look up // Contains information needed to resolve types and (in the future) look up
// the types of AST nodes. // the types of AST nodes.
#[deriving(PartialEq, TotalEq, Hash)] #[deriving(PartialEq, Eq, Hash)]
pub struct creader_cache_key { pub struct creader_cache_key {
pub cnum: CrateNum, pub cnum: CrateNum,
pub pos: uint, pub pos: uint,
@ -172,7 +172,7 @@ impl cmp::PartialEq for intern_key {
} }
} }
impl TotalEq for intern_key {} impl Eq for intern_key {}
impl<W:Writer> Hash<W> for intern_key { impl<W:Writer> Hash<W> for intern_key {
fn hash(&self, s: &mut W) { fn hash(&self, s: &mut W) {
@ -387,7 +387,7 @@ pub struct t_box_ {
enum t_opaque {} enum t_opaque {}
#[allow(raw_pointer_deriving)] #[allow(raw_pointer_deriving)]
#[deriving(Clone, PartialEq, TotalEq, Hash)] #[deriving(Clone, PartialEq, Eq, Hash)]
pub struct t { inner: *t_opaque } pub struct t { inner: *t_opaque }
impl fmt::Show for t { 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 } pub fn type_id(t: t) -> uint { get(t).id }
#[deriving(Clone, PartialEq, TotalEq, Hash)] #[deriving(Clone, PartialEq, Eq, Hash)]
pub struct BareFnTy { pub struct BareFnTy {
pub fn_style: ast::FnStyle, pub fn_style: ast::FnStyle,
pub abi: abi::Abi, pub abi: abi::Abi,
pub sig: FnSig, pub sig: FnSig,
} }
#[deriving(Clone, PartialEq, TotalEq, Hash)] #[deriving(Clone, PartialEq, Eq, Hash)]
pub struct ClosureTy { pub struct ClosureTy {
pub fn_style: ast::FnStyle, pub fn_style: ast::FnStyle,
pub onceness: ast::Onceness, pub onceness: ast::Onceness,
@ -443,7 +443,7 @@ pub struct ClosureTy {
* - `output` is the return type. * - `output` is the return type.
* - `variadic` indicates whether this is a varidic function. (only true for foreign fns) * - `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 struct FnSig {
pub binder_id: ast::NodeId, pub binder_id: ast::NodeId,
pub inputs: Vec<t>, pub inputs: Vec<t>,
@ -451,14 +451,14 @@ pub struct FnSig {
pub variadic: bool pub variadic: bool
} }
#[deriving(Clone, PartialEq, TotalEq, Hash)] #[deriving(Clone, PartialEq, Eq, Hash)]
pub struct param_ty { pub struct param_ty {
pub idx: uint, pub idx: uint,
pub def_id: DefId pub def_id: DefId
} }
/// Representation of regions: /// Representation of regions:
#[deriving(Clone, PartialEq, TotalEq, Hash, Encodable, Decodable, Show)] #[deriving(Clone, PartialEq, Eq, Hash, Encodable, Decodable, Show)]
pub enum Region { pub enum Region {
// Region bound in a type or fn declaration which will be // Region bound in a type or fn declaration which will be
// substituted 'early' -- that is, at the same time when type // 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 * the original var id (that is, the root variable that is referenced
* by the upvar) and the id of the closure expression. * by the upvar) and the id of the closure expression.
*/ */
#[deriving(Clone, PartialEq, TotalEq, Hash)] #[deriving(Clone, PartialEq, Eq, Hash)]
pub struct UpvarId { pub struct UpvarId {
pub var_id: ast::NodeId, pub var_id: ast::NodeId,
pub closure_expr_id: ast::NodeId, pub closure_expr_id: ast::NodeId,
} }
#[deriving(Clone, PartialEq, TotalEq, Hash, Show)] #[deriving(Clone, PartialEq, Eq, Hash, Show)]
pub enum BorrowKind { pub enum BorrowKind {
/// Data must be immutable and is aliasable. /// Data must be immutable and is aliasable.
ImmBorrow, 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 struct FreeRegion {
pub scope_id: NodeId, pub scope_id: NodeId,
pub bound_region: BoundRegion 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 { pub enum BoundRegion {
/// An anonymous region parameter for a given fn (&T) /// An anonymous region parameter for a given fn (&T)
BrAnon(uint), BrAnon(uint),
@ -643,7 +643,7 @@ pub enum BoundRegion {
* Represents the values to use when substituting lifetime parameters. * Represents the values to use when substituting lifetime parameters.
* If the value is `ErasedRegions`, then this subst is occurring during * If the value is `ErasedRegions`, then this subst is occurring during
* trans, and all region parameters will be replaced with `ty::ReStatic`. */ * trans, and all region parameters will be replaced with `ty::ReStatic`. */
#[deriving(Clone, PartialEq, TotalEq, Hash)] #[deriving(Clone, PartialEq, Eq, Hash)]
pub enum RegionSubsts { pub enum RegionSubsts {
ErasedRegions, ErasedRegions,
NonerasedRegions(OwnedSlice<ty::Region>) NonerasedRegions(OwnedSlice<ty::Region>)
@ -666,7 +666,7 @@ pub enum RegionSubsts {
* - `self_ty` is the type to which `self` should be remapped, if any. The * - `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 * `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. */ * always substituted away to the implementing type for a trait. */
#[deriving(Clone, PartialEq, TotalEq, Hash)] #[deriving(Clone, PartialEq, Eq, Hash)]
pub struct substs { pub struct substs {
pub self_ty: Option<ty::t>, pub self_ty: Option<ty::t>,
pub tps: Vec<t>, pub tps: Vec<t>,
@ -722,7 +722,7 @@ mod primitives {
// NB: If you change this, you'll probably want to change the corresponding // NB: If you change this, you'll probably want to change the corresponding
// AST structure in libsyntax/ast.rs as well. // AST structure in libsyntax/ast.rs as well.
#[deriving(Clone, PartialEq, TotalEq, Hash)] #[deriving(Clone, PartialEq, Eq, Hash)]
pub enum sty { pub enum sty {
ty_nil, ty_nil,
ty_bot, ty_bot,
@ -754,7 +754,7 @@ pub enum sty {
// on non-useful type error messages) // on non-useful type error messages)
} }
#[deriving(Clone, PartialEq, TotalEq, Hash)] #[deriving(Clone, PartialEq, Eq, Hash)]
pub struct TyTrait { pub struct TyTrait {
pub def_id: DefId, pub def_id: DefId,
pub substs: substs, pub substs: substs,
@ -762,7 +762,7 @@ pub struct TyTrait {
pub bounds: BuiltinBounds pub bounds: BuiltinBounds
} }
#[deriving(PartialEq, TotalEq, Hash)] #[deriving(PartialEq, Eq, Hash)]
pub struct TraitRef { pub struct TraitRef {
pub def_id: DefId, pub def_id: DefId,
pub substs: substs pub substs: substs
@ -822,7 +822,7 @@ pub enum type_err {
terr_variadic_mismatch(expected_found<bool>) terr_variadic_mismatch(expected_found<bool>)
} }
#[deriving(PartialEq, TotalEq, Hash)] #[deriving(PartialEq, Eq, Hash)]
pub struct ParamBounds { pub struct ParamBounds {
pub builtin_bounds: BuiltinBounds, pub builtin_bounds: BuiltinBounds,
pub trait_bounds: Vec<Rc<TraitRef>> pub trait_bounds: Vec<Rc<TraitRef>>
@ -830,7 +830,7 @@ pub struct ParamBounds {
pub type BuiltinBounds = EnumSet<BuiltinBound>; pub type BuiltinBounds = EnumSet<BuiltinBound>;
#[deriving(Clone, Encodable, PartialEq, TotalEq, Decodable, Hash, Show)] #[deriving(Clone, Encodable, PartialEq, Eq, Decodable, Hash, Show)]
#[repr(uint)] #[repr(uint)]
pub enum BuiltinBound { pub enum BuiltinBound {
BoundStatic, BoundStatic,
@ -862,28 +862,28 @@ impl CLike for BuiltinBound {
} }
} }
#[deriving(Clone, PartialEq, TotalEq, Hash)] #[deriving(Clone, PartialEq, Eq, Hash)]
pub struct TyVid(pub uint); pub struct TyVid(pub uint);
#[deriving(Clone, PartialEq, TotalEq, Hash)] #[deriving(Clone, PartialEq, Eq, Hash)]
pub struct IntVid(pub uint); pub struct IntVid(pub uint);
#[deriving(Clone, PartialEq, TotalEq, Hash)] #[deriving(Clone, PartialEq, Eq, Hash)]
pub struct FloatVid(pub uint); pub struct FloatVid(pub uint);
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct RegionVid { pub struct RegionVid {
pub id: uint pub id: uint
} }
#[deriving(Clone, PartialEq, TotalEq, Hash)] #[deriving(Clone, PartialEq, Eq, Hash)]
pub enum InferTy { pub enum InferTy {
TyVar(TyVid), TyVar(TyVid),
IntVar(IntVid), IntVar(IntVid),
FloatVar(FloatVid) FloatVar(FloatVid)
} }
#[deriving(Clone, Encodable, Decodable, TotalEq, Hash, Show)] #[deriving(Clone, Encodable, Decodable, Eq, Hash, Show)]
pub enum InferRegion { pub enum InferRegion {
ReVar(RegionVid), ReVar(RegionVid),
ReSkolemized(uint, BoundRegion) ReSkolemized(uint, BoundRegion)

View file

@ -31,7 +31,7 @@ use syntax::ast;
mod doc; mod doc;
#[deriving(PartialEq, TotalEq, Hash)] #[deriving(PartialEq, Eq, Hash)]
pub enum Constraint { pub enum Constraint {
ConstrainVarSubVar(RegionVid, RegionVid), ConstrainVarSubVar(RegionVid, RegionVid),
ConstrainRegSubVar(Region, RegionVid), ConstrainRegSubVar(Region, RegionVid),
@ -39,7 +39,7 @@ pub enum Constraint {
ConstrainRegSubReg(Region, Region), ConstrainRegSubReg(Region, Region),
} }
#[deriving(PartialEq, TotalEq, Hash)] #[deriving(PartialEq, Eq, Hash)]
pub struct TwoRegions { pub struct TwoRegions {
a: Region, a: Region,
b: Region, b: Region,

View file

@ -147,7 +147,7 @@ pub struct MethodCallee {
pub substs: ty::substs pub substs: ty::substs
} }
#[deriving(Clone, PartialEq, TotalEq, Hash, Show)] #[deriving(Clone, PartialEq, Eq, Hash, Show)]
pub struct MethodCall { pub struct MethodCall {
pub expr_id: ast::NodeId, pub expr_id: ast::NodeId,
pub autoderef: u32 pub autoderef: u32

View file

@ -28,14 +28,14 @@ pub type DefIdSet = FnvHashSet<ast::DefId>;
pub mod FnvHashMap { pub mod FnvHashMap {
use std::hash::Hash; use std::hash::Hash;
use collections::HashMap; use collections::HashMap;
pub fn new<K: Hash<super::FnvState> + TotalEq, V>() -> super::FnvHashMap<K, V> { pub fn new<K: Hash<super::FnvState> + Eq, V>() -> super::FnvHashMap<K, V> {
HashMap::with_hasher(super::FnvHasher) HashMap::with_hasher(super::FnvHasher)
} }
} }
pub mod FnvHashSet { pub mod FnvHashSet {
use std::hash::Hash; use std::hash::Hash;
use collections::HashSet; use collections::HashSet;
pub fn new<V: Hash<super::FnvState> + TotalEq>() -> super::FnvHashSet<V> { pub fn new<V: Hash<super::FnvState> + Eq>() -> super::FnvHashSet<V> {
HashSet::with_hasher(super::FnvHasher) HashSet::with_hasher(super::FnvHasher)
} }
} }

View file

@ -1028,7 +1028,7 @@ pub enum Type {
// region, raw, other boxes, mutable // region, raw, other boxes, mutable
} }
#[deriving(Clone, Encodable, Decodable, PartialEq, TotalEq, Hash)] #[deriving(Clone, Encodable, Decodable, PartialEq, Eq, Hash)]
pub enum Primitive { pub enum Primitive {
Int, I8, I16, I32, I64, Int, I8, I16, I32, I64,
Uint, U8, U16, U32, U64, Uint, U8, U16, U32, U64,

View file

@ -76,7 +76,7 @@ impl<E, D:Decoder<E>,T:Decodable<D, E>> Decodable<D, E> for RingBuf<T> {
impl< impl<
E, E,
S: Encoder<E>, S: Encoder<E>,
K: Encodable<S, E> + PartialEq + TotalOrd, K: Encodable<S, E> + PartialEq + Ord,
V: Encodable<S, E> + PartialEq V: Encodable<S, E> + PartialEq
> Encodable<S, E> for TreeMap<K, V> { > Encodable<S, E> for TreeMap<K, V> {
fn encode(&self, e: &mut S) -> Result<(), E> { fn encode(&self, e: &mut S) -> Result<(), E> {
@ -95,7 +95,7 @@ impl<
impl< impl<
E, E,
D: Decoder<E>, D: Decoder<E>,
K: Decodable<D, E> + PartialEq + TotalOrd, K: Decodable<D, E> + PartialEq + Ord,
V: Decodable<D, E> + PartialEq V: Decodable<D, E> + PartialEq
> Decodable<D, E> for TreeMap<K, V> { > Decodable<D, E> for TreeMap<K, V> {
fn decode(d: &mut D) -> Result<TreeMap<K, V>, E> { fn decode(d: &mut D) -> Result<TreeMap<K, V>, E> {
@ -114,7 +114,7 @@ impl<
impl< impl<
E, E,
S: Encoder<E>, S: Encoder<E>,
T: Encodable<S, E> + PartialEq + TotalOrd T: Encodable<S, E> + PartialEq + Ord
> Encodable<S, E> for TreeSet<T> { > Encodable<S, E> for TreeSet<T> {
fn encode(&self, s: &mut S) -> Result<(), E> { fn encode(&self, s: &mut S) -> Result<(), E> {
s.emit_seq(self.len(), |s| { s.emit_seq(self.len(), |s| {
@ -131,7 +131,7 @@ impl<
impl< impl<
E, E,
D: Decoder<E>, D: Decoder<E>,
T: Decodable<D, E> + PartialEq + TotalOrd T: Decodable<D, E> + PartialEq + Ord
> Decodable<D, E> for TreeSet<T> { > Decodable<D, E> for TreeSet<T> {
fn decode(d: &mut D) -> Result<TreeSet<T>, E> { fn decode(d: &mut D) -> Result<TreeSet<T>, E> {
d.read_seq(|d, len| { d.read_seq(|d, len| {
@ -178,7 +178,7 @@ impl<
impl< impl<
E, E,
S: Encoder<E>, S: Encoder<E>,
K: Encodable<S, E> + Hash<X> + TotalEq, K: Encodable<S, E> + Hash<X> + Eq,
V: Encodable<S, E>, V: Encodable<S, E>,
X, X,
H: Hasher<X> H: Hasher<X>
@ -199,7 +199,7 @@ impl<
impl< impl<
E, E,
D: Decoder<E>, D: Decoder<E>,
K: Decodable<D, E> + Hash<S> + TotalEq, K: Decodable<D, E> + Hash<S> + Eq,
V: Decodable<D, E>, V: Decodable<D, E>,
S, S,
H: Hasher<S> + Default H: Hasher<S> + Default
@ -221,7 +221,7 @@ impl<
impl< impl<
E, E,
S: Encoder<E>, S: Encoder<E>,
T: Encodable<S, E> + Hash<X> + TotalEq, T: Encodable<S, E> + Hash<X> + Eq,
X, X,
H: Hasher<X> H: Hasher<X>
> Encodable<S, E> for HashSet<T, H> { > Encodable<S, E> for HashSet<T, H> {
@ -240,7 +240,7 @@ impl<
impl< impl<
E, E,
D: Decoder<E>, D: Decoder<E>,
T: Decodable<D, E> + Hash<S> + TotalEq, T: Decodable<D, E> + Hash<S> + Eq,
S, S,
H: Hasher<S> + Default H: Hasher<S> + Default
> Decodable<D, E> for HashSet<T, H> { > Decodable<D, E> for HashSet<T, H> {

View file

@ -23,7 +23,7 @@ use to_str::{IntoStr};
use vec::Vec; use vec::Vec;
/// Datatype to hold one ascii character. It wraps a `u8`, with the highest bit always zero. /// 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 } pub struct Ascii { chr: u8 }
impl Ascii { impl Ascii {

View file

@ -112,7 +112,7 @@ macro_rules! bitflags(
($(#[$attr:meta])* flags $BitFlags:ident: $T:ty { ($(#[$attr:meta])* flags $BitFlags:ident: $T:ty {
$($(#[$Flag_attr:meta])* static $Flag:ident = $value:expr),+ $($(#[$Flag_attr:meta])* static $Flag:ident = $value:expr),+
}) => ( }) => (
#[deriving(PartialEq, TotalEq, Clone)] #[deriving(PartialEq, Eq, Clone)]
$(#[$attr])* $(#[$attr])*
pub struct $BitFlags { pub struct $BitFlags {
bits: $T, bits: $T,

View file

@ -25,7 +25,7 @@ use slice::{MutableCloneableVector, ImmutableVector, MutableVector};
pub type Port = u16; pub type Port = u16;
#[deriving(PartialEq, TotalEq, Clone, Hash)] #[deriving(PartialEq, Eq, Clone, Hash)]
pub enum IpAddr { pub enum IpAddr {
Ipv4Addr(u8, u8, u8, u8), Ipv4Addr(u8, u8, u8, u8),
Ipv6Addr(u16, u16, u16, u16, u16, u16, u16, u16) 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 struct SocketAddr {
pub ip: IpAddr, pub ip: IpAddr,
pub port: Port, pub port: Port,

View file

@ -317,7 +317,7 @@ impl fmt::Show for Command {
} }
/// The output of a finished process. /// The output of a finished process.
#[deriving(PartialEq, TotalEq, Clone)] #[deriving(PartialEq, Eq, Clone)]
pub struct ProcessOutput { pub struct ProcessOutput {
/// The status (exit code) of the process. /// The status (exit code) of the process.
pub status: ProcessExit, pub status: ProcessExit,
@ -348,7 +348,7 @@ pub enum StdioContainer {
/// Describes the result of a process after it has terminated. /// Describes the result of a process after it has terminated.
/// Note that Windows have no signals, so the result is usually ExitStatus. /// Note that Windows have no signals, so the result is usually ExitStatus.
#[deriving(PartialEq, TotalEq, Clone)] #[deriving(PartialEq, Eq, Clone)]
pub enum ProcessExit { pub enum ProcessExit {
/// Normal termination with an exit status. /// Normal termination with an exit status.
ExitStatus(int), ExitStatus(int),

View file

@ -13,7 +13,7 @@
use container::Container; use container::Container;
use c_str::{CString, ToCStr}; use c_str::{CString, ToCStr};
use clone::Clone; use clone::Clone;
use cmp::{PartialEq, TotalEq}; use cmp::{PartialEq, Eq};
use from_str::FromStr; use from_str::FromStr;
use io::Writer; use io::Writer;
use iter::{DoubleEndedIterator, AdditiveIterator, Extendable, Iterator, Map}; 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 { impl FromStr for Path {
fn from_str(s: &str) -> Option<Path> { fn from_str(s: &str) -> Option<Path> {

View file

@ -13,7 +13,7 @@
use ascii::AsciiCast; use ascii::AsciiCast;
use c_str::{CString, ToCStr}; use c_str::{CString, ToCStr};
use clone::Clone; use clone::Clone;
use cmp::{PartialEq, TotalEq}; use cmp::{PartialEq, Eq};
use container::Container; use container::Container;
use from_str::FromStr; use from_str::FromStr;
use io::Writer; use io::Writer;
@ -86,7 +86,7 @@ impl PartialEq for Path {
} }
} }
impl TotalEq for Path {} impl Eq for Path {}
impl FromStr for Path { impl FromStr for Path {
fn from_str(s: &str) -> Option<Path> { fn from_str(s: &str) -> Option<Path> {

View file

@ -58,7 +58,7 @@
#[doc(no_inline)] pub use c_str::ToCStr; #[doc(no_inline)] pub use c_str::ToCStr;
#[doc(no_inline)] pub use char::Char; #[doc(no_inline)] pub use char::Char;
#[doc(no_inline)] pub use clone::Clone; #[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 cmp::{Ordering, Less, Equal, Greater, Equiv};
#[doc(no_inline)] pub use container::{Container, Mutable, Map, MutableMap}; #[doc(no_inline)] pub use container::{Container, Mutable, Map, MutableMap};
#[doc(no_inline)] pub use container::{Set, MutableSet}; #[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::{Tuple5, Tuple6, Tuple7, Tuple8};
#[doc(no_inline)] pub use tuple::{Tuple9, Tuple10, Tuple11, Tuple12}; #[doc(no_inline)] pub use tuple::{Tuple9, Tuple10, Tuple11, Tuple12};
#[doc(no_inline)] pub use slice::{CloneableVector, ImmutableCloneableVector}; #[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::{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::{Vector, VectorVector, OwnedVector};
#[doc(no_inline)] pub use slice::MutableVectorAllocating; #[doc(no_inline)] pub use slice::MutableVectorAllocating;
#[doc(no_inline)] pub use string::String; #[doc(no_inline)] pub use string::String;

View file

@ -65,7 +65,7 @@ Vectors are a very useful type, and so there's several implementations of
traits from other modules. Some notable examples: traits from other modules. Some notable examples:
* `Clone` * `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. if the element type defines the corresponding trait.
## Iteration ## Iteration
@ -101,7 +101,7 @@ There are a number of free functions that create or take vectors, for example:
use mem::transmute; use mem::transmute;
use clone::Clone; use clone::Clone;
use cmp::{TotalOrd, Ordering, Less, Greater}; use cmp::{Ord, Ordering, Less, Greater};
use cmp; use cmp;
use container::Container; use container::Container;
use iter::*; use iter::*;
@ -117,7 +117,7 @@ use vec::Vec;
pub use core::slice::{ref_slice, mut_ref_slice, Splits, Windows}; pub use core::slice::{ref_slice, mut_ref_slice, Splits, Windows};
pub use core::slice::{Chunks, Vector, ImmutableVector, ImmutableEqVector}; 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::{MutSplits, MutChunks};
pub use core::slice::{bytes, MutableCloneableVector}; 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 /// Methods for mutable vectors with orderable elements, such as
/// in-place sorting. /// in-place sorting.
pub trait MutableTotalOrdVector<T> { pub trait MutableOrdVector<T> {
/// Sort the vector, in place. /// Sort the vector, in place.
/// ///
/// This is equivalent to `self.sort_by(|a, b| a.cmp(b))`. /// This is equivalent to `self.sort_by(|a, b| a.cmp(b))`.
@ -714,7 +714,7 @@ pub trait MutableTotalOrdVector<T> {
fn sort(self); fn sort(self);
} }
impl<'a, T: TotalOrd> MutableTotalOrdVector<T> for &'a mut [T] { impl<'a, T: Ord> MutableOrdVector<T> for &'a mut [T] {
#[inline] #[inline]
fn sort(self) { fn sort(self) {
self.sort_by(|a,b| a.cmp(b)) self.sort_by(|a,b| a.cmp(b))

View file

@ -70,7 +70,7 @@ is the same as `&[u8]`.
use char::Char; use char::Char;
use char; use char;
use clone::Clone; use clone::Clone;
use cmp::{PartialEq, TotalEq, PartialOrd, TotalOrd, Equiv, Ordering}; use cmp::{PartialEq, Eq, PartialOrd, Ord, Equiv, Ordering};
use container::Container; use container::Container;
use default::Default; use default::Default;
use fmt; 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> { impl<'a> PartialOrd for MaybeOwned<'a> {
#[inline] #[inline]
@ -584,7 +584,7 @@ impl<'a> PartialOrd for MaybeOwned<'a> {
} }
} }
impl<'a> TotalOrd for MaybeOwned<'a> { impl<'a> Ord for MaybeOwned<'a> {
#[inline] #[inline]
fn cmp(&self, other: &MaybeOwned) -> Ordering { fn cmp(&self, other: &MaybeOwned) -> Ordering {
self.as_slice().cmp(&other.as_slice()) self.as_slice().cmp(&other.as_slice())

View file

@ -30,7 +30,7 @@ use str;
use vec::Vec; use vec::Vec;
/// A growable string stored as a UTF-8 encoded buffer. /// 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 { pub struct String {
vec: Vec<u8>, vec: Vec<u8>,
} }

View file

@ -12,7 +12,7 @@
use RawVec = raw::Vec; use RawVec = raw::Vec;
use clone::Clone; use clone::Clone;
use cmp::{PartialOrd, PartialEq, Ordering, TotalEq, TotalOrd, max}; use cmp::{PartialOrd, PartialEq, Ordering, Eq, Ord, max};
use container::{Container, Mutable}; use container::{Container, Mutable};
use default::Default; use default::Default;
use fmt; use fmt;
@ -27,7 +27,7 @@ use ptr;
use raw::Slice; use raw::Slice;
use rt::heap::{allocate, reallocate, deallocate}; use rt::heap::{allocate, reallocate, deallocate};
use slice::{ImmutableEqVector, ImmutableVector, Items, MutItems, MutableVector}; use slice::{ImmutableEqVector, ImmutableVector, Items, MutItems, MutableVector};
use slice::{MutableTotalOrdVector, OwnedVector, Vector}; use slice::{MutableOrdVector, OwnedVector, Vector};
use slice::{MutableVectorAllocating}; use slice::{MutableVectorAllocating};
/// An owned, growable vector. /// An owned, growable vector.
@ -388,9 +388,9 @@ impl<T: PartialOrd> PartialOrd for Vec<T> {
} }
} }
impl<T: TotalEq> TotalEq for Vec<T> {} impl<T: Eq> Eq for Vec<T> {}
impl<T: TotalOrd> TotalOrd for Vec<T> { impl<T: Ord> Ord for Vec<T> {
#[inline] #[inline]
fn cmp(&self, other: &Vec<T>) -> Ordering { fn cmp(&self, other: &Vec<T>) -> Ordering {
self.as_slice().cmp(&other.as_slice()) self.as_slice().cmp(&other.as_slice())
@ -1263,7 +1263,7 @@ impl<T> Vec<T> {
} }
} }
impl<T:TotalOrd> Vec<T> { impl<T:Ord> Vec<T> {
/// Sorts the vector in place. /// Sorts the vector in place.
/// ///
/// This sort is `O(n log n)` worst-case and stable, but allocates /// This sort is `O(n log n)` worst-case and stable, but allocates

View file

@ -13,7 +13,7 @@ use std::fmt;
#[deriving(PartialEq)] #[deriving(PartialEq)]
pub enum Os { OsWin32, OsMacos, OsLinux, OsAndroid, OsFreebsd, } 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 { pub enum Abi {
// NB: This ordering MUST match the AbiDatas array below. // NB: This ordering MUST match the AbiDatas array below.
// (This is ensured by the test indices_are_correct().) // (This is ensured by the test indices_are_correct().)

View file

@ -39,7 +39,7 @@ pub fn P<T: 'static>(value: T) -> P<T> {
// table) and a SyntaxContext to track renaming and // table) and a SyntaxContext to track renaming and
// macro expansion per Flatt et al., "Macros // macro expansion per Flatt et al., "Macros
// That Work Together" // That Work Together"
#[deriving(Clone, Hash, PartialOrd, TotalEq, TotalOrd, Show)] #[deriving(Clone, Hash, PartialOrd, Eq, Ord, Show)]
pub struct Ident { pub struct Ident {
pub name: Name, pub name: Name,
pub ctxt: SyntaxContext pub ctxt: SyntaxContext
@ -114,7 +114,7 @@ impl<D:Decoder<E>, E> Decodable<D, E> for Ident {
/// Function name (not all functions have names) /// Function name (not all functions have names)
pub type FnIdent = Option<Ident>; pub type FnIdent = Option<Ident>;
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct Lifetime { pub struct Lifetime {
pub id: NodeId, pub id: NodeId,
pub span: Span, pub span: Span,
@ -125,7 +125,7 @@ pub struct Lifetime {
// for instance: std::cmp::PartialEq . It's represented // for instance: std::cmp::PartialEq . It's represented
// as a sequence of identifiers, along with a bunch // as a sequence of identifiers, along with a bunch
// of supporting information. // of supporting information.
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct Path { pub struct Path {
pub span: Span, pub span: Span,
/// A `::foo` path, is relative to the crate root rather than current /// 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 /// A segment of a path: an identifier, an optional lifetime, and a set of
/// types. /// types.
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct PathSegment { pub struct PathSegment {
/// The identifier portion of this path segment. /// The identifier portion of this path segment.
pub identifier: Ident, pub identifier: Ident,
@ -151,7 +151,7 @@ pub type CrateNum = u32;
pub type NodeId = 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 struct DefId {
pub krate: CrateNum, pub krate: CrateNum,
pub node: NodeId, pub node: NodeId,
@ -171,14 +171,14 @@ pub static DUMMY_NODE_ID: NodeId = -1;
// typeck::collect::compute_bounds matches these against // typeck::collect::compute_bounds matches these against
// the "special" built-in traits (see middle::lang_items) and // the "special" built-in traits (see middle::lang_items) and
// detects Copy, Send and Share. // detects Copy, Send and Share.
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum TyParamBound { pub enum TyParamBound {
TraitTyParamBound(TraitRef), TraitTyParamBound(TraitRef),
StaticRegionTyParamBound, StaticRegionTyParamBound,
OtherRegionTyParamBound(Span) // FIXME -- just here until work for #5723 lands 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 struct TyParam {
pub ident: Ident, pub ident: Ident,
pub id: NodeId, pub id: NodeId,
@ -188,7 +188,7 @@ pub struct TyParam {
pub span: Span pub span: Span
} }
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct Generics { pub struct Generics {
pub lifetimes: Vec<Lifetime>, pub lifetimes: Vec<Lifetime>,
pub ty_params: OwnedSlice<TyParam>, pub ty_params: OwnedSlice<TyParam>,
@ -206,13 +206,13 @@ impl Generics {
} }
} }
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum MethodProvenance { pub enum MethodProvenance {
FromTrait(DefId), FromTrait(DefId),
FromImpl(DefId), FromImpl(DefId),
} }
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum Def { pub enum Def {
DefFn(DefId, FnStyle), DefFn(DefId, FnStyle),
DefStaticMethod(/* method */ DefId, MethodProvenance, FnStyle), DefStaticMethod(/* method */ DefId, MethodProvenance, FnStyle),
@ -249,7 +249,7 @@ pub enum Def {
DefMethod(DefId /* method */, Option<DefId> /* trait */), DefMethod(DefId /* method */, Option<DefId> /* trait */),
} }
#[deriving(Clone, PartialEq, TotalEq, Hash, Encodable, Decodable, Show)] #[deriving(Clone, PartialEq, Eq, Hash, Encodable, Decodable, Show)]
pub enum DefRegion { pub enum DefRegion {
DefStaticRegion, DefStaticRegion,
DefEarlyBoundRegion(/* index */ uint, /* lifetime decl */ NodeId), DefEarlyBoundRegion(/* index */ uint, /* lifetime decl */ NodeId),
@ -261,7 +261,7 @@ pub enum DefRegion {
// used to drive conditional compilation // used to drive conditional compilation
pub type CrateConfig = Vec<@MetaItem> ; pub type CrateConfig = Vec<@MetaItem> ;
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct Crate { pub struct Crate {
pub module: Mod, pub module: Mod,
pub attrs: Vec<Attribute>, pub attrs: Vec<Attribute>,
@ -271,7 +271,7 @@ pub struct Crate {
pub type MetaItem = Spanned<MetaItem_>; pub type MetaItem = Spanned<MetaItem_>;
#[deriving(Clone, Encodable, Decodable, TotalEq, Hash)] #[deriving(Clone, Encodable, Decodable, Eq, Hash)]
pub enum MetaItem_ { pub enum MetaItem_ {
MetaWord(InternedString), MetaWord(InternedString),
MetaList(InternedString, Vec<@MetaItem> ), 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 struct Block {
pub view_items: Vec<ViewItem>, pub view_items: Vec<ViewItem>,
pub stmts: Vec<@Stmt>, pub stmts: Vec<@Stmt>,
@ -313,26 +313,26 @@ pub struct Block {
pub span: Span, pub span: Span,
} }
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct Pat { pub struct Pat {
pub id: NodeId, pub id: NodeId,
pub node: Pat_, pub node: Pat_,
pub span: Span, pub span: Span,
} }
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct FieldPat { pub struct FieldPat {
pub ident: Ident, pub ident: Ident,
pub pat: @Pat, pub pat: @Pat,
} }
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum BindingMode { pub enum BindingMode {
BindByRef(Mutability), BindByRef(Mutability),
BindByValue(Mutability), BindByValue(Mutability),
} }
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum Pat_ { pub enum Pat_ {
PatWild, PatWild,
PatWildMulti, PatWildMulti,
@ -358,20 +358,20 @@ pub enum Pat_ {
PatMac(Mac), PatMac(Mac),
} }
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash, Show)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
pub enum Mutability { pub enum Mutability {
MutMutable, MutMutable,
MutImmutable, MutImmutable,
} }
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum ExprVstore { pub enum ExprVstore {
ExprVstoreUniq, // ~[1,2,3,4] ExprVstoreUniq, // ~[1,2,3,4]
ExprVstoreSlice, // &[1,2,3,4] ExprVstoreSlice, // &[1,2,3,4]
ExprVstoreMutSlice, // &mut [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 { pub enum BinOp {
BiAdd, BiAdd,
BiSub, BiSub,
@ -393,7 +393,7 @@ pub enum BinOp {
BiGt, BiGt,
} }
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum UnOp { pub enum UnOp {
UnBox, UnBox,
UnUniq, UnUniq,
@ -404,7 +404,7 @@ pub enum UnOp {
pub type Stmt = Spanned<Stmt_>; pub type Stmt = Spanned<Stmt_>;
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum Stmt_ { pub enum Stmt_ {
// could be an item or a local (let) binding: // could be an item or a local (let) binding:
StmtDecl(@Decl, NodeId), StmtDecl(@Decl, NodeId),
@ -421,7 +421,7 @@ pub enum Stmt_ {
/// Where a local declaration came from: either a true `let ... = /// Where a local declaration came from: either a true `let ... =
/// ...;`, or one desugared from the pattern of a for loop. /// ...;`, 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 { pub enum LocalSource {
LocalLet, LocalLet,
LocalFor, LocalFor,
@ -430,7 +430,7 @@ pub enum LocalSource {
// FIXME (pending discussion of #1697, #2178...): local should really be // FIXME (pending discussion of #1697, #2178...): local should really be
// a refinement on pat. // a refinement on pat.
/// Local represents a `let` statement, e.g., `let <pat>:<ty> = <expr>;` /// Local represents a `let` statement, e.g., `let <pat>:<ty> = <expr>;`
#[deriving(PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct Local { pub struct Local {
pub ty: P<Ty>, pub ty: P<Ty>,
pub pat: @Pat, pub pat: @Pat,
@ -442,7 +442,7 @@ pub struct Local {
pub type Decl = Spanned<Decl_>; pub type Decl = Spanned<Decl_>;
#[deriving(PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum Decl_ { pub enum Decl_ {
// a local (let) binding: // a local (let) binding:
DeclLocal(@Local), DeclLocal(@Local),
@ -450,7 +450,7 @@ pub enum Decl_ {
DeclItem(@Item), DeclItem(@Item),
} }
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct Arm { pub struct Arm {
pub attrs: Vec<Attribute>, pub attrs: Vec<Attribute>,
pub pats: Vec<@Pat>, pub pats: Vec<@Pat>,
@ -458,7 +458,7 @@ pub struct Arm {
pub body: @Expr, pub body: @Expr,
} }
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct Field { pub struct Field {
pub ident: SpannedIdent, pub ident: SpannedIdent,
pub expr: @Expr, pub expr: @Expr,
@ -467,26 +467,26 @@ pub struct Field {
pub type SpannedIdent = Spanned<Ident>; pub type SpannedIdent = Spanned<Ident>;
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum BlockCheckMode { pub enum BlockCheckMode {
DefaultBlock, DefaultBlock,
UnsafeBlock(UnsafeSource), UnsafeBlock(UnsafeSource),
} }
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum UnsafeSource { pub enum UnsafeSource {
CompilerGenerated, CompilerGenerated,
UserProvided, UserProvided,
} }
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct Expr { pub struct Expr {
pub id: NodeId, pub id: NodeId,
pub node: Expr_, pub node: Expr_,
pub span: Span, pub span: Span,
} }
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum Expr_ { pub enum Expr_ {
ExprVstore(@Expr, ExprVstore), ExprVstore(@Expr, ExprVstore),
// First expr is the place; second expr is the value. // 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 // else knows what to do with them, so you'll probably get a syntax
// error. // 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"] #[doc="For macro invocations; parsing is delegated to the macro"]
pub enum TokenTree { pub enum TokenTree {
// a single token // a single token
@ -631,7 +631,7 @@ pub enum TokenTree {
// //
pub type Matcher = Spanned<Matcher_>; pub type Matcher = Spanned<Matcher_>;
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum Matcher_ { pub enum Matcher_ {
// match one token // match one token
MatchTok(::parse::token::Token), MatchTok(::parse::token::Token),
@ -648,12 +648,12 @@ pub type Mac = Spanned<Mac_>;
// is being invoked, and the vector of token-trees contains the source // is being invoked, and the vector of token-trees contains the source
// of the macro invocation. // of the macro invocation.
// There's only one flavor, now, so this could presumably be simplified. // 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_ { pub enum Mac_ {
MacInvocTT(Path, Vec<TokenTree> , SyntaxContext), // new macro-invocation MacInvocTT(Path, Vec<TokenTree> , SyntaxContext), // new macro-invocation
} }
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum StrStyle { pub enum StrStyle {
CookedStr, CookedStr,
RawStr(uint) RawStr(uint)
@ -661,7 +661,7 @@ pub enum StrStyle {
pub type Lit = Spanned<Lit_>; pub type Lit = Spanned<Lit_>;
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum Lit_ { pub enum Lit_ {
LitStr(InternedString, StrStyle), LitStr(InternedString, StrStyle),
LitBinary(Rc<Vec<u8> >), LitBinary(Rc<Vec<u8> >),
@ -677,20 +677,20 @@ pub enum Lit_ {
// NB: If you change this, you'll probably want to change the corresponding // NB: If you change this, you'll probably want to change the corresponding
// type structure in middle/ty.rs as well. // 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 struct MutTy {
pub ty: P<Ty>, pub ty: P<Ty>,
pub mutbl: Mutability, pub mutbl: Mutability,
} }
#[deriving(PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct TypeField { pub struct TypeField {
pub ident: Ident, pub ident: Ident,
pub mt: MutTy, pub mt: MutTy,
pub span: Span, pub span: Span,
} }
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct TypeMethod { pub struct TypeMethod {
pub ident: Ident, pub ident: Ident,
pub attrs: Vec<Attribute>, pub attrs: Vec<Attribute>,
@ -706,13 +706,13 @@ pub struct TypeMethod {
// A trait method is either required (meaning it doesn't have an // A trait method is either required (meaning it doesn't have an
// implementation, just a signature) or provided (meaning it has a default // implementation, just a signature) or provided (meaning it has a default
// implementation). // implementation).
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum TraitMethod { pub enum TraitMethod {
Required(TypeMethod), Required(TypeMethod),
Provided(@Method), Provided(@Method),
} }
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum IntTy { pub enum IntTy {
TyI, TyI,
TyI8, 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 { pub enum UintTy {
TyU, TyU,
TyU8, 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 { pub enum FloatTy {
TyF32, TyF32,
TyF64, TyF64,
@ -758,7 +758,7 @@ impl fmt::Show for FloatTy {
} }
// NB PartialEq method appears below. // NB PartialEq method appears below.
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct Ty { pub struct Ty {
pub id: NodeId, pub id: NodeId,
pub node: Ty_, pub node: Ty_,
@ -766,7 +766,7 @@ pub struct Ty {
} }
// Not represented directly in the AST, referred to by name through a ty_path. // 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 { pub enum PrimTy {
TyInt(IntTy), TyInt(IntTy),
TyUint(UintTy), TyUint(UintTy),
@ -776,7 +776,7 @@ pub enum PrimTy {
TyChar TyChar
} }
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum Onceness { pub enum Onceness {
Once, Once,
Many 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 struct ClosureTy {
pub lifetimes: Vec<Lifetime>, pub lifetimes: Vec<Lifetime>,
pub fn_style: FnStyle, pub fn_style: FnStyle,
@ -804,7 +804,7 @@ pub struct ClosureTy {
pub bounds: Option<OwnedSlice<TyParamBound>>, pub bounds: Option<OwnedSlice<TyParamBound>>,
} }
#[deriving(PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct BareFnTy { pub struct BareFnTy {
pub fn_style: FnStyle, pub fn_style: FnStyle,
pub abi: Abi, pub abi: Abi,
@ -812,7 +812,7 @@ pub struct BareFnTy {
pub decl: P<FnDecl> pub decl: P<FnDecl>
} }
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum Ty_ { pub enum Ty_ {
TyNil, TyNil,
TyBot, /* bottom type */ TyBot, /* bottom type */
@ -833,13 +833,13 @@ pub enum Ty_ {
TyInfer, TyInfer,
} }
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum AsmDialect { pub enum AsmDialect {
AsmAtt, AsmAtt,
AsmIntel AsmIntel
} }
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct InlineAsm { pub struct InlineAsm {
pub asm: InternedString, pub asm: InternedString,
pub asm_str_style: StrStyle, pub asm_str_style: StrStyle,
@ -851,7 +851,7 @@ pub struct InlineAsm {
pub dialect: AsmDialect pub dialect: AsmDialect
} }
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct Arg { pub struct Arg {
pub ty: P<Ty>, pub ty: P<Ty>,
pub pat: @Pat, 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 struct FnDecl {
pub inputs: Vec<Arg>, pub inputs: Vec<Arg>,
pub output: P<Ty>, pub output: P<Ty>,
@ -886,7 +886,7 @@ pub struct FnDecl {
pub variadic: bool pub variadic: bool
} }
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum FnStyle { pub enum FnStyle {
UnsafeFn, // declared with "unsafe fn" UnsafeFn, // declared with "unsafe fn"
NormalFn, // declared with "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 { pub enum RetStyle {
NoReturn, // functions with return type _|_ that always NoReturn, // functions with return type _|_ that always
// raise an error or exit (i.e. never return to the caller) // raise an error or exit (i.e. never return to the caller)
Return, // everything else Return, // everything else
} }
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum ExplicitSelf_ { pub enum ExplicitSelf_ {
SelfStatic, // no self SelfStatic, // no self
SelfValue, // `self` SelfValue, // `self`
@ -918,7 +918,7 @@ pub enum ExplicitSelf_ {
pub type ExplicitSelf = Spanned<ExplicitSelf_>; pub type ExplicitSelf = Spanned<ExplicitSelf_>;
#[deriving(PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct Method { pub struct Method {
pub ident: Ident, pub ident: Ident,
pub attrs: Vec<Attribute>, pub attrs: Vec<Attribute>,
@ -932,7 +932,7 @@ pub struct Method {
pub vis: Visibility, pub vis: Visibility,
} }
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct Mod { pub struct Mod {
/// A span from the first token past `{` to the last token until `}`. /// A span from the first token past `{` to the last token until `}`.
/// For `mod foo;`, the inner span ranges from the first token /// For `mod foo;`, the inner span ranges from the first token
@ -942,31 +942,31 @@ pub struct Mod {
pub items: Vec<@Item>, pub items: Vec<@Item>,
} }
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct ForeignMod { pub struct ForeignMod {
pub abi: Abi, pub abi: Abi,
pub view_items: Vec<ViewItem>, pub view_items: Vec<ViewItem>,
pub items: Vec<@ForeignItem>, pub items: Vec<@ForeignItem>,
} }
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct VariantArg { pub struct VariantArg {
pub ty: P<Ty>, pub ty: P<Ty>,
pub id: NodeId, pub id: NodeId,
} }
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum VariantKind { pub enum VariantKind {
TupleVariantKind(Vec<VariantArg>), TupleVariantKind(Vec<VariantArg>),
StructVariantKind(@StructDef), StructVariantKind(@StructDef),
} }
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct EnumDef { pub struct EnumDef {
pub variants: Vec<P<Variant>>, pub variants: Vec<P<Variant>>,
} }
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct Variant_ { pub struct Variant_ {
pub name: Ident, pub name: Ident,
pub attrs: Vec<Attribute>, pub attrs: Vec<Attribute>,
@ -978,7 +978,7 @@ pub struct Variant_ {
pub type Variant = Spanned<Variant_>; pub type Variant = Spanned<Variant_>;
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct PathListIdent_ { pub struct PathListIdent_ {
pub name: Ident, pub name: Ident,
pub id: NodeId, pub id: NodeId,
@ -988,7 +988,7 @@ pub type PathListIdent = Spanned<PathListIdent_>;
pub type ViewPath = Spanned<ViewPath_>; pub type ViewPath = Spanned<ViewPath_>;
#[deriving(PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum ViewPath_ { pub enum ViewPath_ {
// quux = foo::bar::baz // quux = foo::bar::baz
@ -1005,7 +1005,7 @@ pub enum ViewPath_ {
ViewPathList(Path, Vec<PathListIdent> , NodeId) ViewPathList(Path, Vec<PathListIdent> , NodeId)
} }
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct ViewItem { pub struct ViewItem {
pub node: ViewItem_, pub node: ViewItem_,
pub attrs: Vec<Attribute>, pub attrs: Vec<Attribute>,
@ -1013,7 +1013,7 @@ pub struct ViewItem {
pub span: Span, pub span: Span,
} }
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum ViewItem_ { pub enum ViewItem_ {
// ident: name used to refer to this crate in the code // ident: name used to refer to this crate in the code
// optional (InternedString,StrStyle): if present, this is a location // optional (InternedString,StrStyle): if present, this is a location
@ -1029,17 +1029,17 @@ pub type Attribute = Spanned<Attribute_>;
// Distinguishes between Attributes that decorate items and Attributes that // Distinguishes between Attributes that decorate items and Attributes that
// are contained as statements within items. These two cases need to be // are contained as statements within items. These two cases need to be
// distinguished for pretty-printing. // distinguished for pretty-printing.
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum AttrStyle { pub enum AttrStyle {
AttrOuter, AttrOuter,
AttrInner, AttrInner,
} }
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct AttrId(pub uint); pub struct AttrId(pub uint);
// doc-comments are promoted to attributes that have is_sugared_doc = true // 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 struct Attribute_ {
pub id: AttrId, pub id: AttrId,
pub style: AttrStyle, 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 If this impl is an ItemImpl, the impl_id is redundant (it could be the
same as the impl's node id). 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 struct TraitRef {
pub path: Path, pub path: Path,
pub ref_id: NodeId, pub ref_id: NodeId,
} }
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum Visibility { pub enum Visibility {
Public, Public,
Inherited, Inherited,
@ -1075,13 +1075,13 @@ impl Visibility {
} }
} }
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum Sized { pub enum Sized {
DynSize, DynSize,
StaticSize, StaticSize,
} }
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct StructField_ { pub struct StructField_ {
pub kind: StructFieldKind, pub kind: StructFieldKind,
pub id: NodeId, pub id: NodeId,
@ -1091,7 +1091,7 @@ pub struct StructField_ {
pub type StructField = Spanned<StructField_>; pub type StructField = Spanned<StructField_>;
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum StructFieldKind { pub enum StructFieldKind {
NamedField(Ident, Visibility), NamedField(Ident, Visibility),
UnnamedField(Visibility), // element of a tuple-like struct 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 struct StructDef {
pub fields: Vec<StructField>, /* fields, not including ctor */ pub fields: Vec<StructField>, /* fields, not including ctor */
/* ID of the constructor. This is only used for tuple- or enum-like /* 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 FIXME (#3300): Should allow items to be anonymous. Right now
we just use dummy names for anon items. 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 struct Item {
pub ident: Ident, pub ident: Ident,
pub attrs: Vec<Attribute>, pub attrs: Vec<Attribute>,
@ -1130,7 +1130,7 @@ pub struct Item {
pub span: Span, pub span: Span,
} }
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum Item_ { pub enum Item_ {
ItemStatic(P<Ty>, Mutability, @Expr), ItemStatic(P<Ty>, Mutability, @Expr),
ItemFn(P<FnDecl>, FnStyle, Abi, Generics, P<Block>), ItemFn(P<FnDecl>, FnStyle, Abi, Generics, P<Block>),
@ -1148,7 +1148,7 @@ pub enum Item_ {
ItemMac(Mac), ItemMac(Mac),
} }
#[deriving(PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct ForeignItem { pub struct ForeignItem {
pub ident: Ident, pub ident: Ident,
pub attrs: Vec<Attribute>, pub attrs: Vec<Attribute>,
@ -1158,7 +1158,7 @@ pub struct ForeignItem {
pub vis: Visibility, pub vis: Visibility,
} }
#[deriving(PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum ForeignItem_ { pub enum ForeignItem_ {
ForeignItemFn(P<FnDecl>, Generics), ForeignItemFn(P<FnDecl>, Generics),
ForeignItemStatic(P<Ty>, /* is_mutbl */ bool), ForeignItemStatic(P<Ty>, /* 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 // 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 // part of the AST that we parse from a file, but it becomes part of the tree
// that we trans. // that we trans.
#[deriving(PartialEq, TotalEq, Encodable, Decodable, Hash)] #[deriving(PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum InlinedItem { pub enum InlinedItem {
IIItem(@Item), IIItem(@Item),
IIMethod(DefId /* impl id */, bool /* is provided */, @Method), IIMethod(DefId /* impl id */, bool /* is provided */, @Method),

View file

@ -33,7 +33,7 @@ pub trait Pos {
/// A byte offset. Keep this small (currently 32-bits), as AST contains /// A byte offset. Keep this small (currently 32-bits), as AST contains
/// a lot of them. /// a lot of them.
#[deriving(Clone, PartialEq, TotalEq, Hash, PartialOrd, Show)] #[deriving(Clone, PartialEq, Eq, Hash, PartialOrd, Show)]
pub struct BytePos(pub u32); pub struct BytePos(pub u32);
/// A character offset. Because of multibyte utf8 characters, a byte offset /// 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 }; 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<T> { pub struct Spanned<T> {
pub node: T, pub node: T,
pub span: Span, pub span: Span,
@ -109,7 +109,7 @@ impl PartialEq for Span {
fn ne(&self, other: &Span) -> bool { !(*self).eq(other) } fn ne(&self, other: &Span) -> bool { !(*self).eq(other) }
} }
impl TotalEq for Span {} impl Eq for Span {}
impl<S:Encoder<E>, E> Encodable<S, E> for Span { impl<S:Encoder<E>, E> Encodable<S, E> for Span {
/* Note #1972 -- spans are encoded but not decoded */ /* Note #1972 -- spans are encoded but not decoded */

View file

@ -28,7 +28,7 @@ Supported features (fairly exhaustive):
moment. (`TraitDef.additional_bounds`) moment. (`TraitDef.additional_bounds`)
Unsupported: FIXME #6257: calling methods on reference fields, 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. because of how the auto-dereferencing happens.
The most important thing for implementers is the `Substructure` and The most important thing for implementers is the `Substructure` and

View file

@ -79,9 +79,9 @@ pub fn expand_meta_deriving(cx: &mut ExtCtxt,
// NOTE: after a stage0 snap this needs treatment // NOTE: after a stage0 snap this needs treatment
"PartialEq" => expand!(eq::expand_deriving_eq), "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), "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), "Rand" => expand!(rand::expand_deriving_rand),

View file

@ -119,7 +119,7 @@ impl<T: PartialEq> PartialEq for OwnedSlice<T> {
} }
} }
impl<T: TotalEq> TotalEq for OwnedSlice<T> {} impl<T: Eq> Eq for OwnedSlice<T> {}
impl<T> Container for OwnedSlice<T> { impl<T> Container for OwnedSlice<T> {
fn len(&self) -> uint { self.len } fn len(&self) -> uint { self.len }

View file

@ -23,7 +23,7 @@ use parse::parser;
use parse::token; use parse::token;
/// The specific types of unsupported syntax /// The specific types of unsupported syntax
#[deriving(PartialEq, TotalEq, Hash)] #[deriving(PartialEq, Eq, Hash)]
pub enum ObsoleteSyntax { pub enum ObsoleteSyntax {
ObsoleteOwnedType, ObsoleteOwnedType,
ObsoleteOwnedExpr, ObsoleteOwnedExpr,

View file

@ -24,7 +24,7 @@ use std::rc::Rc;
use std::string::String; use std::string::String;
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
#[deriving(Clone, Encodable, Decodable, PartialEq, TotalEq, Hash, Show)] #[deriving(Clone, Encodable, Decodable, PartialEq, Eq, Hash, Show)]
pub enum BinOp { pub enum BinOp {
PLUS, PLUS,
MINUS, MINUS,
@ -39,7 +39,7 @@ pub enum BinOp {
} }
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
#[deriving(Clone, Encodable, Decodable, PartialEq, TotalEq, Hash, Show)] #[deriving(Clone, Encodable, Decodable, PartialEq, Eq, Hash, Show)]
pub enum Token { pub enum Token {
/* Expression-operator symbols. */ /* Expression-operator symbols. */
EQ, EQ,
@ -102,7 +102,7 @@ pub enum Token {
EOF, EOF,
} }
#[deriving(Clone, Encodable, Decodable, PartialEq, TotalEq, Hash)] #[deriving(Clone, Encodable, Decodable, PartialEq, Eq, Hash)]
/// For interpolation during macro expansion. /// For interpolation during macro expansion.
pub enum Nonterminal { pub enum Nonterminal {
NtItem(@ast::Item), NtItem(@ast::Item),
@ -552,7 +552,7 @@ pub fn get_ident_interner() -> Rc<IdentInterner> {
/// destroyed. In particular, they must not access string contents. This can /// destroyed. In particular, they must not access string contents. This can
/// be fixed in the future by just leaking all strings until task death /// be fixed in the future by just leaking all strings until task death
/// somehow. /// somehow.
#[deriving(Clone, PartialEq, Hash, PartialOrd, TotalEq, TotalOrd)] #[deriving(Clone, PartialEq, Hash, PartialOrd, Eq, Ord)]
pub struct InternedString { pub struct InternedString {
string: RcStr, string: RcStr,
} }

View file

@ -28,7 +28,7 @@ pub struct Interner<T> {
} }
// when traits can extend traits, we should extend index<Name,T> to get [] // when traits can extend traits, we should extend index<Name,T> to get []
impl<T: TotalEq + Hash + Clone + 'static> Interner<T> { impl<T: Eq + Hash + Clone + 'static> Interner<T> {
pub fn new() -> Interner<T> { pub fn new() -> Interner<T> {
Interner { Interner {
map: RefCell::new(HashMap::new()), map: RefCell::new(HashMap::new()),
@ -95,9 +95,9 @@ pub struct RcStr {
string: Rc<String>, string: Rc<String>,
} }
impl TotalEq for RcStr {} impl Eq for RcStr {}
impl TotalOrd for RcStr { impl Ord for RcStr {
fn cmp(&self, other: &RcStr) -> Ordering { fn cmp(&self, other: &RcStr) -> Ordering {
self.as_slice().cmp(&other.as_slice()) self.as_slice().cmp(&other.as_slice())
} }

View file

@ -83,7 +83,7 @@ pub mod stats;
// colons. This way if some test runner wants to arrange the tests // colons. This way if some test runner wants to arrange the tests
// hierarchically it may. // hierarchically it may.
#[deriving(Clone, PartialEq, TotalEq, Hash)] #[deriving(Clone, PartialEq, Eq, Hash)]
pub enum TestName { pub enum TestName {
StaticTestName(&'static str), StaticTestName(&'static str),
DynTestName(String) DynTestName(String)
@ -183,7 +183,7 @@ pub struct Bencher {
// The definition of a single test. A test runner will run a list of // The definition of a single test. A test runner will run a list of
// these. // these.
#[deriving(Clone, Show, PartialEq, TotalEq, Hash)] #[deriving(Clone, Show, PartialEq, Eq, Hash)]
pub struct TestDesc { pub struct TestDesc {
pub name: TestName, pub name: TestName,
pub ignore: bool, pub ignore: bool,

View file

@ -441,7 +441,7 @@ pub fn write_boxplot<T: Float + Show + FromPrimitive>(
/// Returns a HashMap with the number of occurrences of every element in the /// Returns a HashMap with the number of occurrences of every element in the
/// sequence that the iterator exposes. /// sequence that the iterator exposes.
pub fn freq_count<T: Iterator<U>, U: TotalEq+Hash>(mut iter: T) -> hashmap::HashMap<U, uint> { pub fn freq_count<T: Iterator<U>, U: Eq+Hash>(mut iter: T) -> hashmap::HashMap<U, uint> {
let mut map: hashmap::HashMap<U,uint> = hashmap::HashMap::new(); let mut map: hashmap::HashMap<U,uint> = hashmap::HashMap::new();
for elem in iter { for elem in iter {
map.insert_or_update_with(elem, 1, |_, count| *count += 1); map.insert_or_update_with(elem, 1, |_, count| *count += 1);

View file

@ -74,7 +74,7 @@ mod imp {
} }
/// A record specifying a time value in seconds and nanoseconds. /// 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 } pub struct Timespec { pub sec: i64, pub nsec: i32 }
/* /*
* Timespec assumes that pre-epoch Timespecs have negative sec and positive * Timespec assumes that pre-epoch Timespecs have negative sec and positive

View file

@ -48,7 +48,7 @@ use std::uint;
/// fragment: Some("quz".to_string()) }; /// fragment: Some("quz".to_string()) };
/// // https://username@example.com:8080/foo/bar?baz=qux#quz /// // https://username@example.com:8080/foo/bar?baz=qux#quz
/// ``` /// ```
#[deriving(Clone, PartialEq, TotalEq)] #[deriving(Clone, PartialEq, Eq)]
pub struct Url { pub struct Url {
/// The scheme part of a URL, such as `https` in the above example. /// The scheme part of a URL, such as `https` in the above example.
pub scheme: String, pub scheme: String,
@ -81,7 +81,7 @@ pub struct Path {
} }
/// An optional subcomponent of a URI authority component. /// An optional subcomponent of a URI authority component.
#[deriving(Clone, PartialEq, TotalEq)] #[deriving(Clone, PartialEq, Eq)]
pub struct UserInfo { pub struct UserInfo {
/// The user name. /// The user name.
pub user: String, pub user: String,

View file

@ -487,7 +487,7 @@ impl PartialEq for Uuid {
} }
} }
impl TotalEq for Uuid {} impl Eq for Uuid {}
// FIXME #9845: Test these more thoroughly // FIXME #9845: Test these more thoroughly
impl<T: Encoder<E>, E> Encodable<T, E> for Uuid { impl<T: Encoder<E>, E> Encodable<T, E> for Uuid {

View file

@ -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 S 2014-05-29 50b8528
freebsd-x86_64 cfa0dcc98a57f03a53bb53df6fd5db02143e2bee freebsd-x86_64 cfa0dcc98a57f03a53bb53df6fd5db02143e2bee
linux-i386 baf7c6ab5792f3d560a0f2adc94d7ff96d0cab3d linux-i386 baf7c6ab5792f3d560a0f2adc94d7ff96d0cab3d

View file

@ -30,7 +30,7 @@ static OCCURRENCES: [&'static str, ..5] = [
// Code implementation // Code implementation
#[deriving(PartialEq, PartialOrd, TotalOrd, TotalEq)] #[deriving(PartialEq, PartialOrd, Ord, Eq)]
struct Code(u64); struct Code(u64);
impl Code { impl Code {

View file

@ -16,7 +16,7 @@ extern crate rand;
#[deriving(PartialEq)] #[deriving(PartialEq)]
struct Error; struct Error;
#[deriving(TotalEq,PartialEq)] #[deriving(Eq,PartialEq)]
enum Enum { enum Enum {
A { A {
x: Error //~ ERROR x: Error //~ ERROR

View file

@ -16,7 +16,7 @@ extern crate rand;
#[deriving(PartialEq)] #[deriving(PartialEq)]
struct Error; struct Error;
#[deriving(TotalEq,PartialEq)] #[deriving(Eq,PartialEq)]
enum Enum { enum Enum {
A( A(
Error //~ ERROR Error //~ ERROR

View file

@ -16,7 +16,7 @@ extern crate rand;
#[deriving(PartialEq)] #[deriving(PartialEq)]
struct Error; struct Error;
#[deriving(TotalEq,PartialEq)] #[deriving(Eq,PartialEq)]
struct Struct { struct Struct {
x: Error //~ ERROR x: Error //~ ERROR
} }

View file

@ -16,7 +16,7 @@ extern crate rand;
#[deriving(PartialEq)] #[deriving(PartialEq)]
struct Error; struct Error;
#[deriving(TotalEq,PartialEq)] #[deriving(Eq,PartialEq)]
struct Struct( struct Struct(
Error //~ ERROR Error //~ ERROR
); );

View file

@ -13,10 +13,10 @@
#![feature(struct_variant)] #![feature(struct_variant)]
extern crate rand; extern crate rand;
#[deriving(TotalEq,PartialOrd,PartialEq)] #[deriving(Eq,PartialOrd,PartialEq)]
struct Error; struct Error;
#[deriving(TotalOrd,TotalEq,PartialOrd,PartialEq)] #[deriving(Ord,Eq,PartialOrd,PartialEq)]
enum Enum { enum Enum {
A { A {
x: Error //~ ERROR x: Error //~ ERROR

View file

@ -13,10 +13,10 @@
#![feature(struct_variant)] #![feature(struct_variant)]
extern crate rand; extern crate rand;
#[deriving(TotalEq,PartialOrd,PartialEq)] #[deriving(Eq,PartialOrd,PartialEq)]
struct Error; struct Error;
#[deriving(TotalOrd,TotalEq,PartialOrd,PartialEq)] #[deriving(Ord,Eq,PartialOrd,PartialEq)]
enum Enum { enum Enum {
A( A(
Error //~ ERROR Error //~ ERROR

View file

@ -13,10 +13,10 @@
#![feature(struct_variant)] #![feature(struct_variant)]
extern crate rand; extern crate rand;
#[deriving(TotalEq,PartialOrd,PartialEq)] #[deriving(Eq,PartialOrd,PartialEq)]
struct Error; struct Error;
#[deriving(TotalOrd,TotalEq,PartialOrd,PartialEq)] #[deriving(Ord,Eq,PartialOrd,PartialEq)]
struct Struct { struct Struct {
x: Error //~ ERROR x: Error //~ ERROR
} }

View file

@ -13,10 +13,10 @@
#![feature(struct_variant)] #![feature(struct_variant)]
extern crate rand; extern crate rand;
#[deriving(TotalEq,PartialOrd,PartialEq)] #[deriving(Eq,PartialOrd,PartialEq)]
struct Error; struct Error;
#[deriving(TotalOrd,TotalEq,PartialOrd,PartialEq)] #[deriving(Ord,Eq,PartialOrd,PartialEq)]
struct Struct( struct Struct(
Error //~ ERROR Error //~ ERROR
); );

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[deriving(PartialEq, TotalEq, PartialOrd, TotalOrd)] #[deriving(PartialEq, Eq, PartialOrd, Ord)]
enum E<T> { enum E<T> {
E0, E0,
E1(T), E1(T),
@ -22,7 +22,7 @@ pub fn main() {
let e21 = E2(1, 1); let e21 = E2(1, 1);
let e22 = E2(1, 2); 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]; let es = [e0, e11, e12, e21, e22];
for (i, e1) in es.iter().enumerate() { for (i, e1) in es.iter().enumerate() {
@ -46,7 +46,7 @@ pub fn main() {
assert_eq!(*e1 <= *e2, le); assert_eq!(*e1 <= *e2, le);
assert_eq!(*e1 >= *e2, ge); assert_eq!(*e1 >= *e2, ge);
// TotalOrd // Ord
assert_eq!(e1.cmp(e2), ord); assert_eq!(e1.cmp(e2), ord);
} }
} }

View file

@ -10,7 +10,7 @@
#![feature(struct_variant)] #![feature(struct_variant)]
#[deriving(PartialEq, TotalEq, PartialOrd, TotalOrd)] #[deriving(PartialEq, Eq, PartialOrd, Ord)]
enum ES<T> { enum ES<T> {
ES1 { x: T }, ES1 { x: T },
ES2 { x: T, y: T } ES2 { x: T, y: T }
@ -20,7 +20,7 @@ enum ES<T> {
pub fn main() { pub fn main() {
let (es11, es12, es21, es22) = (ES1 {x: 1}, ES1 {x: 2}, ES2 {x: 1, y: 1}, ES2 {x: 1, y: 2}); 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]; let ess = [es11, es12, es21, es22];
for (i, es1) in ess.iter().enumerate() { for (i, es1) in ess.iter().enumerate() {
@ -42,7 +42,7 @@ pub fn main() {
assert_eq!(*es1 <= *es2, le); assert_eq!(*es1 <= *es2, le);
assert_eq!(*es1 >= *es2, ge); assert_eq!(*es1 >= *es2, ge);
// TotalOrd // Ord
assert_eq!(es1.cmp(es2), ord); assert_eq!(es1.cmp(es2), ord);
} }
} }

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[deriving(PartialEq, TotalEq, PartialOrd, TotalOrd)] #[deriving(PartialEq, Eq, PartialOrd, Ord)]
struct S<T> { struct S<T> {
x: T, x: T,
y: T y: T
@ -18,7 +18,7 @@ pub fn main() {
let s1 = S {x: 1, y: 1}; let s1 = S {x: 1, y: 1};
let s2 = S {x: 1, y: 2}; 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]; let ss = [s1, s2];
for (i, s1) in ss.iter().enumerate() { for (i, s1) in ss.iter().enumerate() {
@ -42,7 +42,7 @@ pub fn main() {
assert_eq!(*s1 <= *s2, le); assert_eq!(*s1 <= *s2, le);
assert_eq!(*s1 >= *s2, ge); assert_eq!(*s1 >= *s2, ge);
// TotalOrd // Ord
assert_eq!(s1.cmp(s2), ord); assert_eq!(s1.cmp(s2), ord);
} }
} }

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[deriving(PartialEq, TotalEq, PartialOrd, TotalOrd)] #[deriving(PartialEq, Eq, PartialOrd, Ord)]
struct TS<T>(T,T); struct TS<T>(T,T);
@ -16,7 +16,7 @@ pub fn main() {
let ts1 = TS(1, 1); let ts1 = TS(1, 1);
let ts2 = TS(1, 2); let ts2 = TS(1, 2);
// in order for both PartialOrd and TotalOrd // in order for both PartialOrd and Ord
let tss = [ts1, ts2]; let tss = [ts1, ts2];
for (i, ts1) in tss.iter().enumerate() { for (i, ts1) in tss.iter().enumerate() {
@ -40,7 +40,7 @@ pub fn main() {
assert_eq!(*ts1 <= *ts2, le); assert_eq!(*ts1 <= *ts2, le);
assert_eq!(*ts1 >= *ts2, ge); assert_eq!(*ts1 >= *ts2, ge);
// TotalOrd // Ord
assert_eq!(ts1.cmp(ts2), ord); assert_eq!(ts1.cmp(ts2), ord);
} }
} }

View file

@ -21,13 +21,13 @@ impl PartialOrd for FailCmp {
fn lt(&self, _: &FailCmp) -> bool { fail!("lt") } 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") } fn cmp(&self, _: &FailCmp) -> Ordering { fail!("cmp") }
} }
#[deriving(PartialEq,PartialOrd,TotalEq,TotalOrd)] #[deriving(PartialEq,PartialOrd,Eq,Ord)]
struct ShortCircuit { struct ShortCircuit {
x: int, x: int,
y: FailCmp y: FailCmp

View file

@ -15,21 +15,21 @@ mod submod {
// if any of these are implemented without global calls for any // if any of these are implemented without global calls for any
// function calls, then being in a submodule will (correctly) // function calls, then being in a submodule will (correctly)
// cause errors about unrecognised module `std` (or `extra`) // cause errors about unrecognised module `std` (or `extra`)
#[deriving(PartialEq, PartialOrd, TotalEq, TotalOrd, #[deriving(PartialEq, PartialOrd, Eq, Ord,
Hash, Hash,
Clone, Clone,
Show, Rand, Show, Rand,
Encodable, Decodable)] Encodable, Decodable)]
enum A { A1(uint), A2(int) } enum A { A1(uint), A2(int) }
#[deriving(PartialEq, PartialOrd, TotalEq, TotalOrd, #[deriving(PartialEq, PartialOrd, Eq, Ord,
Hash, Hash,
Clone, Clone,
Show, Rand, Show, Rand,
Encodable, Decodable)] Encodable, Decodable)]
struct B { x: uint, y: int } struct B { x: uint, y: int }
#[deriving(PartialEq, PartialOrd, TotalEq, TotalOrd, #[deriving(PartialEq, PartialOrd, Eq, Ord,
Hash, Hash,
Clone, Clone,
Show, Rand, Show, Rand,

View file

@ -12,7 +12,7 @@
use std::cmp::{Less,Equal,Greater}; use std::cmp::{Less,Equal,Greater};
#[deriving(TotalEq,TotalOrd)] #[deriving(Eq,Ord)]
struct A<'a> { struct A<'a> {
x: &'a int x: &'a int
} }

View file

@ -13,7 +13,7 @@ extern crate collections;
use collections::HashSet; use collections::HashSet;
#[deriving(PartialEq, TotalEq, Hash)] #[deriving(PartialEq, Eq, Hash)]
struct XYZ { struct XYZ {
x: int, x: int,
y: int, y: int,

View file

@ -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> { struct TypeContext<'tcx, 'ast> {
ty_arena: &'tcx Arena, ty_arena: &'tcx Arena,
@ -86,7 +86,7 @@ impl<'tcx,'ast> TypeContext<'tcx, 'ast> {
} }
} }
#[deriving(PartialEq, TotalEq, Hash)] #[deriving(PartialEq, Eq, Hash)]
struct NodeId { struct NodeId {
id: uint id: uint
} }

View file

@ -15,7 +15,7 @@ static MAX_LEN: uint = 20;
static mut drop_counts: [uint, .. MAX_LEN] = [0, .. MAX_LEN]; static mut drop_counts: [uint, .. MAX_LEN] = [0, .. MAX_LEN];
static mut clone_count: uint = 0; 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 } struct DropCounter { x: uint, clone_num: uint }
impl Clone for DropCounter { impl Clone for DropCounter {