1
Fork 0

std: Rename {Eq,Ord} to Partial{Eq,Ord}

This is part of the ongoing renaming of the equality traits. See #12517 for more
details. All code using Eq/Ord will temporarily need to move to Partial{Eq,Ord}
or the Total{Eq,Ord} traits. The Total traits will soon be renamed to {Eq,Ord}.

cc #12517

[breaking-change]
This commit is contained in:
Alex Crichton 2014-05-29 17:45:07 -07:00
parent f4fa7c8a07
commit 748bc3ca49
256 changed files with 834 additions and 831 deletions

View file

@ -12,7 +12,7 @@ use std::from_str::FromStr;
use std::fmt;
use regex::Regex;
#[deriving(Clone, Eq)]
#[deriving(Clone, PartialEq)]
pub enum Mode {
CompileFail,
RunFail,

View file

@ -1436,7 +1436,7 @@ trait Circle : Shape { fn radius() -> f64; }
~~~~
the syntax `Circle : Shape` means that types that implement `Circle` must also have an implementation for `Shape`.
Multiple supertraits are separated by `+`, `trait Circle : Shape + Eq { }`.
Multiple supertraits are separated by `+`, `trait Circle : Shape + PartialEq { }`.
In an implementation of `Circle` for a given type `T`, methods can refer to `Shape` methods,
since the typechecker checks that any type with an implementation of `Circle` also has an implementation of `Shape`.
@ -2159,23 +2159,23 @@ There are three different types of inline attributes:
The `deriving` attribute allows certain traits to be automatically
implemented for data structures. For example, the following will
create an `impl` for the `Eq` and `Clone` traits for `Foo`, the type
parameter `T` will be given the `Eq` or `Clone` constraints for the
create an `impl` for the `PartialEq` and `Clone` traits for `Foo`, the type
parameter `T` will be given the `PartialEq` or `Clone` constraints for the
appropriate `impl`:
~~~~
#[deriving(Eq, Clone)]
#[deriving(PartialEq, Clone)]
struct Foo<T> {
a: int,
b: T
}
~~~~
The generated `impl` for `Eq` is equivalent to
The generated `impl` for `PartialEq` is equivalent to
~~~~
# struct Foo<T> { a: int, b: T }
impl<T: Eq> Eq for Foo<T> {
impl<T: PartialEq> PartialEq for Foo<T> {
fn eq(&self, other: &Foo<T>) -> bool {
self.a == other.a && self.b == other.b
}
@ -2188,7 +2188,7 @@ impl<T: Eq> Eq for Foo<T> {
Supported traits for `deriving` are:
* Comparison traits: `Eq`, `TotalEq`, `Ord`, `TotalOrd`.
* Comparison traits: `PartialEq`, `TotalEq`, `PartialOrd`, `TotalOrd`.
* Serialization: `Encodable`, `Decodable`. These require `serialize`.
* `Clone`, to create `T` from `&T` via a copy.
* `Hash`, to iterate over the bytes in a data type.
@ -2734,22 +2734,22 @@ The default meaning of the operators on standard types is given here.
* `==`
: Equal to.
Calls the `eq` method on the `std::cmp::Eq` trait.
Calls the `eq` method on the `std::cmp::PartialEq` trait.
* `!=`
: Unequal to.
Calls the `ne` method on the `std::cmp::Eq` trait.
Calls the `ne` method on the `std::cmp::PartialEq` trait.
* `<`
: Less than.
Calls the `lt` method on the `std::cmp::Ord` trait.
Calls the `lt` method on the `std::cmp::PartialOrd` trait.
* `>`
: Greater than.
Calls the `gt` method on the `std::cmp::Ord` trait.
Calls the `gt` method on the `std::cmp::PartialOrd` trait.
* `<=`
: Less than or equal.
Calls the `le` method on the `std::cmp::Ord` trait.
Calls the `le` method on the `std::cmp::PartialOrd` trait.
* `>=`
: Greater than or equal.
Calls the `ge` method on the `std::cmp::Ord` trait.
Calls the `ge` method on the `std::cmp::PartialOrd` trait.
#### Type cast expressions

View file

@ -1303,7 +1303,7 @@ be specified up-front. Our previous definition of list equality relied on the el
the `==` operator available, and took advantage of the lack of a destructor on `u32` to copy it
without a move of ownership.
We can add a *trait bound* on the `Eq` trait to require that the type implement the `==` operator.
We can add a *trait bound* on the `PartialEq` trait to require that the type implement the `==` operator.
Two more `ref` annotations need to be added to avoid attempting to move out the element types:
~~~
@ -1311,7 +1311,7 @@ Two more `ref` annotations need to be added to avoid attempting to move out the
# Cons(T, Box<List<T>>),
# Nil
# }
fn eq<T: Eq>(xs: &List<T>, ys: &List<T>) -> bool {
fn eq<T: PartialEq>(xs: &List<T>, ys: &List<T>) -> bool {
// Match on the next node in both lists.
match (xs, ys) {
// If we have reached the end of both lists, they are equal.
@ -1329,8 +1329,8 @@ let ys = Cons('c', box Cons('a', box Cons('t', box Nil)));
assert!(eq(&xs, &ys));
~~~
This would be a good opportunity to implement the `Eq` trait for our list type, making the `==` and
`!=` operators available. We'll need to provide an `impl` for the `Eq` trait and a definition of the
This would be a good opportunity to implement the `PartialEq` trait for our list type, making the `==` and
`!=` operators available. We'll need to provide an `impl` for the `PartialEq` trait and a definition of the
`eq` method. In a method, the `self` parameter refers to an instance of the type we're implementing
on.
@ -1339,7 +1339,7 @@ on.
# Cons(T, Box<List<T>>),
# Nil
# }
impl<T: Eq> Eq for List<T> {
impl<T: PartialEq> PartialEq for List<T> {
fn eq(&self, ys: &List<T>) -> bool {
// Match on the next node in both lists.
match (self, ys) {
@ -1356,12 +1356,12 @@ impl<T: Eq> Eq for List<T> {
let xs = Cons(5, box Cons(10, box Nil));
let ys = Cons(5, box Cons(10, box Nil));
// The methods below are part of the Eq trait,
// The methods below are part of the PartialEq trait,
// which we implemented on our linked list.
assert!(xs.eq(&ys));
assert!(!xs.ne(&ys));
// The Eq trait also allows us to use the shorthand infix operators.
// The PartialEq trait also allows us to use the shorthand infix operators.
assert!(xs == ys); // `xs == ys` is short for `xs.eq(&ys)`
assert!(!(xs != ys)); // `xs != ys` is short for `xs.ne(&ys)`
~~~
@ -2345,12 +2345,12 @@ trait describes types that support an equality operation:
~~~~
// In a trait, `self` refers to the self argument.
// `Self` refers to the type implementing the trait.
trait Eq {
trait PartialEq {
fn equals(&self, other: &Self) -> bool;
}
// In an impl, `self` refers just to the value of the receiver
impl Eq for int {
impl PartialEq for int {
fn equals(&self, other: &int) -> bool { *other == *self }
}
~~~~
@ -2600,13 +2600,13 @@ A small number of traits in `std` and `extra` can have implementations
that can be automatically derived. These instances are specified by
placing the `deriving` attribute on a data type declaration. For
example, the following will mean that `Circle` has an implementation
for `Eq` and can be used with the equality operators, and that a value
for `PartialEq` and can be used with the equality operators, and that a value
of type `ABC` can be randomly generated and converted to a string:
~~~
extern crate rand;
#[deriving(Eq)]
#[deriving(PartialEq)]
struct Circle { radius: f64 }
#[deriving(Rand, Show)]
@ -2618,7 +2618,7 @@ fn main() {
}
~~~
The full list of derivable traits is `Eq`, `TotalEq`, `Ord`,
The full list of derivable traits is `PartialEq`, `TotalEq`, `Ord`,
`TotalOrd`, `Encodable`, `Decodable`, `Clone`,
`Hash`, `Rand`, `Default`, `Zero`, `FromPrimitive` and `Show`.

View file

@ -35,7 +35,7 @@ TEMPLATE = """// Copyright {year} The Rust Project Developers. See the COPYRIGHT
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py'
#![feature(struct_variant)]
extern crate rand;
@ -117,8 +117,10 @@ traits = {
for (trait, supers, errs) in [('Rand', [], 1),
('Clone', [], 1),
('Eq', [], 2), ('Ord', [], 8),
('TotalEq', [], 1), ('TotalOrd', ['TotalEq'], 1),
('PartialEq', [], 2),
('PartialOrd', ['PartialEq'], 8),
('TotalEq', ['PartialEq'], 1),
('TotalOrd', ['TotalEq', 'PartialOrd', 'PartialEq'], 1),
('Show', [], 1),
('Hash', [], 1)]:
traits[trait] = (ALL, supers, errs)

View file

@ -12,7 +12,7 @@
use core::any::{Any, AnyRefExt};
use core::clone::Clone;
use core::cmp::{Eq, Ord, TotalEq, TotalOrd, Ordering};
use core::cmp::{PartialEq, PartialOrd, TotalEq, TotalOrd, Ordering};
use core::default::Default;
use core::fmt;
use core::intrinsics;
@ -51,13 +51,13 @@ impl<T: Clone> Clone for Box<T> {
}
// box pointers
impl<T:Eq> Eq for Box<T> {
impl<T:PartialEq> PartialEq for Box<T> {
#[inline]
fn eq(&self, other: &Box<T>) -> bool { *(*self) == *(*other) }
#[inline]
fn ne(&self, other: &Box<T>) -> bool { *(*self) != *(*other) }
}
impl<T:Ord> Ord for Box<T> {
impl<T:PartialOrd> PartialOrd for Box<T> {
#[inline]
fn lt(&self, other: &Box<T>) -> bool { *(*self) < *(*other) }
#[inline]

View file

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

View file

@ -43,7 +43,7 @@ use std::rt::heap::allocate;
// The way arena uses arrays is really deeply awful. The arrays are
// allocated, and have capacities reserved, but the fill for the array
// will always stay at 0.
#[deriving(Clone, Eq)]
#[deriving(Clone, PartialEq)]
struct Chunk {
data: Rc<RefCell<Vec<u8> >>,
fill: Cell<uint>,

View file

@ -796,7 +796,7 @@ impl BitvSet {
}
}
impl cmp::Eq for BitvSet {
impl cmp::PartialEq for BitvSet {
fn eq(&self, other: &BitvSet) -> bool {
if self.size != other.size {
return false;

View file

@ -92,7 +92,7 @@ impl<K: Clone + TotalOrd, V: Clone> Clone for BTree<K, V> {
}
}
impl<K: TotalOrd, V: TotalEq> Eq for BTree<K, V> {
impl<K: TotalOrd, V: TotalEq> PartialEq for BTree<K, V> {
fn eq(&self, other: &BTree<K, V>) -> bool {
self.root.cmp(&other.root) == Equal
}
@ -100,7 +100,7 @@ impl<K: TotalOrd, V: TotalEq> Eq for BTree<K, V> {
impl<K: TotalOrd, V: TotalEq> TotalEq for BTree<K, V> {}
impl<K: TotalOrd, V: TotalEq> Ord for BTree<K, V> {
impl<K: TotalOrd, V: TotalEq> PartialOrd for BTree<K, V> {
fn lt(&self, other: &BTree<K, V>) -> bool {
self.cmp(other) == Less
}
@ -198,7 +198,7 @@ impl<K: Clone + TotalOrd, V: Clone> Clone for Node<K, V> {
}
}
impl<K: TotalOrd, V: TotalEq> Eq for Node<K, V> {
impl<K: TotalOrd, V: TotalEq> PartialEq for Node<K, V> {
fn eq(&self, other: &Node<K, V>) -> bool {
match *self{
BranchNode(ref branch) => {
@ -222,7 +222,7 @@ impl<K: TotalOrd, V: TotalEq> Eq for Node<K, V> {
impl<K: TotalOrd, V: TotalEq> TotalEq for Node<K, V> {}
impl<K: TotalOrd, V: TotalEq> Ord for Node<K, V> {
impl<K: TotalOrd, V: TotalEq> PartialOrd for Node<K, V> {
fn lt(&self, other: &Node<K, V>) -> bool {
self.cmp(other) == Less
}
@ -393,7 +393,7 @@ impl<K: Clone + TotalOrd, V: Clone> Clone for Leaf<K, V> {
}
}
impl<K: TotalOrd, V: TotalEq> Eq for Leaf<K, V> {
impl<K: TotalOrd, V: TotalEq> PartialEq for Leaf<K, V> {
fn eq(&self, other: &Leaf<K, V>) -> bool {
self.elts == other.elts
}
@ -401,7 +401,7 @@ impl<K: TotalOrd, V: TotalEq> Eq for Leaf<K, V> {
impl<K: TotalOrd, V: TotalEq> TotalEq for Leaf<K, V> {}
impl<K: TotalOrd, V: TotalEq> Ord for Leaf<K, V> {
impl<K: TotalOrd, V: TotalEq> PartialOrd for Leaf<K, V> {
fn lt(&self, other: &Leaf<K, V>) -> bool {
self.cmp(other) == Less
}
@ -623,7 +623,7 @@ impl<K: Clone + TotalOrd, V: Clone> Clone for Branch<K, V> {
}
}
impl<K: TotalOrd, V: TotalEq> Eq for Branch<K, V> {
impl<K: TotalOrd, V: TotalEq> PartialEq for Branch<K, V> {
fn eq(&self, other: &Branch<K, V>) -> bool {
self.elts == other.elts
}
@ -631,7 +631,7 @@ impl<K: TotalOrd, V: TotalEq> Eq for Branch<K, V> {
impl<K: TotalOrd, V: TotalEq> TotalEq for Branch<K, V> {}
impl<K: TotalOrd, V: TotalEq> Ord for Branch<K, V> {
impl<K: TotalOrd, V: TotalEq> PartialOrd for Branch<K, V> {
fn lt(&self, other: &Branch<K, V>) -> bool {
self.cmp(other) == Less
}
@ -691,7 +691,7 @@ impl<K: Clone + TotalOrd, V: Clone> Clone for LeafElt<K, V> {
}
}
impl<K: TotalOrd, V: TotalEq> Eq for LeafElt<K, V> {
impl<K: TotalOrd, V: TotalEq> PartialEq for LeafElt<K, V> {
fn eq(&self, other: &LeafElt<K, V>) -> bool {
self.key == other.key && self.value == other.value
}
@ -699,7 +699,7 @@ impl<K: TotalOrd, V: TotalEq> Eq for LeafElt<K, V> {
impl<K: TotalOrd, V: TotalEq> TotalEq for LeafElt<K, V> {}
impl<K: TotalOrd, V: TotalEq> Ord for LeafElt<K, V> {
impl<K: TotalOrd, V: TotalEq> PartialOrd for LeafElt<K, V> {
fn lt(&self, other: &LeafElt<K, V>) -> bool {
self.cmp(other) == Less
}
@ -740,7 +740,7 @@ impl<K: Clone + TotalOrd, V: Clone> Clone for BranchElt<K, V> {
}
}
impl<K: TotalOrd, V: TotalEq> Eq for BranchElt<K, V>{
impl<K: TotalOrd, V: TotalEq> PartialEq for BranchElt<K, V>{
fn eq(&self, other: &BranchElt<K, V>) -> bool {
self.key == other.key && self.value == other.value
}
@ -748,7 +748,7 @@ impl<K: TotalOrd, V: TotalEq> Eq for BranchElt<K, V>{
impl<K: TotalOrd, V: TotalEq> TotalEq for BranchElt<K, V>{}
impl<K: TotalOrd, V: TotalEq> Ord for BranchElt<K, V> {
impl<K: TotalOrd, V: TotalEq> PartialOrd for BranchElt<K, V> {
fn lt(&self, other: &BranchElt<K, V>) -> bool {
self.cmp(other) == Less
}

View file

@ -572,7 +572,7 @@ impl<A> Extendable<A> for DList<A> {
}
}
impl<A: Eq> Eq for DList<A> {
impl<A: PartialEq> PartialEq for DList<A> {
fn eq(&self, other: &DList<A>) -> bool {
self.len() == other.len() &&
iter::order::eq(self.iter(), other.iter())
@ -584,7 +584,7 @@ impl<A: Eq> Eq for DList<A> {
}
}
impl<A: Ord> Ord for DList<A> {
impl<A: PartialOrd> PartialOrd for DList<A> {
fn lt(&self, other: &DList<A>) -> bool {
iter::order::lt(self.iter(), other.iter())
}

View file

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

View file

@ -12,7 +12,7 @@
use std::container::{Container, Mutable, Map, MutableMap, Set, MutableSet};
use std::clone::Clone;
use std::cmp::{Eq, TotalEq, Equiv, max};
use std::cmp::{PartialEq, TotalEq, Equiv, max};
use std::default::Default;
use std::fmt;
use std::fmt::Show;
@ -32,7 +32,7 @@ use std::slice::ImmutableVector;
mod table {
use std::clone::Clone;
use std::cmp;
use std::cmp::Eq;
use std::cmp::PartialEq;
use std::hash::{Hash, Hasher};
use std::kinds::marker;
use std::num::{CheckedMul, is_power_of_two};
@ -145,7 +145,7 @@ mod table {
/// A hash that is not zero, since we use a hash of zero to represent empty
/// buckets.
#[deriving(Eq)]
#[deriving(PartialEq)]
pub struct SafeHash {
hash: u64,
}
@ -661,8 +661,8 @@ static INITIAL_LOAD_FACTOR: Fraction = (9, 10);
/// denial-of-service attacks (Hash DoS). This behaviour can be
/// overridden with one of the constructors.
///
/// It is required that the keys implement the `Eq` and `Hash` traits, although
/// this can frequently be achieved by using `#[deriving(Eq, Hash)]`.
/// It is required that the keys implement the `PartialEq` and `Hash` traits, although
/// this can frequently be achieved by using `#[deriving(PartialEq, Hash)]`.
///
/// Relevant papers/articles:
///
@ -1402,7 +1402,7 @@ impl<K: TotalEq + Hash<S>, V: Clone, S, H: Hasher<S>> HashMap<K, V, H> {
}
}
impl<K: TotalEq + Hash<S>, V: Eq, S, H: Hasher<S>> Eq for HashMap<K, V, H> {
impl<K: TotalEq + Hash<S>, V: PartialEq, S, H: Hasher<S>> PartialEq for HashMap<K, V, H> {
fn eq(&self, other: &HashMap<K, V, H>) -> bool {
if self.len() != other.len() { return false; }
@ -1480,13 +1480,13 @@ pub type SetMoveItems<K> =
/// An implementation of a hash set using the underlying representation of a
/// HashMap where the value is (). As with the `HashMap` type, a `HashSet`
/// requires that the elements implement the `Eq` and `Hash` traits.
/// requires that the elements implement the `PartialEq` and `Hash` traits.
#[deriving(Clone)]
pub struct HashSet<T, H = sip::SipHasher> {
map: HashMap<T, (), H>
}
impl<T: TotalEq + Hash<S>, S, H: Hasher<S>> Eq for HashSet<T, H> {
impl<T: TotalEq + Hash<S>, S, H: Hasher<S>> PartialEq for HashSet<T, H> {
fn eq(&self, other: &HashSet<T, H>) -> bool {
if self.len() != other.len() { return false; }
@ -1691,7 +1691,7 @@ mod test_map {
local_data_key!(drop_vector: RefCell<Vec<int>>)
#[deriving(Hash, Eq, TotalEq)]
#[deriving(Hash, PartialEq, TotalEq)]
struct Dropable {
k: uint
}

View file

@ -67,7 +67,7 @@ impl<S, K: Hash<S>> Hash<S> for KeyRef<K> {
}
}
impl<K: Eq> Eq for KeyRef<K> {
impl<K: PartialEq> PartialEq for KeyRef<K> {
fn eq(&self, other: &KeyRef<K>) -> bool {
unsafe{ (*self.k).eq(&*other.k) }
}
@ -253,7 +253,7 @@ impl<K, V> Drop for LruCache<K, V> {
mod tests {
use super::LruCache;
fn assert_opt_eq<V: Eq>(opt: Option<&V>, v: V) {
fn assert_opt_eq<V: PartialEq>(opt: Option<&V>, v: V) {
assert!(opt.is_some());
assert!(opt.unwrap() == &v);
}

View file

@ -364,7 +364,7 @@ fn raw_index(lo: uint, len: uint, index: uint) -> uint {
}
}
impl<A: Eq> Eq for RingBuf<A> {
impl<A: PartialEq> PartialEq for RingBuf<A> {
fn eq(&self, other: &RingBuf<A>) -> bool {
self.nelts == other.nelts &&
self.iter().zip(other.iter()).all(|(a, b)| a.eq(b))
@ -397,7 +397,7 @@ mod tests {
use self::test::Bencher;
use deque::Deque;
use std::clone::Clone;
use std::cmp::Eq;
use std::cmp::PartialEq;
use std::fmt::Show;
use super::RingBuf;
@ -483,7 +483,7 @@ mod tests {
}
#[cfg(test)]
fn test_parameterized<T:Clone + Eq + Show>(a: T, b: T, c: T, d: T) {
fn test_parameterized<T:Clone + PartialEq + Show>(a: T, b: T, c: T, d: T) {
let mut deq = RingBuf::new();
assert_eq!(deq.len(), 0);
deq.push_front(a.clone());
@ -568,21 +568,21 @@ mod tests {
})
}
#[deriving(Clone, Eq, Show)]
#[deriving(Clone, PartialEq, Show)]
enum Taggy {
One(int),
Two(int, int),
Three(int, int, int),
}
#[deriving(Clone, Eq, Show)]
#[deriving(Clone, PartialEq, Show)]
enum Taggypar<T> {
Onepar(int),
Twopar(int, int),
Threepar(int, int, int),
}
#[deriving(Clone, Eq, Show)]
#[deriving(Clone, PartialEq, Show)]
struct RecCy {
x: int,
y: int,

View file

@ -43,7 +43,7 @@ pub struct TreeMap<K, V> {
length: uint
}
impl<K: Eq + TotalOrd, V: Eq> Eq for TreeMap<K, V> {
impl<K: PartialEq + TotalOrd, V: PartialEq> PartialEq for TreeMap<K, V> {
fn eq(&self, other: &TreeMap<K, V>) -> bool {
self.len() == other.len() &&
self.iter().zip(other.iter()).all(|(a, b)| a == b)
@ -51,7 +51,7 @@ impl<K: Eq + TotalOrd, V: Eq> Eq for TreeMap<K, V> {
}
// Lexicographical comparison
fn lt<K: Ord + TotalOrd, V: Ord>(a: &TreeMap<K, V>,
fn lt<K: PartialOrd + TotalOrd, V: PartialOrd>(a: &TreeMap<K, V>,
b: &TreeMap<K, V>) -> bool {
// the Zip iterator is as long as the shortest of a and b.
for ((key_a, value_a), (key_b, value_b)) in a.iter().zip(b.iter()) {
@ -64,7 +64,7 @@ fn lt<K: Ord + TotalOrd, V: Ord>(a: &TreeMap<K, V>,
a.len() < b.len()
}
impl<K: Ord + TotalOrd, V: Ord> Ord for TreeMap<K, V> {
impl<K: PartialOrd + TotalOrd, V: PartialOrd> PartialOrd for TreeMap<K, V> {
#[inline]
fn lt(&self, other: &TreeMap<K, V>) -> bool { lt(self, other) }
}
@ -552,12 +552,12 @@ pub struct TreeSet<T> {
map: TreeMap<T, ()>
}
impl<T: Eq + TotalOrd> Eq for TreeSet<T> {
impl<T: PartialEq + TotalOrd> PartialEq for TreeSet<T> {
#[inline]
fn eq(&self, other: &TreeSet<T>) -> bool { self.map == other.map }
}
impl<T: Ord + TotalOrd> Ord for TreeSet<T> {
impl<T: PartialOrd + TotalOrd> PartialOrd for TreeSet<T> {
#[inline]
fn lt(&self, other: &TreeSet<T>) -> bool { self.map < other.map }
}
@ -1070,7 +1070,7 @@ mod test_treemap {
assert_eq!(m.find(&k1), Some(&v1));
}
fn check_equal<K: Eq + TotalOrd, V: Eq>(ctrl: &[(K, V)],
fn check_equal<K: PartialEq + TotalOrd, V: PartialEq>(ctrl: &[(K, V)],
map: &TreeMap<K, V>) {
assert_eq!(ctrl.is_empty(), map.is_empty());
for x in ctrl.iter() {

View file

@ -121,7 +121,7 @@ mod tests {
use realstd::owned::{Box, AnyOwnExt};
use realstd::str::Str;
#[deriving(Eq, Show)]
#[deriving(PartialEq, Show)]
struct Test;
static TEST: &'static str = "Test";

View file

@ -160,7 +160,7 @@
// FIXME: Relationship to Atomic types and RWLock
use clone::Clone;
use cmp::Eq;
use cmp::PartialEq;
use kinds::{marker, Copy};
use ops::{Deref, DerefMut, Drop};
use option::{None, Option, Some};
@ -202,7 +202,7 @@ impl<T:Copy> Clone for Cell<T> {
}
}
impl<T:Eq + Copy> Eq for Cell<T> {
impl<T:PartialEq + Copy> PartialEq for Cell<T> {
fn eq(&self, other: &Cell<T>) -> bool {
self.get() == other.get()
}
@ -308,7 +308,7 @@ impl<T: Clone> Clone for RefCell<T> {
}
}
impl<T: Eq> Eq for RefCell<T> {
impl<T: PartialEq> PartialEq for RefCell<T> {
fn eq(&self, other: &RefCell<T>) -> bool {
*self.borrow() == *other.borrow()
}

View file

@ -8,14 +8,14 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
//! Defines the `Ord` and `Eq` comparison traits.
//! Defines the `PartialOrd` and `PartialEq` comparison traits.
//!
//! This module defines both `Ord` and `Eq` traits which are used by the
//! This module defines both `PartialOrd` and `PartialEq` traits which are used by the
//! compiler to implement comparison operators. Rust programs may implement
//!`Ord` to overload the `<`, `<=`, `>`, and `>=` operators, and may implement
//! `Eq` to overload the `==` and `!=` operators.
//!`PartialOrd` to overload the `<`, `<=`, `>`, and `>=` operators, and may implement
//! `PartialEq` to overload the `==` and `!=` operators.
//!
//! For example, to define a type with a customized definition for the Eq
//! For example, to define a type with a customized definition for the PartialEq
//! operators, you could do the following:
//!
//! ```rust
@ -24,8 +24,8 @@
//! num : int
//! }
//!
//! // Our implementation of `Eq` to support `==` and `!=`.
//! impl Eq for SketchyNum {
//! // Our implementation of `PartialEq` to support `==` and `!=`.
//! impl PartialEq for SketchyNum {
//! // Our custom eq allows numbers which are near each other to be equal! :D
//! fn eq(&self, other: &SketchyNum) -> bool {
//! (self.num - other.num).abs() < 5
@ -37,9 +37,6 @@
//! assert!(SketchyNum {num: 25} != SketchyNum {num: 57});
//! ```
pub use PartialEq = cmp::Eq;
pub use PartialOrd = cmp::Ord;
/// Trait for values that can be compared for equality and inequality.
///
/// This trait allows partial equality, where types can be unordered instead of
@ -47,13 +44,13 @@ pub use PartialOrd = cmp::Ord;
/// types `a == b` and `a != b` will both evaluate to false if either `a` or
/// `b` is NaN (cf. IEEE 754-2008 section 5.11).
///
/// Eq only requires the `eq` method to be implemented; `ne` is its negation by
/// PartialEq only requires the `eq` method to be implemented; `ne` is its negation by
/// default.
///
/// Eventually, this will be implemented by default for types that implement
/// `TotalEq`.
#[lang="eq"]
pub trait Eq {
pub trait PartialEq {
/// This method tests for `self` and `other` values to be equal, and is used by `==`.
fn eq(&self, other: &Self) -> bool;
@ -71,7 +68,7 @@ pub trait Eq {
/// - reflexive: `a == a`;
/// - symmetric: `a == b` implies `b == a`; and
/// - transitive: `a == b` and `b == c` implies `a == c`.
pub trait TotalEq: Eq {
pub trait TotalEq: PartialEq {
// FIXME #13101: this method is used solely by #[deriving] to
// assert that every component of a type implements #[deriving]
// itself, the current deriving infrastructure means doing this
@ -85,7 +82,7 @@ pub trait TotalEq: Eq {
}
/// An ordering is, e.g, a result of a comparison between two values.
#[deriving(Clone, Eq, Show)]
#[deriving(Clone, PartialEq, Show)]
pub enum Ordering {
/// An ordering where a compared value is less [than another].
Less = -1,
@ -104,7 +101,7 @@ pub enum Ordering {
/// true; and
/// - transitive, `a < b` and `b < c` implies `a < c`. The same must hold for
/// both `==` and `>`.
pub trait TotalOrd: TotalEq + Ord {
pub trait TotalOrd: TotalEq + PartialOrd {
/// This method returns an ordering between `self` and `other` values.
///
/// By convention, `self.cmp(&other)` returns the ordering matching
@ -127,7 +124,7 @@ impl TotalOrd for Ordering {
}
}
impl Ord for Ordering {
impl PartialOrd for Ordering {
#[inline]
fn lt(&self, other: &Ordering) -> bool { (*self as int) < (*other as int) }
}
@ -147,14 +144,14 @@ pub fn lexical_ordering(o1: Ordering, o2: Ordering) -> Ordering {
/// Trait for values that can be compared for a sort-order.
///
/// Ord only requires implementation of the `lt` method,
/// PartialOrd only requires implementation of the `lt` method,
/// with the others generated from default implementations.
///
/// However it remains possible to implement the others separately,
/// for compatibility with floating-point NaN semantics
/// (cf. IEEE 754-2008 section 5.11).
#[lang="ord"]
pub trait Ord: Eq {
pub trait PartialOrd: PartialEq {
/// This method tests less than (for `self` and `other`) and is used by the `<` operator.
fn lt(&self, other: &Self) -> bool;
@ -192,14 +189,15 @@ pub fn max<T: TotalOrd>(v1: T, v2: T) -> T {
if v1 > v2 { v1 } else { v2 }
}
// Implementation of Eq, TotalEq, Ord and TotalOrd for primitive types
// Implementation of PartialEq, TotalEq, PartialOrd and TotalOrd for primitive types
#[cfg(not(test))]
mod impls {
use cmp::{Ord, TotalOrd, Eq, TotalEq, Ordering, Less, Greater, Equal};
use cmp::{PartialOrd, TotalOrd, PartialEq, TotalEq, Ordering,
Less, Greater, Equal};
macro_rules! eq_impl(
($($t:ty)*) => ($(
impl Eq for $t {
impl PartialEq for $t {
#[inline]
fn eq(&self, other: &$t) -> bool { (*self) == (*other) }
#[inline]
@ -208,7 +206,7 @@ mod impls {
)*)
)
impl Eq for () {
impl PartialEq for () {
#[inline]
fn eq(&self, _other: &()) -> bool { true }
#[inline]
@ -227,7 +225,7 @@ mod impls {
macro_rules! ord_impl(
($($t:ty)*) => ($(
impl Ord for $t {
impl PartialOrd for $t {
#[inline]
fn lt(&self, other: &$t) -> bool { (*self) < (*other) }
#[inline]
@ -240,12 +238,12 @@ mod impls {
)*)
)
impl Ord for () {
impl PartialOrd for () {
#[inline]
fn lt(&self, _other: &()) -> bool { false }
}
impl Ord for bool {
impl PartialOrd for bool {
#[inline]
fn lt(&self, other: &bool) -> bool {
(*self as u8) < (*other as u8)
@ -282,13 +280,13 @@ mod impls {
totalord_impl!(char uint u8 u16 u32 u64 int i8 i16 i32 i64)
// & pointers
impl<'a, T: Eq> Eq for &'a T {
impl<'a, T: PartialEq> PartialEq for &'a T {
#[inline]
fn eq(&self, other: & &'a T) -> bool { *(*self) == *(*other) }
#[inline]
fn ne(&self, other: & &'a T) -> bool { *(*self) != *(*other) }
}
impl<'a, T: Ord> Ord for &'a T {
impl<'a, T: PartialOrd> PartialOrd for &'a T {
#[inline]
fn lt(&self, other: & &'a T) -> bool { *(*self) < *(*other) }
#[inline]
@ -305,13 +303,13 @@ mod impls {
impl<'a, T: TotalEq> TotalEq for &'a T {}
// &mut pointers
impl<'a, T: Eq> Eq for &'a mut T {
impl<'a, T: PartialEq> PartialEq for &'a mut T {
#[inline]
fn eq(&self, other: &&'a mut T) -> bool { **self == *(*other) }
#[inline]
fn ne(&self, other: &&'a mut T) -> bool { **self != *(*other) }
}
impl<'a, T: Ord> Ord for &'a mut T {
impl<'a, T: PartialOrd> PartialOrd for &'a mut T {
#[inline]
fn lt(&self, other: &&'a mut T) -> bool { **self < **other }
#[inline]
@ -328,13 +326,13 @@ mod impls {
impl<'a, T: TotalEq> TotalEq for &'a mut T {}
// @ pointers
impl<T:Eq> Eq for @T {
impl<T:PartialEq> PartialEq for @T {
#[inline]
fn eq(&self, other: &@T) -> bool { *(*self) == *(*other) }
#[inline]
fn ne(&self, other: &@T) -> bool { *(*self) != *(*other) }
}
impl<T:Ord> Ord for @T {
impl<T:PartialOrd> PartialOrd for @T {
#[inline]
fn lt(&self, other: &@T) -> bool { *(*self) < *(*other) }
#[inline]
@ -400,8 +398,8 @@ mod test {
num : int
}
// Our implementation of `Eq` to support `==` and `!=`.
impl Eq for SketchyNum {
// Our implementation of `PartialEq` to support `==` and `!=`.
impl PartialEq for SketchyNum {
// Our custom eq allows numbers which are near each other to be equal! :D
fn eq(&self, other: &SketchyNum) -> bool {
(self.num - other.num).abs() < 5

View file

@ -65,23 +65,23 @@ trait GenericRadix {
}
/// A binary (base 2) radix
#[deriving(Clone, Eq)]
#[deriving(Clone, PartialEq)]
struct Binary;
/// An octal (base 8) radix
#[deriving(Clone, Eq)]
#[deriving(Clone, PartialEq)]
struct Octal;
/// A decimal (base 10) radix
#[deriving(Clone, Eq)]
#[deriving(Clone, PartialEq)]
struct Decimal;
/// A hexadecimal (base 16) radix, formatted with lower-case characters
#[deriving(Clone, Eq)]
#[deriving(Clone, PartialEq)]
struct LowerHex;
/// A hexadecimal (base 16) radix, formatted with upper-case characters
#[deriving(Clone, Eq)]
#[deriving(Clone, PartialEq)]
pub struct UpperHex;
macro_rules! radix {
@ -108,7 +108,7 @@ radix!(UpperHex, 16, "0x", x @ 0 .. 9 => '0' as u8 + x,
x @ 10 ..15 => 'A' as u8 + (x - 10))
/// A radix with in the range of `2..36`.
#[deriving(Clone, Eq)]
#[deriving(Clone, PartialEq)]
pub struct Radix {
base: u8,
}

View file

@ -40,7 +40,7 @@ pub struct FormatSpec {
pub width: Count,
}
#[deriving(Eq)]
#[deriving(PartialEq)]
pub enum Alignment {
AlignLeft,
AlignRight,

View file

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

View file

@ -68,7 +68,7 @@ use cmp;
use num::{Zero, One, CheckedAdd, CheckedSub, Saturating, ToPrimitive, Int};
use option::{Option, Some, None};
use ops::{Add, Mul, Sub};
use cmp::{Eq, Ord, TotalOrd};
use cmp::{PartialEq, PartialOrd, TotalOrd};
use clone::Clone;
use uint;
use mem;
@ -847,7 +847,7 @@ impl<A: Mul<A, A> + One, T: Iterator<A>> MultiplicativeIterator<A> for T {
}
/// A trait for iterators over elements which can be compared to one another.
/// The type of each element must ascribe to the `Ord` trait.
/// The type of each element must ascribe to the `PartialOrd` trait.
pub trait OrdIterator<A> {
/// Consumes the entire iterator to return the maximum element.
///
@ -971,7 +971,7 @@ impl<A: TotalOrd, T: Iterator<A>> OrdIterator<A> for T {
}
/// `MinMaxResult` is an enum returned by `min_max`. See `OrdIterator::min_max` for more detail.
#[deriving(Clone, Eq, Show)]
#[deriving(Clone, PartialEq, Show)]
pub enum MinMaxResult<T> {
/// Empty iterator
NoElements,
@ -1945,12 +1945,12 @@ pub struct Range<A> {
/// Return an iterator over the range [start, stop)
#[inline]
pub fn range<A: Add<A, A> + Ord + Clone + One>(start: A, stop: A) -> Range<A> {
pub fn range<A: Add<A, A> + PartialOrd + Clone + One>(start: A, stop: A) -> Range<A> {
Range{state: start, stop: stop, one: One::one()}
}
// FIXME: #10414: Unfortunate type bound
impl<A: Add<A, A> + Ord + Clone + ToPrimitive> Iterator<A> for Range<A> {
impl<A: Add<A, A> + PartialOrd + Clone + ToPrimitive> Iterator<A> for Range<A> {
#[inline]
fn next(&mut self) -> Option<A> {
if self.state < self.stop {
@ -1997,7 +1997,7 @@ impl<A: Add<A, A> + Ord + Clone + ToPrimitive> Iterator<A> for Range<A> {
/// `Int` is required to ensure the range will be the same regardless of
/// the direction it is consumed.
impl<A: Int + Ord + Clone + ToPrimitive> DoubleEndedIterator<A> for Range<A> {
impl<A: Int + PartialOrd + Clone + ToPrimitive> DoubleEndedIterator<A> for Range<A> {
#[inline]
fn next_back(&mut self) -> Option<A> {
if self.stop > self.state {
@ -2018,12 +2018,12 @@ pub struct RangeInclusive<A> {
/// Return an iterator over the range [start, stop]
#[inline]
pub fn range_inclusive<A: Add<A, A> + Ord + Clone + One>(start: A, stop: A)
pub fn range_inclusive<A: Add<A, A> + PartialOrd + Clone + One>(start: A, stop: A)
-> RangeInclusive<A> {
RangeInclusive{range: range(start, stop), done: false}
}
impl<A: Add<A, A> + Ord + Clone + ToPrimitive> Iterator<A> for RangeInclusive<A> {
impl<A: Add<A, A> + PartialOrd + Clone + ToPrimitive> Iterator<A> for RangeInclusive<A> {
#[inline]
fn next(&mut self) -> Option<A> {
match self.range.next() {
@ -2055,7 +2055,7 @@ impl<A: Add<A, A> + Ord + Clone + ToPrimitive> Iterator<A> for RangeInclusive<A>
}
}
impl<A: Sub<A, A> + Int + Ord + Clone + ToPrimitive> DoubleEndedIterator<A>
impl<A: Sub<A, A> + Int + PartialOrd + Clone + ToPrimitive> DoubleEndedIterator<A>
for RangeInclusive<A> {
#[inline]
fn next_back(&mut self) -> Option<A> {
@ -2083,12 +2083,12 @@ pub struct RangeStep<A> {
/// Return an iterator over the range [start, stop) by `step`. It handles overflow by stopping.
#[inline]
pub fn range_step<A: CheckedAdd + Ord + Clone + Zero>(start: A, stop: A, step: A) -> RangeStep<A> {
pub fn range_step<A: CheckedAdd + PartialOrd + Clone + Zero>(start: A, stop: A, step: A) -> RangeStep<A> {
let rev = step < Zero::zero();
RangeStep{state: start, stop: stop, step: step, rev: rev}
}
impl<A: CheckedAdd + Ord + Clone> Iterator<A> for RangeStep<A> {
impl<A: CheckedAdd + PartialOrd + Clone> Iterator<A> for RangeStep<A> {
#[inline]
fn next(&mut self) -> Option<A> {
if (self.rev && self.state > self.stop) || (!self.rev && self.state < self.stop) {
@ -2116,13 +2116,13 @@ pub struct RangeStepInclusive<A> {
/// Return an iterator over the range [start, stop] by `step`. It handles overflow by stopping.
#[inline]
pub fn range_step_inclusive<A: CheckedAdd + Ord + Clone + Zero>(start: A, stop: A,
pub fn range_step_inclusive<A: CheckedAdd + PartialOrd + Clone + Zero>(start: A, stop: A,
step: A) -> RangeStepInclusive<A> {
let rev = step < Zero::zero();
RangeStepInclusive{state: start, stop: stop, step: step, rev: rev, done: false}
}
impl<A: CheckedAdd + Ord + Clone + Eq> Iterator<A> for RangeStepInclusive<A> {
impl<A: CheckedAdd + PartialOrd + Clone + PartialEq> Iterator<A> for RangeStepInclusive<A> {
#[inline]
fn next(&mut self) -> Option<A> {
if !self.done && ((self.rev && self.state >= self.stop) ||
@ -2175,13 +2175,13 @@ impl<A: Clone> RandomAccessIterator<A> for Repeat<A> {
/// Functions for lexicographical ordering of sequences.
///
/// Lexicographical ordering through `<`, `<=`, `>=`, `>` requires
/// that the elements implement both `Eq` and `Ord`.
/// that the elements implement both `PartialEq` and `PartialOrd`.
///
/// If two sequences are equal up until the point where one ends,
/// the shorter sequence compares less.
pub mod order {
use cmp;
use cmp::{TotalEq, TotalOrd, Ord, Eq};
use cmp::{TotalEq, TotalOrd, PartialOrd, PartialEq};
use option::{Some, None};
use super::Iterator;
@ -2211,8 +2211,8 @@ pub mod order {
}
}
/// Compare `a` and `b` for equality (Using partial equality, `Eq`)
pub fn eq<A: Eq, T: Iterator<A>, S: Iterator<A>>(mut a: T, mut b: S) -> bool {
/// Compare `a` and `b` for equality (Using partial equality, `PartialEq`)
pub fn eq<A: PartialEq, T: Iterator<A>, S: Iterator<A>>(mut a: T, mut b: S) -> bool {
loop {
match (a.next(), b.next()) {
(None, None) => return true,
@ -2222,8 +2222,8 @@ pub mod order {
}
}
/// Compare `a` and `b` for nonequality (Using partial equality, `Eq`)
pub fn ne<A: Eq, T: Iterator<A>, S: Iterator<A>>(mut a: T, mut b: S) -> bool {
/// Compare `a` and `b` for nonequality (Using partial equality, `PartialEq`)
pub fn ne<A: PartialEq, T: Iterator<A>, S: Iterator<A>>(mut a: T, mut b: S) -> bool {
loop {
match (a.next(), b.next()) {
(None, None) => return false,
@ -2233,8 +2233,8 @@ pub mod order {
}
}
/// Return `a` < `b` lexicographically (Using partial order, `Ord`)
pub fn lt<A: Ord, T: Iterator<A>, S: Iterator<A>>(mut a: T, mut b: S) -> bool {
/// Return `a` < `b` lexicographically (Using partial order, `PartialOrd`)
pub fn lt<A: PartialOrd, T: Iterator<A>, S: Iterator<A>>(mut a: T, mut b: S) -> bool {
loop {
match (a.next(), b.next()) {
(None, None) => return false,
@ -2245,8 +2245,8 @@ pub mod order {
}
}
/// Return `a` <= `b` lexicographically (Using partial order, `Ord`)
pub fn le<A: Ord, T: Iterator<A>, S: Iterator<A>>(mut a: T, mut b: S) -> bool {
/// Return `a` <= `b` lexicographically (Using partial order, `PartialOrd`)
pub fn le<A: PartialOrd, T: Iterator<A>, S: Iterator<A>>(mut a: T, mut b: S) -> bool {
loop {
match (a.next(), b.next()) {
(None, None) => return true,
@ -2257,8 +2257,8 @@ pub mod order {
}
}
/// Return `a` > `b` lexicographically (Using partial order, `Ord`)
pub fn gt<A: Ord, T: Iterator<A>, S: Iterator<A>>(mut a: T, mut b: S) -> bool {
/// Return `a` > `b` lexicographically (Using partial order, `PartialOrd`)
pub fn gt<A: PartialOrd, T: Iterator<A>, S: Iterator<A>>(mut a: T, mut b: S) -> bool {
loop {
match (a.next(), b.next()) {
(None, None) => return false,
@ -2269,8 +2269,8 @@ pub mod order {
}
}
/// Return `a` >= `b` lexicographically (Using partial order, `Ord`)
pub fn ge<A: Ord, T: Iterator<A>, S: Iterator<A>>(mut a: T, mut b: S) -> bool {
/// Return `a` >= `b` lexicographically (Using partial order, `PartialOrd`)
pub fn ge<A: PartialOrd, T: Iterator<A>, S: Iterator<A>>(mut a: T, mut b: S) -> bool {
loop {
match (a.next(), b.next()) {
(None, None) => return true,
@ -2849,7 +2849,7 @@ mod tests {
#[cfg(test)]
fn check_randacc_iter<A: Eq, T: Clone + RandomAccessIterator<A>>(a: T, len: uint)
fn check_randacc_iter<A: PartialEq, T: Clone + RandomAccessIterator<A>>(a: T, len: uint)
{
let mut b = a.clone();
assert_eq!(len, b.indexable());
@ -3009,13 +3009,13 @@ mod tests {
}
}
impl Eq for Foo {
impl PartialEq for Foo {
fn eq(&self, _: &Foo) -> bool {
true
}
}
impl Ord for Foo {
impl PartialOrd for Foo {
fn lt(&self, _: &Foo) -> bool {
false
}

View file

@ -133,7 +133,7 @@ pub mod marker {
/// (for example, `S<&'static int>` is a subtype of `S<&'a int>`
/// for some lifetime `'a`, but not the other way around).
#[lang="covariant_type"]
#[deriving(Eq,Clone)]
#[deriving(PartialEq,Clone)]
pub struct CovariantType<T>;
/// A marker type whose type parameter `T` is considered to be
@ -176,7 +176,7 @@ pub mod marker {
/// function requires arguments of type `T`, it must also accept
/// arguments of type `U`, hence such a conversion is safe.
#[lang="contravariant_type"]
#[deriving(Eq,Clone)]
#[deriving(PartialEq,Clone)]
pub struct ContravariantType<T>;
/// A marker type whose type parameter `T` is considered to be
@ -201,7 +201,7 @@ pub mod marker {
/// never written, but in fact `Cell` uses unsafe code to achieve
/// interior mutability.
#[lang="invariant_type"]
#[deriving(Eq,Clone)]
#[deriving(PartialEq,Clone)]
pub struct InvariantType<T>;
/// As `CovariantType`, but for lifetime parameters. Using
@ -221,7 +221,7 @@ pub mod marker {
/// For more information about variance, refer to this Wikipedia
/// article <http://en.wikipedia.org/wiki/Variance_%28computer_science%29>.
#[lang="covariant_lifetime"]
#[deriving(Eq,Clone)]
#[deriving(PartialEq,Clone)]
pub struct CovariantLifetime<'a>;
/// As `ContravariantType`, but for lifetime parameters. Using
@ -237,7 +237,7 @@ pub mod marker {
/// For more information about variance, refer to this Wikipedia
/// article <http://en.wikipedia.org/wiki/Variance_%28computer_science%29>.
#[lang="contravariant_lifetime"]
#[deriving(Eq,Clone)]
#[deriving(PartialEq,Clone)]
pub struct ContravariantLifetime<'a>;
/// As `InvariantType`, but for lifetime parameters. Using
@ -248,7 +248,7 @@ pub mod marker {
/// and this pointer is itself stored in an inherently mutable
/// location (such as a `Cell`).
#[lang="invariant_lifetime"]
#[deriving(Eq,Clone)]
#[deriving(PartialEq,Clone)]
pub struct InvariantLifetime<'a>;
/// A type which is considered "not sendable", meaning that it cannot
@ -256,26 +256,26 @@ pub mod marker {
/// typically embedded in other types, such as `Gc`, to ensure that
/// their instances remain thread-local.
#[lang="no_send_bound"]
#[deriving(Eq,Clone)]
#[deriving(PartialEq,Clone)]
pub struct NoSend;
/// A type which is considered "not POD", meaning that it is not
/// implicitly copyable. This is typically embedded in other types to
/// ensure that they are never copied, even if they lack a destructor.
#[lang="no_copy_bound"]
#[deriving(Eq,Clone)]
#[deriving(PartialEq,Clone)]
pub struct NoCopy;
/// A type which is considered "not shareable", meaning that
/// its contents are not threadsafe, hence they cannot be
/// shared between tasks.
#[lang="no_share_bound"]
#[deriving(Eq,Clone)]
#[deriving(PartialEq,Clone)]
pub struct NoShare;
/// A type which is considered managed by the GC. This is typically
/// embedded in other types.
#[lang="managed_bound"]
#[deriving(Eq,Clone)]
#[deriving(PartialEq,Clone)]
pub struct Managed;
}

View file

@ -17,7 +17,7 @@ use {int, i8, i16, i32, i64};
use {uint, u8, u16, u32, u64};
use {f32, f64};
use clone::Clone;
use cmp::{Eq, Ord};
use cmp::{PartialEq, PartialOrd};
use kinds::Copy;
use mem::size_of;
use ops::{Add, Sub, Mul, Div, Rem, Neg};
@ -25,7 +25,7 @@ use ops::{Not, BitAnd, BitOr, BitXor, Shl, Shr};
use option::{Option, Some, None};
/// The base trait for numeric types
pub trait Num: Eq + Zero + One
pub trait Num: PartialEq + Zero + One
+ Neg<Self>
+ Add<Self,Self>
+ Sub<Self,Self>
@ -495,7 +495,7 @@ pub trait Primitive: Copy
+ Clone
+ Num
+ NumCast
+ Ord
+ PartialOrd
+ Bounded {}
trait_impl!(Primitive for uint u8 u16 u32 u64 int i8 i16 i32 i64 f32 f64)
@ -1043,7 +1043,7 @@ pub trait Saturating {
fn saturating_sub(self, v: Self) -> Self;
}
impl<T: CheckedAdd + CheckedSub + Zero + Ord + Bounded> Saturating for T {
impl<T: CheckedAdd + CheckedSub + Zero + PartialOrd + Bounded> Saturating for T {
#[inline]
fn saturating_add(self, v: T) -> T {
match self.checked_add(&v) {
@ -1238,7 +1238,7 @@ pub fn test_num<T:Num + NumCast + ::std::fmt::Show>(ten: T, two: T) {
}
/// Used for representing the classification of floating point numbers
#[deriving(Eq, Show)]
#[deriving(PartialEq, Show)]
pub enum FPCategory {
/// "Not a Number", often obtained by dividing by zero
FPNaN,

View file

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

View file

@ -45,7 +45,8 @@ pub use mem::drop;
pub use char::Char;
pub use clone::Clone;
pub use cmp::{Eq, Ord, TotalEq, TotalOrd, Ordering, Less, Equal, Greater, Equiv};
pub use cmp::{PartialEq, PartialOrd, TotalEq, TotalOrd};
pub use cmp::{Ordering, Less, Equal, Greater, Equiv};
pub use container::{Container, Mutable, Map, MutableMap, Set, MutableSet};
pub use iter::{FromIterator, Extendable};
pub use iter::{Iterator, DoubleEndedIterator, RandomAccessIterator, CloneableIterator};

View file

@ -93,7 +93,7 @@ use intrinsics;
use iter::{range, Iterator};
use option::{Some, None, Option};
#[cfg(not(test))] use cmp::{Eq, TotalEq, Ord, Equiv};
#[cfg(not(test))] use cmp::{PartialEq, TotalEq, PartialOrd, Equiv};
/// Return the offset of the first null pointer in `buf`.
#[inline]
@ -386,7 +386,7 @@ impl<T> RawPtr<T> for *mut T {
// Equality for pointers
#[cfg(not(test))]
impl<T> Eq for *T {
impl<T> PartialEq for *T {
#[inline]
fn eq(&self, other: &*T) -> bool {
*self == *other
@ -399,7 +399,7 @@ impl<T> Eq for *T {
impl<T> TotalEq for *T {}
#[cfg(not(test))]
impl<T> Eq for *mut T {
impl<T> PartialEq for *mut T {
#[inline]
fn eq(&self, other: &*mut T) -> bool {
*self == *other
@ -430,9 +430,9 @@ impl<T> Equiv<*T> for *mut T {
#[cfg(not(test))]
mod externfnpointers {
use mem;
use cmp::Eq;
use cmp::PartialEq;
impl<_R> Eq for extern "C" fn() -> _R {
impl<_R> PartialEq for extern "C" fn() -> _R {
#[inline]
fn eq(&self, other: &extern "C" fn() -> _R) -> bool {
let self_: *() = unsafe { mem::transmute(*self) };
@ -442,7 +442,7 @@ mod externfnpointers {
}
macro_rules! fnptreq(
($($p:ident),*) => {
impl<_R,$($p),*> Eq for extern "C" fn($($p),*) -> _R {
impl<_R,$($p),*> PartialEq for extern "C" fn($($p),*) -> _R {
#[inline]
fn eq(&self, other: &extern "C" fn($($p),*) -> _R) -> bool {
let self_: *() = unsafe { mem::transmute(*self) };
@ -461,13 +461,13 @@ mod externfnpointers {
// Comparison for pointers
#[cfg(not(test))]
impl<T> Ord for *T {
impl<T> PartialOrd for *T {
#[inline]
fn lt(&self, other: &*T) -> bool { *self < *other }
}
#[cfg(not(test))]
impl<T> Ord for *mut T {
impl<T> PartialOrd for *mut T {
#[inline]
fn lt(&self, other: &*mut T) -> bool { *self < *other }
}

View file

@ -275,7 +275,7 @@
//! will not resume after failure, that failure is catastrophic.
use clone::Clone;
use cmp::Eq;
use cmp::PartialEq;
use std::fmt::Show;
use iter::{Iterator, FromIterator};
use option::{None, Option, Some};
@ -283,7 +283,7 @@ use option::{None, Option, Some};
/// `Result` is a type that represents either success (`Ok`) or failure (`Err`).
///
/// See the [`std::result`](index.html) module documentation for details.
#[deriving(Clone, Eq, Ord, TotalEq, TotalOrd, Show)]
#[deriving(Clone, PartialEq, PartialOrd, TotalEq, TotalOrd, Show)]
#[must_use]
pub enum Result<T, E> {
/// Contains the success value

View file

@ -15,7 +15,7 @@
use mem::transmute;
use clone::Clone;
use container::Container;
use cmp::{Eq, TotalOrd, Ordering, Less, Equal, Greater};
use cmp::{PartialEq, TotalOrd, Ordering, Less, Equal, Greater};
use cmp;
use default::Default;
use iter::*;
@ -249,11 +249,11 @@ impl<'a, T> RandomAccessIterator<&'a [T]> for Chunks<'a, T> {
pub mod traits {
use super::*;
use cmp::{Eq, Ord, TotalEq, TotalOrd, Ordering, Equiv};
use cmp::{PartialEq, PartialOrd, TotalEq, TotalOrd, Ordering, Equiv};
use iter::{order, Iterator};
use container::Container;
impl<'a,T:Eq> Eq for &'a [T] {
impl<'a,T:PartialEq> PartialEq for &'a [T] {
fn eq(&self, other: & &'a [T]) -> bool {
self.len() == other.len() &&
order::eq(self.iter(), other.iter())
@ -264,7 +264,7 @@ pub mod traits {
}
}
impl<T:Eq> Eq for ~[T] {
impl<T:PartialEq> PartialEq for ~[T] {
#[inline]
fn eq(&self, other: &~[T]) -> bool { self.as_slice() == *other }
#[inline]
@ -275,12 +275,12 @@ pub mod traits {
impl<T:TotalEq> TotalEq for ~[T] {}
impl<'a,T:Eq, V: Vector<T>> Equiv<V> for &'a [T] {
impl<'a,T:PartialEq, V: Vector<T>> Equiv<V> for &'a [T] {
#[inline]
fn equiv(&self, other: &V) -> bool { self.as_slice() == other.as_slice() }
}
impl<'a,T:Eq, V: Vector<T>> Equiv<V> for ~[T] {
impl<'a,T:PartialEq, V: Vector<T>> Equiv<V> for ~[T] {
#[inline]
fn equiv(&self, other: &V) -> bool { self.as_slice() == other.as_slice() }
}
@ -296,7 +296,7 @@ pub mod traits {
fn cmp(&self, other: &~[T]) -> Ordering { self.as_slice().cmp(&other.as_slice()) }
}
impl<'a, T: Ord> Ord for &'a [T] {
impl<'a, T: PartialOrd> PartialOrd for &'a [T] {
fn lt(&self, other: & &'a [T]) -> bool {
order::lt(self.iter(), other.iter())
}
@ -314,7 +314,7 @@ pub mod traits {
}
}
impl<T: Ord> Ord for ~[T] {
impl<T: PartialOrd> PartialOrd for ~[T] {
#[inline]
fn lt(&self, other: &~[T]) -> bool { self.as_slice() < other.as_slice() }
#[inline]
@ -692,8 +692,8 @@ impl<'a,T> ImmutableVector<'a, T> for &'a [T] {
}
}
/// Extension methods for vectors contain `Eq` elements.
pub trait ImmutableEqVector<T:Eq> {
/// Extension methods for vectors contain `PartialEq` elements.
pub trait ImmutableEqVector<T:PartialEq> {
/// Find the first index containing a matching value
fn position_elem(&self, t: &T) -> Option<uint>;
@ -710,7 +710,7 @@ pub trait ImmutableEqVector<T:Eq> {
fn ends_with(&self, needle: &[T]) -> bool;
}
impl<'a,T:Eq> ImmutableEqVector<T> for &'a [T] {
impl<'a,T:PartialEq> ImmutableEqVector<T> for &'a [T] {
#[inline]
fn position_elem(&self, x: &T) -> Option<uint> {
self.iter().position(|y| *x == *y)

View file

@ -16,7 +16,7 @@ use mem;
use char;
use clone::Clone;
use cmp;
use cmp::{Eq, TotalEq};
use cmp::{PartialEq, TotalEq};
use container::Container;
use default::Default;
use iter::{Filter, Map, Iterator};
@ -696,7 +696,7 @@ pub struct Utf16Items<'a> {
iter: slice::Items<'a, u16>
}
/// The possibilities for values decoded from a `u16` stream.
#[deriving(Eq, TotalEq, Clone, Show)]
#[deriving(PartialEq, TotalEq, Clone, Show)]
pub enum Utf16Item {
/// A valid codepoint.
ScalarValue(char),
@ -930,7 +930,7 @@ Section: Trait implementations
#[allow(missing_doc)]
pub mod traits {
use container::Container;
use cmp::{TotalOrd, Ordering, Less, Equal, Greater, Eq, Ord, Equiv, TotalEq};
use cmp::{TotalOrd, Ordering, Less, Equal, Greater, PartialEq, PartialOrd, Equiv, TotalEq};
use iter::Iterator;
use option::{Some, None};
use str::{Str, StrSlice, eq_slice};
@ -950,7 +950,7 @@ pub mod traits {
}
}
impl<'a> Eq for &'a str {
impl<'a> PartialEq for &'a str {
#[inline]
fn eq(&self, other: & &'a str) -> bool {
eq_slice((*self), (*other))
@ -961,7 +961,7 @@ pub mod traits {
impl<'a> TotalEq for &'a str {}
impl<'a> Ord for &'a str {
impl<'a> PartialOrd for &'a str {
#[inline]
fn lt(&self, other: & &'a str) -> bool { self.cmp(other) == Less }
}

View file

@ -27,9 +27,9 @@
//! traits, then a tuple itself also implements it.
//!
//! * `Clone`
//! * `Eq`
//! * `PartialEq`
//! * `TotalEq`
//! * `Ord`
//! * `PartialOrd`
//! * `TotalOrd`
//! * `Default`
//!
@ -109,7 +109,7 @@ macro_rules! tuple_impls {
}
#[cfg(not(test))]
impl<$($T:Eq),+> Eq for ($($T,)+) {
impl<$($T:PartialEq),+> PartialEq for ($($T,)+) {
#[inline]
fn eq(&self, other: &($($T,)+)) -> bool {
$(*self.$refN() == *other.$refN())&&+
@ -124,7 +124,7 @@ macro_rules! tuple_impls {
impl<$($T:TotalEq),+> TotalEq for ($($T,)+) {}
#[cfg(not(test))]
impl<$($T:Ord + Eq),+> Ord for ($($T,)+) {
impl<$($T:PartialOrd + PartialEq),+> PartialOrd for ($($T,)+) {
#[inline]
fn lt(&self, other: &($($T,)+)) -> bool {
lexical_ord!(lt, $(self.$refN(), other.$refN()),+)
@ -335,13 +335,13 @@ mod tests {
let nan = 0.0/0.0;
// Eq
// PartialEq
assert_eq!(small, small);
assert_eq!(big, big);
assert!(small != big);
assert!(big != small);
// Ord
// PartialOrd
assert!(small < big);
assert!(!(small < small));
assert!(!(big < small));

View file

@ -26,7 +26,7 @@ use std::str;
/// A piece is a portion of the format string which represents the next part
/// to emit. These are emitted as a stream by the `Parser` class.
#[deriving(Eq)]
#[deriving(PartialEq)]
pub enum Piece<'a> {
/// A literal string which should directly be emitted
String(&'a str),
@ -39,7 +39,7 @@ pub enum Piece<'a> {
}
/// Representation of an argument specification.
#[deriving(Eq)]
#[deriving(PartialEq)]
pub struct Argument<'a> {
/// Where to find this argument
pub position: Position<'a>,
@ -50,7 +50,7 @@ pub struct Argument<'a> {
}
/// Specification for the formatting of an argument in the format string.
#[deriving(Eq)]
#[deriving(PartialEq)]
pub struct FormatSpec<'a> {
/// Optionally specified character to fill alignment with
pub fill: Option<char>,
@ -69,7 +69,7 @@ pub struct FormatSpec<'a> {
}
/// Enum describing where an argument for a format can be located.
#[deriving(Eq)]
#[deriving(PartialEq)]
pub enum Position<'a> {
/// The argument will be in the next position. This is the default.
ArgumentNext,
@ -80,7 +80,7 @@ pub enum Position<'a> {
}
/// Enum of alignments which are supported.
#[deriving(Eq)]
#[deriving(PartialEq)]
pub enum Alignment {
/// The value will be aligned to the left.
AlignLeft,
@ -92,7 +92,7 @@ pub enum Alignment {
/// Various flags which can be applied to format strings. The meaning of these
/// flags is defined by the formatters themselves.
#[deriving(Eq)]
#[deriving(PartialEq)]
pub enum Flag {
/// A `+` will be used to denote positive numbers.
FlagSignPlus,
@ -108,7 +108,7 @@ pub enum Flag {
/// A count is used for the precision and width parameters of an integer, and
/// can reference either an argument or a literal integer.
#[deriving(Eq)]
#[deriving(PartialEq)]
pub enum Count<'a> {
/// The count is specified explicitly.
CountIs(uint),
@ -124,7 +124,7 @@ pub enum Count<'a> {
/// Enum describing all of the possible methods which the formatting language
/// currently supports.
#[deriving(Eq)]
#[deriving(PartialEq)]
pub enum Method<'a> {
/// A plural method selects on an integer over a list of either integer or
/// keyword-defined clauses. The meaning of the keywords is defined by the
@ -146,7 +146,7 @@ pub enum Method<'a> {
}
/// A selector for what pluralization a plural method should take
#[deriving(Eq, TotalEq, Hash)]
#[deriving(PartialEq, TotalEq, Hash)]
pub enum PluralSelector {
/// One of the plural keywords should be used
Keyword(PluralKeyword),
@ -155,7 +155,7 @@ pub enum PluralSelector {
}
/// Structure representing one "arm" of the `plural` function.
#[deriving(Eq)]
#[deriving(PartialEq)]
pub struct PluralArm<'a> {
/// A selector can either be specified by a keyword or with an integer
/// literal.
@ -168,7 +168,7 @@ pub struct PluralArm<'a> {
/// is specially placed in the `Plural` variant of `Method`.
///
/// http://www.icu-project.org/apiref/icu4c/classicu_1_1PluralRules.html
#[deriving(Eq, TotalEq, Hash, Show)]
#[deriving(PartialEq, TotalEq, Hash, Show)]
#[allow(missing_doc)]
pub enum PluralKeyword {
/// The plural form for zero objects.
@ -184,7 +184,7 @@ pub enum PluralKeyword {
}
/// Structure representing one "arm" of the `select` function.
#[deriving(Eq)]
#[deriving(PartialEq)]
pub struct SelectArm<'a> {
/// String selector which guards this arm
pub selector: &'a str,

View file

@ -92,13 +92,13 @@
#[cfg(test)] extern crate debug;
#[cfg(test)] #[phase(syntax, link)] extern crate log;
use std::cmp::Eq;
use std::cmp::PartialEq;
use std::result::{Err, Ok};
use std::result;
use std::string::String;
/// Name of an option. Either a string or a single char.
#[deriving(Clone, Eq)]
#[deriving(Clone, PartialEq)]
pub enum Name {
/// A string representing the long name of an option.
/// For example: "help"
@ -109,7 +109,7 @@ pub enum Name {
}
/// Describes whether an option has an argument.
#[deriving(Clone, Eq)]
#[deriving(Clone, PartialEq)]
pub enum HasArg {
/// The option requires an argument.
Yes,
@ -120,7 +120,7 @@ pub enum HasArg {
}
/// Describes how often an option may occur.
#[deriving(Clone, Eq)]
#[deriving(Clone, PartialEq)]
pub enum Occur {
/// The option occurs once.
Req,
@ -131,7 +131,7 @@ pub enum Occur {
}
/// A description of a possible option.
#[deriving(Clone, Eq)]
#[deriving(Clone, PartialEq)]
pub struct Opt {
/// Name of the option
pub name: Name,
@ -145,7 +145,7 @@ pub struct Opt {
/// One group of options, e.g., both -h and --help, along with
/// their shared description and properties.
#[deriving(Clone, Eq)]
#[deriving(Clone, PartialEq)]
pub struct OptGroup {
/// Short Name of the `OptGroup`
pub short_name: String,
@ -162,7 +162,7 @@ pub struct OptGroup {
}
/// Describes wether an option is given at all or has a value.
#[deriving(Clone, Eq)]
#[deriving(Clone, PartialEq)]
enum Optval {
Val(String),
Given,
@ -170,7 +170,7 @@ enum Optval {
/// The result of checking command line arguments. Contains a vector
/// of matches and a vector of free strings.
#[deriving(Clone, Eq)]
#[deriving(Clone, PartialEq)]
pub struct Matches {
/// Options that matched
opts: Vec<Opt> ,
@ -183,7 +183,7 @@ pub struct Matches {
/// The type returned when the command line does not conform to the
/// expected format. Call the `to_err_msg` method to retrieve the
/// error as a string.
#[deriving(Clone, Eq, Show)]
#[deriving(Clone, PartialEq, Show)]
pub enum Fail_ {
/// The option requires an argument but none was passed.
ArgumentMissing(String),
@ -198,7 +198,7 @@ pub enum Fail_ {
}
/// The type of failure that occurred.
#[deriving(Eq)]
#[deriving(PartialEq)]
#[allow(missing_doc)]
pub enum FailType {
ArgumentMissing_,

View file

@ -198,12 +198,12 @@ fn list_dir_sorted(path: &Path) -> Option<Vec<Path>> {
/**
* A compiled Unix shell style pattern.
*/
#[deriving(Clone, Eq, TotalEq, Ord, TotalOrd, Hash, Default)]
#[deriving(Clone, PartialEq, TotalEq, PartialOrd, TotalOrd, Hash, Default)]
pub struct Pattern {
tokens: Vec<PatternToken>,
}
#[deriving(Clone, Eq, TotalEq, Ord, TotalOrd, Hash)]
#[deriving(Clone, PartialEq, TotalEq, PartialOrd, TotalOrd, Hash)]
enum PatternToken {
Char(char),
AnyChar,
@ -212,13 +212,13 @@ enum PatternToken {
AnyExcept(Vec<CharSpecifier> )
}
#[deriving(Clone, Eq, TotalEq, Ord, TotalOrd, Hash)]
#[deriving(Clone, PartialEq, TotalEq, PartialOrd, TotalOrd, Hash)]
enum CharSpecifier {
SingleChar(char),
CharRange(char, char)
}
#[deriving(Eq)]
#[deriving(PartialEq)]
enum MatchResult {
Match,
SubPatternDoesntMatch,
@ -596,7 +596,7 @@ fn chars_eq(a: char, b: char, case_sensitive: bool) -> bool {
/**
* Configuration options to modify the behaviour of `Pattern::matches_with(..)`
*/
#[deriving(Clone, Eq, TotalEq, Ord, TotalOrd, Hash, Default)]
#[deriving(Clone, PartialEq, TotalEq, PartialOrd, TotalOrd, Hash, Default)]
pub struct MatchOptions {
/**

View file

@ -105,7 +105,7 @@ pub struct Scheduler {
/// An indication of how hard to work on a given operation, the difference
/// mainly being whether memory is synchronized or not
#[deriving(Eq)]
#[deriving(PartialEq)]
enum EffortLevel {
DontTryTooHard,
GiveItYourBest

View file

@ -172,7 +172,7 @@ struct DefaultLogger {
}
/// Wraps the log level with fmt implementations.
#[deriving(Eq, Ord)]
#[deriving(PartialEq, PartialOrd)]
pub struct LogLevel(pub u32);
impl fmt::Show for LogLevel {

View file

@ -83,7 +83,7 @@ pub struct BigUint {
data: Vec<BigDigit>
}
impl Eq for BigUint {
impl PartialEq for BigUint {
#[inline]
fn eq(&self, other: &BigUint) -> bool {
match self.cmp(other) { Equal => true, _ => false }
@ -91,7 +91,7 @@ impl Eq for BigUint {
}
impl TotalEq for BigUint {}
impl Ord for BigUint {
impl PartialOrd for BigUint {
#[inline]
fn lt(&self, other: &BigUint) -> bool {
match self.cmp(other) { Less => true, _ => false}
@ -786,7 +786,7 @@ fn get_radix_base(radix: uint) -> (DoubleBigDigit, uint) {
}
/// A Sign is a `BigInt`'s composing element.
#[deriving(Eq, Ord, TotalEq, TotalOrd, Clone, Show)]
#[deriving(PartialEq, PartialOrd, TotalEq, TotalOrd, Clone, Show)]
pub enum Sign { Minus, Zero, Plus }
impl Neg<Sign> for Sign {
@ -808,7 +808,7 @@ pub struct BigInt {
data: BigUint
}
impl Eq for BigInt {
impl PartialEq for BigInt {
#[inline]
fn eq(&self, other: &BigInt) -> bool {
match self.cmp(other) { Equal => true, _ => false }
@ -817,7 +817,7 @@ impl Eq for BigInt {
impl TotalEq for BigInt {}
impl Ord for BigInt {
impl PartialOrd for BigInt {
#[inline]
fn lt(&self, other: &BigInt) -> bool {
match self.cmp(other) { Less => true, _ => false}

View file

@ -18,7 +18,7 @@ use std::num::{Zero,One,ToStrRadix};
// probably doesn't map to C's _Complex correctly.
/// A complex number in Cartesian form.
#[deriving(Eq,Clone)]
#[deriving(PartialEq,Clone)]
pub struct Complex<T> {
/// Real portion of the complex number
pub re: T,
@ -164,7 +164,7 @@ impl<T: Clone + Num> One for Complex<T> {
}
/* string conversions */
impl<T: fmt::Show + Num + Ord> fmt::Show for Complex<T> {
impl<T: fmt::Show + Num + PartialOrd> fmt::Show for Complex<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
if self.im < Zero::zero() {
write!(f, "{}-{}i", self.re, -self.im)
@ -174,7 +174,7 @@ impl<T: fmt::Show + Num + Ord> fmt::Show for Complex<T> {
}
}
impl<T: ToStrRadix + Num + Ord> ToStrRadix for Complex<T> {
impl<T: ToStrRadix + Num + PartialOrd> ToStrRadix for Complex<T> {
fn to_str_radix(&self, radix: uint) -> String {
if self.im < Zero::zero() {
format!("{}-{}i",

View file

@ -60,7 +60,7 @@ pub mod bigint;
pub mod rational;
pub mod complex;
pub trait Integer: Num + Ord
pub trait Integer: Num + PartialOrd
+ Div<Self, Self>
+ Rem<Self, Self> {
/// Simultaneous truncated integer division and modulus

View file

@ -34,7 +34,7 @@ pub type Rational64 = Ratio<i64>;
/// Alias for arbitrary precision rationals.
pub type BigRational = Ratio<BigInt>;
impl<T: Clone + Integer + Ord>
impl<T: Clone + Integer + PartialOrd>
Ratio<T> {
/// Create a ratio representing the integer `t`.
#[inline]
@ -192,14 +192,14 @@ macro_rules! cmp_impl {
}
};
}
cmp_impl!(impl Eq, eq, ne)
cmp_impl!(impl Ord, lt, gt, le, ge)
cmp_impl!(impl PartialEq, eq, ne)
cmp_impl!(impl PartialOrd, lt, gt, le, ge)
cmp_impl!(impl TotalEq, )
cmp_impl!(impl TotalOrd, cmp -> cmp::Ordering)
/* Arithmetic */
// a/b * c/d = (a*c)/(b*d)
impl<T: Clone + Integer + Ord>
impl<T: Clone + Integer + PartialOrd>
Mul<Ratio<T>,Ratio<T>> for Ratio<T> {
#[inline]
fn mul(&self, rhs: &Ratio<T>) -> Ratio<T> {
@ -208,7 +208,7 @@ impl<T: Clone + Integer + Ord>
}
// (a/b) / (c/d) = (a*d)/(b*c)
impl<T: Clone + Integer + Ord>
impl<T: Clone + Integer + PartialOrd>
Div<Ratio<T>,Ratio<T>> for Ratio<T> {
#[inline]
fn div(&self, rhs: &Ratio<T>) -> Ratio<T> {
@ -219,7 +219,7 @@ impl<T: Clone + Integer + Ord>
// Abstracts the a/b `op` c/d = (a*d `op` b*d) / (b*d) pattern
macro_rules! arith_impl {
(impl $imp:ident, $method:ident) => {
impl<T: Clone + Integer + Ord>
impl<T: Clone + Integer + PartialOrd>
$imp<Ratio<T>,Ratio<T>> for Ratio<T> {
#[inline]
fn $method(&self, rhs: &Ratio<T>) -> Ratio<T> {
@ -239,7 +239,7 @@ arith_impl!(impl Sub, sub)
// a/b % c/d = (a*d % b*c)/(b*d)
arith_impl!(impl Rem, rem)
impl<T: Clone + Integer + Ord>
impl<T: Clone + Integer + PartialOrd>
Neg<Ratio<T>> for Ratio<T> {
#[inline]
fn neg(&self) -> Ratio<T> {
@ -248,7 +248,7 @@ impl<T: Clone + Integer + Ord>
}
/* Constants */
impl<T: Clone + Integer + Ord>
impl<T: Clone + Integer + PartialOrd>
Zero for Ratio<T> {
#[inline]
fn zero() -> Ratio<T> {
@ -261,7 +261,7 @@ impl<T: Clone + Integer + Ord>
}
}
impl<T: Clone + Integer + Ord>
impl<T: Clone + Integer + PartialOrd>
One for Ratio<T> {
#[inline]
fn one() -> Ratio<T> {
@ -269,7 +269,7 @@ impl<T: Clone + Integer + Ord>
}
}
impl<T: Clone + Integer + Ord>
impl<T: Clone + Integer + PartialOrd>
Num for Ratio<T> {}
/* String conversions */
@ -288,7 +288,7 @@ impl<T: ToStrRadix> ToStrRadix for Ratio<T> {
}
}
impl<T: FromStr + Clone + Integer + Ord>
impl<T: FromStr + Clone + Integer + PartialOrd>
FromStr for Ratio<T> {
/// Parses `numer/denom`.
fn from_str(s: &str) -> Option<Ratio<T>> {
@ -305,7 +305,7 @@ impl<T: FromStr + Clone + Integer + Ord>
})
}
}
impl<T: FromStrRadix + Clone + Integer + Ord>
impl<T: FromStrRadix + Clone + Integer + PartialOrd>
FromStrRadix for Ratio<T> {
/// Parses `numer/denom` where the numbers are in base `radix`.
fn from_str_radix(s: &str, radix: uint) -> Option<Ratio<T>> {

View file

@ -260,7 +260,7 @@ mod tests {
use {Rng, Rand};
use super::{RandSample, WeightedChoice, Weighted, Sample, IndependentSample};
#[deriving(Eq, Show)]
#[deriving(PartialEq, Show)]
struct ConstRand(uint);
impl Rand for ConstRand {
fn rand<R: Rng>(_: &mut R) -> ConstRand {

View file

@ -54,7 +54,7 @@ pub struct Range<X> {
accept_zone: X
}
impl<X: SampleRange + Ord> Range<X> {
impl<X: SampleRange + PartialOrd> Range<X> {
/// Create a new `Range` instance that samples uniformly from
/// `[low, high)`. Fails if `low >= high`.
pub fn new(low: X, high: X) -> Range<X> {

View file

@ -182,7 +182,7 @@ pub trait Rng {
/// let m: f64 = rng.gen_range(-40.0, 1.3e5);
/// println!("{}", m);
/// ```
fn gen_range<T: Ord + SampleRange>(&mut self, low: T, high: T) -> T {
fn gen_range<T: PartialOrd + SampleRange>(&mut self, low: T, high: T) -> T {
assert!(low < high, "Rng.gen_range called with low >= high");
Range::new(low, high).ind_sample(self)
}

View file

@ -67,7 +67,7 @@ pub enum Ast {
Rep(Box<Ast>, Repeater, Greed),
}
#[deriving(Show, Eq, Clone)]
#[deriving(Show, PartialEq, Clone)]
pub enum Repeater {
ZeroOne,
ZeroMore,

View file

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

View file

@ -53,7 +53,7 @@ use std::iter::range_step;
use syntax::ast;
use syntax::visit;
#[deriving(Clone, Eq)]
#[deriving(Clone, PartialEq)]
pub struct Svh {
hash: String,
}

View file

@ -46,7 +46,7 @@ pub struct Config {
pub uint_type: UintTy,
}
#[deriving(Clone, Eq)]
#[deriving(Clone, PartialEq)]
pub enum OptLevel {
No, // -O0
Less, // -O1
@ -54,7 +54,7 @@ pub enum OptLevel {
Aggressive // -O3
}
#[deriving(Clone, Eq)]
#[deriving(Clone, PartialEq)]
pub enum DebugInfoLevel {
NoDebugInfo,
LimitedDebugInfo,
@ -125,14 +125,14 @@ pub fn basic_options() -> Options {
// users can have their own entry
// functions that don't start a
// scheduler
#[deriving(Eq)]
#[deriving(PartialEq)]
pub enum EntryFnType {
EntryMain,
EntryStart,
EntryNone,
}
#[deriving(Eq, Ord, Clone, TotalOrd, TotalEq, Hash)]
#[deriving(PartialEq, PartialOrd, Clone, TotalOrd, TotalEq, Hash)]
pub enum CrateType {
CrateTypeExecutable,
CrateTypeDylib,

View file

@ -29,7 +29,7 @@ pub static False: Bool = 0 as Bool;
// Consts for the LLVM CallConv type, pre-cast to uint.
#[deriving(Eq)]
#[deriving(PartialEq)]
pub enum CallConv {
CCallConv = 0,
FastCallConv = 8,
@ -156,7 +156,7 @@ pub enum RealPredicate {
// The LLVM TypeKind type - must stay in sync with the def of
// LLVMTypeKind in llvm/include/llvm-c/Core.h
#[deriving(Eq)]
#[deriving(PartialEq)]
#[repr(C)]
pub enum TypeKind {
Void = 0,
@ -226,7 +226,7 @@ pub enum AsmDialect {
AD_Intel = 1
}
#[deriving(Eq)]
#[deriving(PartialEq)]
#[repr(C)]
pub enum CodeGenOptLevel {
CodeGenLevelNone = 0,

View file

@ -114,7 +114,7 @@ pub static tag_items_data_item_reexport_def_id: uint = 0x39;
pub static tag_items_data_item_reexport_name: uint = 0x3a;
// used to encode crate_ctxt side tables
#[deriving(Eq)]
#[deriving(PartialEq)]
#[repr(uint)]
pub enum astencode_tag { // Reserves 0x40 -- 0x5f
tag_ast = 0x40,

View file

@ -45,13 +45,13 @@ pub struct crate_metadata {
pub span: Span,
}
#[deriving(Show, Eq, Clone)]
#[deriving(Show, PartialEq, Clone)]
pub enum LinkagePreference {
RequireDynamic,
RequireStatic,
}
#[deriving(Eq, FromPrimitive)]
#[deriving(PartialEq, FromPrimitive)]
pub enum NativeLibaryKind {
NativeStatic, // native static library (.a archive)
NativeFramework, // OSX-specific
@ -60,7 +60,7 @@ pub enum NativeLibaryKind {
// Where a crate came from on the local filesystem. One of these two options
// must be non-None.
#[deriving(Eq, Clone)]
#[deriving(PartialEq, Clone)]
pub struct CrateSource {
pub dylib: Option<Path>,
pub rlib: Option<Path>,

View file

@ -103,7 +103,7 @@ fn lookup_item<'a>(item_id: ast::NodeId, data: &'a [u8]) -> ebml::Doc<'a> {
find_item(item_id, items)
}
#[deriving(Eq)]
#[deriving(PartialEq)]
enum Family {
ImmStatic, // c
MutStatic, // b

View file

@ -82,7 +82,7 @@ pub fn check_loans(bccx: &BorrowckCtxt,
clcx.visit_block(body, ());
}
#[deriving(Eq)]
#[deriving(PartialEq)]
enum MoveError {
MoveOk,
MoveWhileBorrowed(/*loan*/Rc<LoanPath>, /*loan*/Span)

View file

@ -166,7 +166,7 @@ pub struct BorrowStats {
pub type BckResult<T> = Result<T, BckError>;
#[deriving(Eq)]
#[deriving(PartialEq)]
pub enum PartialTotal {
Partial, // Loan affects some portion
Total // Loan affects entire path
@ -188,13 +188,13 @@ pub struct Loan {
cause: euv::LoanCause,
}
#[deriving(Eq, TotalEq, Hash)]
#[deriving(PartialEq, TotalEq, Hash)]
pub enum LoanPath {
LpVar(ast::NodeId), // `x` in doc.rs
LpExtend(Rc<LoanPath>, mc::MutabilityCategory, LoanPathElem)
}
#[deriving(Eq, TotalEq, Hash)]
#[deriving(PartialEq, TotalEq, Hash)]
pub enum LoanPathElem {
LpDeref(mc::PointerKind), // `*LV` in doc.rs
LpInterior(mc::InteriorKind) // `LV.f` in doc.rs
@ -267,7 +267,7 @@ pub struct Restriction {
set: RestrictionSet
}
#[deriving(Eq)]
#[deriving(PartialEq)]
pub struct RestrictionSet {
bits: u32
}
@ -305,7 +305,7 @@ impl Repr for RestrictionSet {
// Errors
// Errors that can occur
#[deriving(Eq)]
#[deriving(PartialEq)]
pub enum bckerr_code {
err_mutbl,
err_out_of_scope(ty::Region, ty::Region), // superscope, subscope
@ -315,7 +315,7 @@ pub enum bckerr_code {
// Combination of an error code and the categorization of the expression
// that caused it
#[deriving(Eq)]
#[deriving(PartialEq)]
pub struct BckError {
span: Span,
cause: euv::LoanCause,

View file

@ -65,7 +65,7 @@ pub struct FlowedMoveData<'a> {
}
/// Index into `MoveData.paths`, used like a pointer
#[deriving(Eq)]
#[deriving(PartialEq)]
pub struct MovePathIndex(uint);
impl MovePathIndex {
@ -84,7 +84,7 @@ static InvalidMovePathIndex: MovePathIndex =
MovePathIndex(uint::MAX);
/// Index into `MoveData.moves`, used like a pointer
#[deriving(Eq)]
#[deriving(PartialEq)]
pub struct MoveIndex(uint);
impl MoveIndex {

View file

@ -15,7 +15,7 @@ use syntax::codemap::Span;
use syntax::visit::Visitor;
use syntax::visit;
#[deriving(Clone, Eq)]
#[deriving(Clone, PartialEq)]
enum Context {
Normal, Loop, Closure
}

View file

@ -215,7 +215,7 @@ enum useful {
not_useful,
}
#[deriving(Clone, Eq)]
#[deriving(Clone, PartialEq)]
enum ctor {
single,
variant(DefId),

View file

@ -288,7 +288,7 @@ pub fn process_crate(krate: &ast::Crate,
// FIXME (#33): this doesn't handle big integer/float literals correctly
// (nor does the rest of our literal handling).
#[deriving(Clone, Eq)]
#[deriving(Clone, PartialEq)]
pub enum const_val {
const_float(f64),
const_int(i64),
@ -514,7 +514,7 @@ pub fn lit_to_const(lit: &Lit) -> const_val {
}
}
fn compare_vals<T: Ord>(a: T, b: T) -> Option<int> {
fn compare_vals<T: PartialOrd>(a: T, b: T) -> Option<int> {
Some(if a == b { 0 } else if a < b { -1 } else { 1 })
}
pub fn compare_const_vals(a: &const_val, b: &const_val) -> Option<int> {

View file

@ -20,7 +20,7 @@ use syntax::codemap::Span;
use syntax::visit;
use syntax::visit::Visitor;
#[deriving(Eq)]
#[deriving(PartialEq)]
enum UnsafeContext {
SafeContext,
UnsafeFn,

View file

@ -68,7 +68,7 @@ pub trait Delegate {
mode: MutateMode);
}
#[deriving(Eq)]
#[deriving(PartialEq)]
pub enum LoanCause {
ClosureCapture(Span),
AddrOf,
@ -78,13 +78,13 @@ pub enum LoanCause {
ClosureInvocation
}
#[deriving(Eq,Show)]
#[deriving(PartialEq,Show)]
pub enum ConsumeMode {
Copy, // reference to x where x has a type that copies
Move, // reference to x where x has a type that moves
}
#[deriving(Eq,Show)]
#[deriving(PartialEq,Show)]
pub enum MutateMode {
JustWrite, // x = y
WriteAndRead, // x += y

View file

@ -55,11 +55,11 @@ pub struct Edge<E> {
pub data: E,
}
#[deriving(Eq)]
#[deriving(PartialEq)]
pub struct NodeIndex(pub uint);
pub static InvalidNodeIndex: NodeIndex = NodeIndex(uint::MAX);
#[deriving(Eq)]
#[deriving(PartialEq)]
pub struct EdgeIndex(pub uint);
pub static InvalidEdgeIndex: EdgeIndex = EdgeIndex(uint::MAX);
@ -356,7 +356,7 @@ mod test {
});
}
fn test_adjacent_edges<N:Eq,E:Eq>(graph: &Graph<N,E>,
fn test_adjacent_edges<N:PartialEq,E:PartialEq>(graph: &Graph<N,E>,
start_index: NodeIndex,
start_data: N,
expected_incoming: &[(E,N)],

View file

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

View file

@ -72,7 +72,7 @@ use syntax::parse::token;
use syntax::visit::Visitor;
use syntax::{ast, ast_util, visit};
#[deriving(Clone, Show, Eq, Ord, TotalEq, TotalOrd, Hash)]
#[deriving(Clone, Show, PartialEq, PartialOrd, TotalEq, TotalOrd, Hash)]
pub enum Lint {
CTypes,
UnusedImports,
@ -135,12 +135,12 @@ pub fn level_to_str(lv: Level) -> &'static str {
}
}
#[deriving(Clone, Eq, Ord, TotalEq, TotalOrd)]
#[deriving(Clone, PartialEq, PartialOrd, TotalEq, TotalOrd)]
pub enum Level {
Allow, Warn, Deny, Forbid
}
#[deriving(Clone, Eq, Ord, TotalEq, TotalOrd)]
#[deriving(Clone, PartialEq, PartialOrd, TotalEq, TotalOrd)]
pub struct LintSpec {
pub default: Level,
pub lint: Lint,
@ -150,7 +150,7 @@ pub struct LintSpec {
pub type LintDict = HashMap<&'static str, LintSpec>;
// this is public for the lints that run in trans
#[deriving(Eq)]
#[deriving(PartialEq)]
pub enum LintSource {
Node(Span),
Default,
@ -836,7 +836,7 @@ fn check_type_limits(cx: &Context, e: &ast::Expr) {
_ => ()
};
fn is_valid<T:cmp::Ord>(binop: ast::BinOp, v: T,
fn is_valid<T:cmp::PartialOrd>(binop: ast::BinOp, v: T,
min: T, max: T) -> bool {
match binop {
ast::BiLt => v > min && v <= max,

View file

@ -123,9 +123,9 @@ use syntax::print::pprust::{expr_to_str, block_to_str};
use syntax::{visit, ast_util};
use syntax::visit::{Visitor, FnKind};
#[deriving(Eq)]
#[deriving(PartialEq)]
struct Variable(uint);
#[deriving(Eq)]
#[deriving(PartialEq)]
struct LiveNode(uint);
impl Variable {
@ -142,7 +142,7 @@ impl Clone for LiveNode {
}
}
#[deriving(Eq)]
#[deriving(PartialEq)]
enum LiveNodeKind {
FreeVarNode(Span),
ExprNode(Span),

View file

@ -76,7 +76,7 @@ use syntax::parse::token;
use std::cell::RefCell;
use std::rc::Rc;
#[deriving(Clone, Eq)]
#[deriving(Clone, PartialEq)]
pub enum categorization {
cat_rvalue(ty::Region), // temporary val, argument is its scope
cat_static_item,
@ -92,14 +92,14 @@ pub enum categorization {
// (*1) downcast is only required if the enum has more than one variant
}
#[deriving(Clone, Eq)]
#[deriving(Clone, PartialEq)]
pub struct CopiedUpvar {
pub upvar_id: ast::NodeId,
pub onceness: ast::Onceness,
}
// different kinds of pointers:
#[deriving(Clone, Eq, TotalEq, Hash)]
#[deriving(Clone, PartialEq, TotalEq, Hash)]
pub enum PointerKind {
OwnedPtr,
GcPtr,
@ -109,26 +109,26 @@ pub enum PointerKind {
// We use the term "interior" to mean "something reachable from the
// base without a pointer dereference", e.g. a field
#[deriving(Clone, Eq, TotalEq, Hash)]
#[deriving(Clone, PartialEq, TotalEq, Hash)]
pub enum InteriorKind {
InteriorField(FieldName),
InteriorElement(ElementKind),
}
#[deriving(Clone, Eq, TotalEq, Hash)]
#[deriving(Clone, PartialEq, TotalEq, Hash)]
pub enum FieldName {
NamedField(ast::Name),
PositionalField(uint)
}
#[deriving(Clone, Eq, TotalEq, Hash)]
#[deriving(Clone, PartialEq, TotalEq, Hash)]
pub enum ElementKind {
VecElement,
StrElement,
OtherElement,
}
#[deriving(Clone, Eq, TotalEq, Hash, Show)]
#[deriving(Clone, PartialEq, TotalEq, Hash, Show)]
pub enum MutabilityCategory {
McImmutable, // Immutable.
McDeclared, // Directly declared as mutable.
@ -149,7 +149,7 @@ pub enum MutabilityCategory {
// dereference, but its type is the type *before* the dereference
// (`@T`). So use `cmt.type` to find the type of the value in a consistent
// fashion. For more details, see the method `cat_pattern`
#[deriving(Clone, Eq)]
#[deriving(Clone, PartialEq)]
pub struct cmt_ {
pub id: ast::NodeId, // id of expr/pat producing this value
pub span: Span, // span of same expr/pat

View file

@ -87,7 +87,7 @@ pub enum PrivateDep {
}
// How an import is used.
#[deriving(Eq)]
#[deriving(PartialEq)]
pub enum ImportUse {
Unused, // The import is not used.
Used, // The import is used.
@ -102,20 +102,20 @@ impl LastPrivate {
}
}
#[deriving(Eq)]
#[deriving(PartialEq)]
enum PatternBindingMode {
RefutableMode,
LocalIrrefutableMode,
ArgumentIrrefutableMode,
}
#[deriving(Eq, TotalEq, Hash)]
#[deriving(PartialEq, TotalEq, Hash)]
enum Namespace {
TypeNS,
ValueNS
}
#[deriving(Eq)]
#[deriving(PartialEq)]
enum NamespaceError {
NoError,
ModuleError,
@ -288,7 +288,7 @@ enum ModulePrefixResult {
PrefixFound(Rc<Module>, uint)
}
#[deriving(Eq)]
#[deriving(PartialEq)]
enum NameSearchType {
/// We're doing a name search in order to resolve a `use` directive.
ImportSearch,
@ -306,7 +306,7 @@ enum BareIdentifierPatternResolution {
// Specifies how duplicates should be handled when adding a child item if
// another item exists with the same name in some namespace.
#[deriving(Eq)]
#[deriving(PartialEq)]
enum DuplicateCheckingMode {
ForbidDuplicateModules,
ForbidDuplicateTypes,
@ -435,7 +435,7 @@ enum ParentLink {
}
/// The type of module this is.
#[deriving(Eq)]
#[deriving(PartialEq)]
enum ModuleKind {
NormalModuleKind,
ExternModuleKind,
@ -4900,7 +4900,7 @@ impl<'a> Resolver<'a> {
}
fn find_fallback_in_self_type(&mut self, name: Name) -> FallbackSuggestion {
#[deriving(Eq)]
#[deriving(PartialEq)]
enum FallbackChecks {
Everything,
OnlyTraitAndStatics

View file

@ -240,7 +240,7 @@ enum Lit {
ConstLit(ast::DefId), // the def ID of the constant
}
#[deriving(Eq)]
#[deriving(PartialEq)]
pub enum VecLenOpt {
vec_len_eq,
vec_len_ge(/* length of prefix */uint)
@ -1215,7 +1215,7 @@ fn pick_col(m: &[Match]) -> uint {
return best_col;
}
#[deriving(Eq)]
#[deriving(PartialEq)]
pub enum branch_kind { no_branch, single, switch, compare, compare_vec_len, }
// Compiles a comparison between two things.

View file

@ -18,7 +18,7 @@ use middle::trans::cabi_mips;
use middle::trans::type_::Type;
use syntax::abi::{X86, X86_64, Arm, Mips};
#[deriving(Clone, Eq)]
#[deriving(Clone, PartialEq)]
pub enum ArgKind {
/// Pass the argument directly using the normal converted
/// LLVM type or by coercing to another specified type

View file

@ -22,7 +22,7 @@ use middle::trans::type_::Type;
use std::cmp;
#[deriving(Clone, Eq)]
#[deriving(Clone, PartialEq)]
enum RegClass {
NoClass,
Int,

View file

@ -55,7 +55,7 @@ pub enum CleanupScopeKind<'a> {
LoopScopeKind(ast::NodeId, [&'a Block<'a>, ..EXIT_MAX])
}
#[deriving(Eq)]
#[deriving(PartialEq)]
pub enum EarlyExitLabel {
UnwindExit,
ReturnExit,

View file

@ -722,7 +722,7 @@ pub fn expr_ty_adjusted(bcx: &Block, ex: &ast::Expr) -> ty::t {
}
// Key used to lookup values supplied for type parameters in an expr.
#[deriving(Eq)]
#[deriving(PartialEq)]
pub enum ExprOrMethodCall {
// Type parameters for a path like `None::<int>`
ExprId(ast::NodeId),

View file

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

View file

@ -2403,7 +2403,7 @@ fn type_metadata(cx: &CrateContext,
type_metadata
}
#[deriving(Eq)]
#[deriving(PartialEq)]
enum DebugLocation {
KnownLocation { scope: DIScope, line: uint, col: uint },
UnknownLocation

View file

@ -79,7 +79,7 @@ use syntax::print::pprust::{expr_to_str};
// These are passed around by the code generating functions to track the
// destination of a computation's value.
#[deriving(Eq)]
#[deriving(PartialEq)]
pub enum Dest {
SaveIn(ValueRef),
Ignore,
@ -1497,7 +1497,7 @@ fn float_cast(bcx: &Block,
} else { llsrc };
}
#[deriving(Eq)]
#[deriving(PartialEq)]
pub enum cast_kind {
cast_pointer,
cast_integral,

View file

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

View file

@ -23,7 +23,7 @@ use std::mem;
use libc::{c_uint};
#[deriving(Clone, Eq, Show)]
#[deriving(Clone, PartialEq, Show)]
pub struct Type {
rf: TypeRef
}

View file

@ -65,7 +65,7 @@ pub static INITIAL_DISCRIMINANT_VALUE: Disr = 0;
// Data types
#[deriving(Eq, TotalEq, Hash)]
#[deriving(PartialEq, TotalEq, Hash)]
pub struct field {
pub ident: ast::Ident,
pub mt: mt
@ -121,13 +121,13 @@ impl Method {
}
}
#[deriving(Clone, Eq, TotalEq, Hash)]
#[deriving(Clone, PartialEq, TotalEq, Hash)]
pub struct mt {
pub ty: t,
pub mutbl: ast::Mutability,
}
#[deriving(Clone, Eq, TotalEq, Hash, Encodable, Decodable, Show)]
#[deriving(Clone, PartialEq, TotalEq, Hash, Encodable, Decodable, Show)]
pub enum TraitStore {
/// Box<Trait>
UniqTraitStore,
@ -145,7 +145,7 @@ pub struct field_ty {
// Contains information needed to resolve types and (in the future) look up
// the types of AST nodes.
#[deriving(Eq, TotalEq, Hash)]
#[deriving(PartialEq, TotalEq, Hash)]
pub struct creader_cache_key {
pub cnum: CrateNum,
pub pos: uint,
@ -158,10 +158,10 @@ pub struct intern_key {
sty: *sty,
}
// NB: Do not replace this with #[deriving(Eq)]. The automatically-derived
// NB: Do not replace this with #[deriving(PartialEq)]. The automatically-derived
// implementation will not recurse through sty and you will get stack
// exhaustion.
impl cmp::Eq for intern_key {
impl cmp::PartialEq for intern_key {
fn eq(&self, other: &intern_key) -> bool {
unsafe {
*self.sty == *other.sty
@ -185,14 +185,14 @@ pub enum ast_ty_to_ty_cache_entry {
atttce_resolved(t) /* resolved to a type, irrespective of region */
}
#[deriving(Clone, Eq, Decodable, Encodable)]
#[deriving(Clone, PartialEq, Decodable, Encodable)]
pub struct ItemVariances {
pub self_param: Option<Variance>,
pub type_params: OwnedSlice<Variance>,
pub region_params: OwnedSlice<Variance>
}
#[deriving(Clone, Eq, Decodable, Encodable, Show)]
#[deriving(Clone, PartialEq, Decodable, Encodable, Show)]
pub enum Variance {
Covariant, // T<A> <: T<B> iff A <: B -- e.g., function return type
Invariant, // T<A> <: T<B> iff B == A -- e.g., type of mutable cell
@ -216,7 +216,7 @@ pub struct AutoDerefRef {
pub autoref: Option<AutoRef>
}
#[deriving(Clone, Decodable, Encodable, Eq, Show)]
#[deriving(Clone, Decodable, Encodable, PartialEq, Show)]
pub enum AutoRef {
/// Convert from T to &T
AutoPtr(Region, ast::Mutability),
@ -387,7 +387,7 @@ pub struct t_box_ {
enum t_opaque {}
#[allow(raw_pointer_deriving)]
#[deriving(Clone, Eq, TotalEq, Hash)]
#[deriving(Clone, PartialEq, TotalEq, Hash)]
pub struct t { inner: *t_opaque }
impl fmt::Show for t {
@ -415,14 +415,14 @@ pub fn type_needs_infer(t: t) -> bool {
}
pub fn type_id(t: t) -> uint { get(t).id }
#[deriving(Clone, Eq, TotalEq, Hash)]
#[deriving(Clone, PartialEq, TotalEq, Hash)]
pub struct BareFnTy {
pub fn_style: ast::FnStyle,
pub abi: abi::Abi,
pub sig: FnSig,
}
#[deriving(Clone, Eq, TotalEq, Hash)]
#[deriving(Clone, PartialEq, TotalEq, Hash)]
pub struct ClosureTy {
pub fn_style: ast::FnStyle,
pub onceness: ast::Onceness,
@ -443,7 +443,7 @@ pub struct ClosureTy {
* - `output` is the return type.
* - `variadic` indicates whether this is a varidic function. (only true for foreign fns)
*/
#[deriving(Clone, Eq, TotalEq, Hash)]
#[deriving(Clone, PartialEq, TotalEq, Hash)]
pub struct FnSig {
pub binder_id: ast::NodeId,
pub inputs: Vec<t>,
@ -451,14 +451,14 @@ pub struct FnSig {
pub variadic: bool
}
#[deriving(Clone, Eq, TotalEq, Hash)]
#[deriving(Clone, PartialEq, TotalEq, Hash)]
pub struct param_ty {
pub idx: uint,
pub def_id: DefId
}
/// Representation of regions:
#[deriving(Clone, Eq, TotalEq, Hash, Encodable, Decodable, Show)]
#[deriving(Clone, PartialEq, TotalEq, Hash, Encodable, Decodable, Show)]
pub enum Region {
// Region bound in a type or fn declaration which will be
// substituted 'early' -- that is, at the same time when type
@ -499,13 +499,13 @@ pub enum Region {
* the original var id (that is, the root variable that is referenced
* by the upvar) and the id of the closure expression.
*/
#[deriving(Clone, Eq, TotalEq, Hash)]
#[deriving(Clone, PartialEq, TotalEq, Hash)]
pub struct UpvarId {
pub var_id: ast::NodeId,
pub closure_expr_id: ast::NodeId,
}
#[deriving(Clone, Eq, TotalEq, Hash, Show)]
#[deriving(Clone, PartialEq, TotalEq, Hash, Show)]
pub enum BorrowKind {
/// Data must be immutable and is aliasable.
ImmBorrow,
@ -600,7 +600,7 @@ pub enum BorrowKind {
* the closure, so sometimes it is necessary for them to be larger
* than the closure lifetime itself.
*/
#[deriving(Eq, Clone)]
#[deriving(PartialEq, Clone)]
pub struct UpvarBorrow {
pub kind: BorrowKind,
pub region: ty::Region,
@ -618,13 +618,13 @@ impl Region {
}
}
#[deriving(Clone, Eq, Ord, TotalEq, TotalOrd, Hash, Encodable, Decodable, Show)]
#[deriving(Clone, PartialEq, PartialOrd, TotalEq, TotalOrd, Hash, Encodable, Decodable, Show)]
pub struct FreeRegion {
pub scope_id: NodeId,
pub bound_region: BoundRegion
}
#[deriving(Clone, Eq, Ord, TotalEq, TotalOrd, Hash, Encodable, Decodable, Show)]
#[deriving(Clone, PartialEq, PartialOrd, TotalEq, TotalOrd, Hash, Encodable, Decodable, Show)]
pub enum BoundRegion {
/// An anonymous region parameter for a given fn (&T)
BrAnon(uint),
@ -643,7 +643,7 @@ pub enum BoundRegion {
* Represents the values to use when substituting lifetime parameters.
* If the value is `ErasedRegions`, then this subst is occurring during
* trans, and all region parameters will be replaced with `ty::ReStatic`. */
#[deriving(Clone, Eq, TotalEq, Hash)]
#[deriving(Clone, PartialEq, TotalEq, Hash)]
pub enum RegionSubsts {
ErasedRegions,
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` type is rather funny in that it can only appear on traits and is
* always substituted away to the implementing type for a trait. */
#[deriving(Clone, Eq, TotalEq, Hash)]
#[deriving(Clone, PartialEq, TotalEq, Hash)]
pub struct substs {
pub self_ty: Option<ty::t>,
pub tps: Vec<t>,
@ -722,7 +722,7 @@ mod primitives {
// NB: If you change this, you'll probably want to change the corresponding
// AST structure in libsyntax/ast.rs as well.
#[deriving(Clone, Eq, TotalEq, Hash)]
#[deriving(Clone, PartialEq, TotalEq, Hash)]
pub enum sty {
ty_nil,
ty_bot,
@ -754,7 +754,7 @@ pub enum sty {
// on non-useful type error messages)
}
#[deriving(Clone, Eq, TotalEq, Hash)]
#[deriving(Clone, PartialEq, TotalEq, Hash)]
pub struct TyTrait {
pub def_id: DefId,
pub substs: substs,
@ -762,13 +762,13 @@ pub struct TyTrait {
pub bounds: BuiltinBounds
}
#[deriving(Eq, TotalEq, Hash)]
#[deriving(PartialEq, TotalEq, Hash)]
pub struct TraitRef {
pub def_id: DefId,
pub substs: substs
}
#[deriving(Clone, Eq)]
#[deriving(Clone, PartialEq)]
pub enum IntVarValue {
IntType(ast::IntTy),
UintType(ast::UintTy),
@ -822,7 +822,7 @@ pub enum type_err {
terr_variadic_mismatch(expected_found<bool>)
}
#[deriving(Eq, TotalEq, Hash)]
#[deriving(PartialEq, TotalEq, Hash)]
pub struct ParamBounds {
pub builtin_bounds: BuiltinBounds,
pub trait_bounds: Vec<Rc<TraitRef>>
@ -830,7 +830,7 @@ pub struct ParamBounds {
pub type BuiltinBounds = EnumSet<BuiltinBound>;
#[deriving(Clone, Encodable, Eq, TotalEq, Decodable, Hash, Show)]
#[deriving(Clone, Encodable, PartialEq, TotalEq, Decodable, Hash, Show)]
#[repr(uint)]
pub enum BuiltinBound {
BoundStatic,
@ -862,21 +862,21 @@ impl CLike for BuiltinBound {
}
}
#[deriving(Clone, Eq, TotalEq, Hash)]
#[deriving(Clone, PartialEq, TotalEq, Hash)]
pub struct TyVid(pub uint);
#[deriving(Clone, Eq, TotalEq, Hash)]
#[deriving(Clone, PartialEq, TotalEq, Hash)]
pub struct IntVid(pub uint);
#[deriving(Clone, Eq, TotalEq, Hash)]
#[deriving(Clone, PartialEq, TotalEq, Hash)]
pub struct FloatVid(pub uint);
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
pub struct RegionVid {
pub id: uint
}
#[deriving(Clone, Eq, TotalEq, Hash)]
#[deriving(Clone, PartialEq, TotalEq, Hash)]
pub enum InferTy {
TyVar(TyVid),
IntVar(IntVid),
@ -889,7 +889,7 @@ pub enum InferRegion {
ReSkolemized(uint, BoundRegion)
}
impl cmp::Eq for InferRegion {
impl cmp::PartialEq for InferRegion {
fn eq(&self, other: &InferRegion) -> bool {
match ((*self), *other) {
(ReVar(rva), ReVar(rvb)) => {
@ -2402,7 +2402,7 @@ pub fn is_instantiable(cx: &ctxt, r_ty: t) -> bool {
/// distinguish between types that are recursive with themselves and types that
/// contain a different recursive type. These cases can therefore be treated
/// differently when reporting errors.
#[deriving(Eq)]
#[deriving(PartialEq)]
pub enum Representability {
Representable,
SelfRecursive,

View file

@ -758,7 +758,7 @@ pub fn check_pointer_pat(pcx: &pat_ctxt,
}
}
#[deriving(Eq)]
#[deriving(PartialEq)]
pub enum PointerKind {
Send,
Borrowed,

View file

@ -106,19 +106,19 @@ use syntax::codemap::Span;
use syntax::parse::token;
use syntax::owned_slice::OwnedSlice;
#[deriving(Eq)]
#[deriving(PartialEq)]
pub enum CheckTraitsFlag {
CheckTraitsOnly,
CheckTraitsAndInherentMethods,
}
#[deriving(Eq)]
#[deriving(PartialEq)]
pub enum AutoderefReceiverFlag {
AutoderefReceiver,
DontAutoderefReceiver,
}
#[deriving(Eq)]
#[deriving(PartialEq)]
pub enum StaticMethodsFlag {
ReportStaticMethods,
IgnoreStaticMethods,

View file

@ -213,7 +213,7 @@ impl FnStyleState {
/// Whether `check_binop` is part of an assignment or not.
/// Used to know wether we allow user overloads and to print
/// better messages on error.
#[deriving(Eq)]
#[deriving(PartialEq)]
enum IsBinopAssignment{
SimpleBinop,
BinopAssignment,

View file

@ -72,19 +72,19 @@ impl LatticeValue for ty::t {
pub trait CombineFieldsLatticeMethods {
fn var_sub_var<T:Clone + InferStr + LatticeValue,
V:Clone + Eq + ToStr + Vid + UnifyVid<Bounds<T>>>(&self,
V:Clone + PartialEq + ToStr + Vid + UnifyVid<Bounds<T>>>(&self,
a_id: V,
b_id: V)
-> ures;
/// make variable a subtype of T
fn var_sub_t<T:Clone + InferStr + LatticeValue,
V:Clone + Eq + ToStr + Vid + UnifyVid<Bounds<T>>>(
V:Clone + PartialEq + ToStr + Vid + UnifyVid<Bounds<T>>>(
&self,
a_id: V,
b: T)
-> ures;
fn t_sub_var<T:Clone + InferStr + LatticeValue,
V:Clone + Eq + ToStr + Vid + UnifyVid<Bounds<T>>>(
V:Clone + PartialEq + ToStr + Vid + UnifyVid<Bounds<T>>>(
&self,
a: T,
b_id: V)
@ -96,7 +96,7 @@ pub trait CombineFieldsLatticeMethods {
lattice_op: LatticeOp<T>)
-> cres<Bound<T>>;
fn set_var_to_merged_bounds<T:Clone + InferStr + LatticeValue,
V:Clone+Eq+ToStr+Vid+UnifyVid<Bounds<T>>>(
V:Clone+PartialEq+ToStr+Vid+UnifyVid<Bounds<T>>>(
&self,
v_id: V,
a: &Bounds<T>,
@ -112,7 +112,7 @@ pub trait CombineFieldsLatticeMethods {
impl<'f> CombineFieldsLatticeMethods for CombineFields<'f> {
fn var_sub_var<T:Clone + InferStr + LatticeValue,
V:Clone + Eq + ToStr + Vid + UnifyVid<Bounds<T>>>(
V:Clone + PartialEq + ToStr + Vid + UnifyVid<Bounds<T>>>(
&self,
a_id: V,
b_id: V)
@ -165,7 +165,7 @@ impl<'f> CombineFieldsLatticeMethods for CombineFields<'f> {
/// make variable a subtype of T
fn var_sub_t<T:Clone + InferStr + LatticeValue,
V:Clone + Eq + ToStr + Vid + UnifyVid<Bounds<T>>>(
V:Clone + PartialEq + ToStr + Vid + UnifyVid<Bounds<T>>>(
&self,
a_id: V,
b: T)
@ -189,7 +189,7 @@ impl<'f> CombineFieldsLatticeMethods for CombineFields<'f> {
}
fn t_sub_var<T:Clone + InferStr + LatticeValue,
V:Clone + Eq + ToStr + Vid + UnifyVid<Bounds<T>>>(
V:Clone + PartialEq + ToStr + Vid + UnifyVid<Bounds<T>>>(
&self,
a: T,
b_id: V)
@ -238,7 +238,7 @@ impl<'f> CombineFieldsLatticeMethods for CombineFields<'f> {
}
fn set_var_to_merged_bounds<T:Clone + InferStr + LatticeValue,
V:Clone+Eq+ToStr+Vid+UnifyVid<Bounds<T>>>(
V:Clone+PartialEq+ToStr+Vid+UnifyVid<Bounds<T>>>(
&self,
v_id: V,
a: &Bounds<T>,
@ -432,7 +432,7 @@ pub enum LatticeVarResult<V,T> {
* return. */
pub fn lattice_vars<L:LatticeDir + Combine,
T:Clone + InferStr + LatticeValue,
V:Clone + Eq + ToStr + Vid + UnifyVid<Bounds<T>>>(
V:Clone + PartialEq + ToStr + Vid + UnifyVid<Bounds<T>>>(
this: &L, // defines whether we want LUB or GLB
a_vid: V, // first variable
b_vid: V, // second variable
@ -478,7 +478,7 @@ pub fn lattice_vars<L:LatticeDir + Combine,
pub fn lattice_var_and_t<L:LatticeDir + Combine,
T:Clone + InferStr + LatticeValue,
V:Clone + Eq + ToStr + Vid + UnifyVid<Bounds<T>>>(
V:Clone + PartialEq + ToStr + Vid + UnifyVid<Bounds<T>>>(
this: &L,
a_id: V,
b: &T,

View file

@ -456,7 +456,7 @@ trait CresCompare<T> {
fn compare(&self, t: T, f: || -> ty::type_err) -> cres<T>;
}
impl<T:Clone + Eq> CresCompare<T> for cres<T> {
impl<T:Clone + PartialEq> CresCompare<T> for cres<T> {
fn compare(&self, t: T, f: || -> ty::type_err) -> cres<T> {
(*self).clone().and_then(|s| {
if s == t {

View file

@ -31,7 +31,7 @@ use syntax::ast;
mod doc;
#[deriving(Eq, TotalEq, Hash)]
#[deriving(PartialEq, TotalEq, Hash)]
pub enum Constraint {
ConstrainVarSubVar(RegionVid, RegionVid),
ConstrainRegSubVar(Region, RegionVid),
@ -39,7 +39,7 @@ pub enum Constraint {
ConstrainRegSubReg(Region, Region),
}
#[deriving(Eq, TotalEq, Hash)]
#[deriving(PartialEq, TotalEq, Hash)]
pub struct TwoRegions {
a: Region,
b: Region,
@ -759,7 +759,7 @@ impl<'a> RegionVarBindings<'a> {
// ______________________________________________________________________
#[deriving(Eq, Show)]
#[deriving(PartialEq, Show)]
enum Classification { Expanding, Contracting }
pub enum VarValue { NoValue, Value(Region), ErrorValue }

View file

@ -52,7 +52,7 @@ pub trait UnifyVid<T> {
pub trait UnifyInferCtxtMethods {
fn get<T:Clone,
V:Clone + Eq + Vid + UnifyVid<T>>(
V:Clone + PartialEq + Vid + UnifyVid<T>>(
&self,
vid: V)
-> Node<V, T>;
@ -71,7 +71,7 @@ pub trait UnifyInferCtxtMethods {
impl<'a> UnifyInferCtxtMethods for InferCtxt<'a> {
fn get<T:Clone,
V:Clone + Eq + Vid + UnifyVid<T>>(
V:Clone + PartialEq + Vid + UnifyVid<T>>(
&self,
vid: V)
-> Node<V, T> {
@ -86,7 +86,7 @@ impl<'a> UnifyInferCtxtMethods for InferCtxt<'a> {
let vb = UnifyVid::appropriate_vals_and_bindings(self);
return helper(tcx, &mut *vb.borrow_mut(), vid);
fn helper<T:Clone, V:Clone+Eq+Vid>(
fn helper<T:Clone, V:Clone+PartialEq+Vid>(
tcx: &ty::ctxt,
vb: &mut ValsAndBindings<V,T>,
vid: V) -> Node<V, T>
@ -191,15 +191,15 @@ pub fn mk_err<T:SimplyUnifiable>(a_is_expected: bool,
}
pub trait InferCtxtMethods {
fn simple_vars<T:Clone + Eq + InferStr + SimplyUnifiable,
V:Clone + Eq + Vid + ToStr + UnifyVid<Option<T>>>(
fn simple_vars<T:Clone + PartialEq + InferStr + SimplyUnifiable,
V:Clone + PartialEq + Vid + ToStr + UnifyVid<Option<T>>>(
&self,
a_is_expected: bool,
a_id: V,
b_id: V)
-> ures;
fn simple_var_t<T:Clone + Eq + InferStr + SimplyUnifiable,
V:Clone + Eq + Vid + ToStr + UnifyVid<Option<T>>>(
fn simple_var_t<T:Clone + PartialEq + InferStr + SimplyUnifiable,
V:Clone + PartialEq + Vid + ToStr + UnifyVid<Option<T>>>(
&self,
a_is_expected: bool,
a_id: V,
@ -208,8 +208,8 @@ pub trait InferCtxtMethods {
}
impl<'a> InferCtxtMethods for InferCtxt<'a> {
fn simple_vars<T:Clone + Eq + InferStr + SimplyUnifiable,
V:Clone + Eq + Vid + ToStr + UnifyVid<Option<T>>>(
fn simple_vars<T:Clone + PartialEq + InferStr + SimplyUnifiable,
V:Clone + PartialEq + Vid + ToStr + UnifyVid<Option<T>>>(
&self,
a_is_expected: bool,
a_id: V,
@ -248,8 +248,8 @@ impl<'a> InferCtxtMethods for InferCtxt<'a> {
return uok();
}
fn simple_var_t<T:Clone + Eq + InferStr + SimplyUnifiable,
V:Clone + Eq + Vid + ToStr + UnifyVid<Option<T>>>(
fn simple_var_t<T:Clone + PartialEq + InferStr + SimplyUnifiable,
V:Clone + PartialEq + Vid + ToStr + UnifyVid<Option<T>>>(
&self,
a_is_expected: bool,
a_id: V,

View file

@ -84,7 +84,7 @@ pub mod collect;
pub mod coherence;
pub mod variance;
#[deriving(Clone, Encodable, Decodable, Eq, Ord)]
#[deriving(Clone, Encodable, Decodable, PartialEq, PartialOrd)]
pub enum param_index {
param_numbered(uint),
param_self
@ -147,7 +147,7 @@ pub struct MethodCallee {
pub substs: ty::substs
}
#[deriving(Clone, Eq, TotalEq, Hash, Show)]
#[deriving(Clone, PartialEq, TotalEq, Hash, Show)]
pub struct MethodCall {
pub expr_id: ast::NodeId,
pub autoderef: u32

View file

@ -490,7 +490,7 @@ impl Clean<Option<Vec<TyParamBound>>> for ty::substs {
}
}
#[deriving(Clone, Encodable, Decodable, Eq)]
#[deriving(Clone, Encodable, Decodable, PartialEq)]
pub struct Lifetime(String);
impl Lifetime {
@ -631,7 +631,7 @@ impl Clean<Item> for ast::TypeMethod {
}
}
#[deriving(Clone, Encodable, Decodable, Eq)]
#[deriving(Clone, Encodable, Decodable, PartialEq)]
pub enum SelfTy {
SelfStatic,
SelfValue,
@ -1458,7 +1458,7 @@ impl Clean<Item> for doctree::Static {
}
}
#[deriving(Show, Clone, Encodable, Decodable, Eq)]
#[deriving(Show, Clone, Encodable, Decodable, PartialEq)]
pub enum Mutability {
Mutable,
Immutable,

View file

@ -19,7 +19,7 @@ use clean;
/// discriminants. JavaScript then is used to decode them into the original value.
/// Consequently, every change to this type should be synchronized to
/// the `itemTypes` mapping table in `static/main.js`.
#[deriving(Eq, Clone)]
#[deriving(PartialEq, Clone)]
pub enum ItemType {
Module = 0,
Struct = 1,

View file

@ -14,7 +14,7 @@ use std::fmt;
use std::string::String;
/// A (recursive) table of contents
#[deriving(Eq)]
#[deriving(PartialEq)]
pub struct Toc {
/// The levels are strictly decreasing, i.e.
///
@ -36,7 +36,7 @@ impl Toc {
}
}
#[deriving(Eq)]
#[deriving(PartialEq)]
pub struct TocEntry {
level: u32,
sec_number: String,
@ -46,7 +46,7 @@ pub struct TocEntry {
}
/// Progressive construction of a table of contents.
#[deriving(Eq)]
#[deriving(PartialEq)]
pub struct TocBuilder {
top_level: Toc,
/// The current heirachy of parent headings, the levels are

View file

@ -34,14 +34,14 @@ pub struct Guard<'a> {
pub can_timeout: bool,
}
#[deriving(Eq)]
#[deriving(PartialEq)]
enum TimeoutState {
NoTimeout,
TimeoutPending(ClientState),
TimedOut,
}
#[deriving(Eq)]
#[deriving(PartialEq)]
enum ClientState {
NoWaiter,
AccessPending,

View file

@ -254,7 +254,7 @@ pub type uv_shutdown_cb = extern "C" fn(req: *uv_shutdown_t, status: c_int);
#[cfg(windows)] pub type uv_gid_t = libc::c_uchar;
#[repr(C)]
#[deriving(Eq)]
#[deriving(PartialEq)]
pub enum uv_handle_type {
UV_UNKNOWN_HANDLE,
UV_ASYNC,
@ -279,7 +279,7 @@ pub enum uv_handle_type {
#[repr(C)]
#[cfg(unix)]
#[deriving(Eq)]
#[deriving(PartialEq)]
pub enum uv_req_type {
UV_UNKNOWN_REQ,
UV_REQ,
@ -297,7 +297,7 @@ pub enum uv_req_type {
// See UV_REQ_TYPE_PRIVATE at libuv/include/uv-win.h
#[repr(C)]
#[cfg(windows)]
#[deriving(Eq)]
#[deriving(PartialEq)]
pub enum uv_req_type {
UV_UNKNOWN_REQ,
UV_REQ,
@ -320,7 +320,7 @@ pub enum uv_req_type {
}
#[repr(C)]
#[deriving(Eq)]
#[deriving(PartialEq)]
pub enum uv_membership {
UV_LEAVE_GROUP,
UV_JOIN_GROUP

View file

@ -46,14 +46,14 @@ use std::string::String;
/// An identifier in the pre-release or build metadata. If the identifier can
/// be parsed as a decimal value, it will be represented with `Numeric`.
#[deriving(Clone, Eq)]
#[deriving(Clone, PartialEq)]
#[allow(missing_doc)]
pub enum Identifier {
Numeric(uint),
AlphaNumeric(String)
}
impl cmp::Ord for Identifier {
impl cmp::PartialOrd for Identifier {
#[inline]
fn lt(&self, other: &Identifier) -> bool {
match (self, other) {
@ -115,7 +115,7 @@ impl fmt::Show for Version {
}
}
impl cmp::Eq for Version {
impl cmp::PartialEq for Version {
#[inline]
fn eq(&self, other: &Version) -> bool {
// We should ignore build metadata here, otherwise versions v1 and v2
@ -128,7 +128,7 @@ impl cmp::Eq for Version {
}
}
impl cmp::Ord for Version {
impl cmp::PartialOrd for Version {
#[inline]
fn lt(&self, other: &Version) -> bool {

View file

@ -76,8 +76,8 @@ impl<E, D:Decoder<E>,T:Decodable<D, E>> Decodable<D, E> for RingBuf<T> {
impl<
E,
S: Encoder<E>,
K: Encodable<S, E> + Eq + TotalOrd,
V: Encodable<S, E> + Eq
K: Encodable<S, E> + PartialEq + TotalOrd,
V: Encodable<S, E> + PartialEq
> Encodable<S, E> for TreeMap<K, V> {
fn encode(&self, e: &mut S) -> Result<(), E> {
e.emit_map(self.len(), |e| {
@ -95,8 +95,8 @@ impl<
impl<
E,
D: Decoder<E>,
K: Decodable<D, E> + Eq + TotalOrd,
V: Decodable<D, E> + Eq
K: Decodable<D, E> + PartialEq + TotalOrd,
V: Decodable<D, E> + PartialEq
> Decodable<D, E> for TreeMap<K, V> {
fn decode(d: &mut D) -> Result<TreeMap<K, V>, E> {
d.read_map(|d, len| {
@ -114,7 +114,7 @@ impl<
impl<
E,
S: Encoder<E>,
T: Encodable<S, E> + Eq + TotalOrd
T: Encodable<S, E> + PartialEq + TotalOrd
> Encodable<S, E> for TreeSet<T> {
fn encode(&self, s: &mut S) -> Result<(), E> {
s.emit_seq(self.len(), |s| {
@ -131,7 +131,7 @@ impl<
impl<
E,
D: Decoder<E>,
T: Decodable<D, E> + Eq + TotalOrd
T: Decodable<D, E> + PartialEq + TotalOrd
> Decodable<D, E> for TreeSet<T> {
fn decode(d: &mut D) -> Result<TreeSet<T>, E> {
d.read_seq(|d, len| {

View file

@ -249,7 +249,7 @@ use Encodable;
use collections::{HashMap, TreeMap};
/// Represents a json value
#[deriving(Clone, Eq)]
#[deriving(Clone, PartialEq)]
pub enum Json {
Number(f64),
String(String),
@ -263,7 +263,7 @@ pub type List = Vec<Json>;
pub type Object = TreeMap<String, Json>;
/// The errors that can arise while parsing a JSON stream.
#[deriving(Clone, Eq)]
#[deriving(Clone, PartialEq)]
pub enum ErrorCode {
InvalidSyntax,
InvalidNumber,
@ -283,7 +283,7 @@ pub enum ErrorCode {
NotUtf8,
}
#[deriving(Clone, Eq, Show)]
#[deriving(Clone, PartialEq, Show)]
pub enum ParserError {
/// msg, line, col
SyntaxError(ErrorCode, uint, uint),
@ -293,7 +293,7 @@ pub enum ParserError {
// Builder and Parser have the same errors.
pub type BuilderError = ParserError;
#[deriving(Clone, Eq, Show)]
#[deriving(Clone, PartialEq, Show)]
pub enum DecoderError {
ParseError(ParserError),
ExpectedError(String, String),
@ -975,7 +975,7 @@ impl Json {
}
/// The output of the streaming parser.
#[deriving(Eq, Clone, Show)]
#[deriving(PartialEq, Clone, Show)]
pub enum JsonEvent {
ObjectStart,
ObjectEnd,
@ -988,7 +988,7 @@ pub enum JsonEvent {
Error(ParserError),
}
#[deriving(Eq, Show)]
#[deriving(PartialEq, Show)]
enum ParserState {
// Parse a value in a list, true means first element.
ParseList(bool),
@ -1017,7 +1017,7 @@ pub struct Stack {
/// StackElements compose a Stack.
/// For example, Key("foo"), Key("bar"), Index(3) and Key("x") are the
/// StackElements compositing the stack that represents foo.bar[3].x
#[deriving(Eq, Clone, Show)]
#[deriving(PartialEq, Clone, Show)]
pub enum StackElement<'l> {
Index(u32),
Key(&'l str),
@ -1025,7 +1025,7 @@ pub enum StackElement<'l> {
// Internally, Key elements are stored as indices in a buffer to avoid
// allocating a string for every member of an object.
#[deriving(Eq, Clone, Show)]
#[deriving(PartialEq, Clone, Show)]
enum InternalStackElement {
InternalIndex(u32),
InternalKey(u16, u16), // start, size
@ -2082,7 +2082,7 @@ impl ::Decoder<DecoderError> for Decoder {
}
/// Test if two json values are less than one another
impl Ord for Json {
impl PartialOrd for Json {
fn lt(&self, other: &Json) -> bool {
match *self {
Number(f0) => {
@ -2288,20 +2288,20 @@ mod tests {
use std::io;
use collections::TreeMap;
#[deriving(Eq, Encodable, Decodable, Show)]
#[deriving(PartialEq, Encodable, Decodable, Show)]
enum Animal {
Dog,
Frog(String, int)
}
#[deriving(Eq, Encodable, Decodable, Show)]
#[deriving(PartialEq, Encodable, Decodable, Show)]
struct Inner {
a: (),
b: uint,
c: Vec<String>,
}
#[deriving(Eq, Encodable, Decodable, Show)]
#[deriving(PartialEq, Encodable, Decodable, Show)]
struct Outer {
inner: Vec<Inner>,
}

View file

@ -23,7 +23,7 @@ use to_str::{IntoStr};
use vec::Vec;
/// Datatype to hold one ascii character. It wraps a `u8`, with the highest bit always zero.
#[deriving(Clone, Eq, Ord, TotalOrd, TotalEq, Hash)]
#[deriving(Clone, PartialEq, PartialOrd, TotalOrd, TotalEq, Hash)]
pub struct Ascii { chr: u8 }
impl Ascii {

View file

@ -78,7 +78,7 @@
//!
//! # Derived traits
//!
//! The `Eq` and `Clone` traits are automatically derived for the `struct` using
//! The `PartialEq` and `Clone` traits are automatically derived for the `struct` using
//! the `deriving` attribute. Additional traits can be derived by providing an
//! explicit `deriving` attribute on `flags`.
//!
@ -112,7 +112,7 @@ macro_rules! bitflags(
($(#[$attr:meta])* flags $BitFlags:ident: $T:ty {
$($(#[$Flag_attr:meta])* static $Flag:ident = $value:expr),+
}) => (
#[deriving(Eq, TotalEq, Clone)]
#[deriving(PartialEq, TotalEq, Clone)]
$(#[$attr])*
pub struct $BitFlags {
bits: $T,

View file

@ -66,7 +66,7 @@ fn main() {
*/
use clone::Clone;
use cmp::Eq;
use cmp::PartialEq;
use container::Container;
use iter::{Iterator, range};
use kinds::marker;
@ -109,7 +109,7 @@ impl Clone for CString {
}
}
impl Eq for CString {
impl PartialEq for CString {
fn eq(&self, other: &CString) -> bool {
if self.buf as uint == other.buf as uint {
true

View file

@ -360,7 +360,7 @@ pub struct SyncSender<T> {
/// This enumeration is the list of the possible reasons that try_recv could not
/// return data when called.
#[deriving(Eq, Clone, Show)]
#[deriving(PartialEq, Clone, Show)]
pub enum TryRecvError {
/// This channel is currently empty, but the sender(s) have not yet
/// disconnected, so data may yet become available.
@ -372,7 +372,7 @@ pub enum TryRecvError {
/// This enumeration is the list of the possible error outcomes for the
/// `SyncSender::try_send` method.
#[deriving(Eq, Clone, Show)]
#[deriving(PartialEq, Clone, Show)]
pub enum TrySendError<T> {
/// The data could not be sent on the channel because it would require that
/// the callee block to send the data.

View file

@ -378,7 +378,7 @@ mod test {
/// A type, free to create, primarily intended for benchmarking creation of
/// wrappers that, just for construction, don't need a Reader/Writer that
/// does anything useful. Is equivalent to `/dev/null` in semantics.
#[deriving(Clone,Eq,Ord)]
#[deriving(Clone,PartialEq,PartialOrd)]
pub struct NullStream;
impl Reader for NullStream {

View file

@ -285,7 +285,7 @@ pub type IoResult<T> = Result<T, IoError>;
/// # FIXME
///
/// Is something like this sufficient? It's kind of archaic
#[deriving(Eq, Clone)]
#[deriving(PartialEq, Clone)]
pub struct IoError {
/// An enumeration which can be matched against for determining the flavor
/// of error.
@ -395,7 +395,7 @@ impl fmt::Show for IoError {
}
/// A list specifying general categories of I/O error.
#[deriving(Eq, Clone, Show)]
#[deriving(PartialEq, Clone, Show)]
pub enum IoErrorKind {
/// Any I/O error not part of this list.
OtherIoError,
@ -1582,7 +1582,7 @@ pub enum FileAccess {
}
/// Different kinds of files which can be identified by a call to stat
#[deriving(Eq, Show, Hash)]
#[deriving(PartialEq, Show, Hash)]
pub enum FileType {
/// This is a normal file, corresponding to `S_IFREG`
TypeFile,
@ -1726,7 +1726,7 @@ mod tests {
use prelude::*;
use uint;
#[deriving(Clone, Eq, Show)]
#[deriving(Clone, PartialEq, Show)]
enum BadReaderBehavior {
GoodBehavior(uint),
BadBehavior(uint)

View file

@ -25,7 +25,7 @@ use slice::{MutableCloneableVector, ImmutableVector, MutableVector};
pub type Port = u16;
#[deriving(Eq, TotalEq, Clone, Hash)]
#[deriving(PartialEq, TotalEq, Clone, Hash)]
pub enum IpAddr {
Ipv4Addr(u8, u8, u8, u8),
Ipv6Addr(u16, u16, u16, u16, u16, u16, u16, u16)
@ -56,7 +56,7 @@ impl fmt::Show for IpAddr {
}
}
#[deriving(Eq, TotalEq, Clone, Hash)]
#[deriving(PartialEq, TotalEq, Clone, Hash)]
pub struct SocketAddr {
pub ip: IpAddr,
pub port: Port,

View file

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

Some files were not shown because too many files have changed in this diff Show more