1
Fork 0

auto merge of #14534 : alexcrichton/rust/snapshots, r=sfackler

This is part 2 of the saga of renaming the Partial/Total equality and comparison traits.
This commit is contained in:
bors 2014-05-30 21:21:39 -07:00
commit 60a43f9bc5
267 changed files with 858 additions and 2102 deletions

View file

@ -12,7 +12,7 @@ use std::from_str::FromStr;
use std::fmt; use std::fmt;
use regex::Regex; use regex::Regex;
#[deriving(Clone, Eq)] #[deriving(Clone, PartialEq)]
pub enum Mode { pub enum Mode {
CompileFail, CompileFail,
RunFail, 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`. 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, 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`. 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 The `deriving` attribute allows certain traits to be automatically
implemented for data structures. For example, the following will implemented for data structures. For example, the following will
create an `impl` for the `Eq` and `Clone` traits for `Foo`, the type create an `impl` for the `PartialEq` and `Clone` traits for `Foo`, the type
parameter `T` will be given the `Eq` or `Clone` constraints for the parameter `T` will be given the `PartialEq` or `Clone` constraints for the
appropriate `impl`: appropriate `impl`:
~~~~ ~~~~
#[deriving(Eq, Clone)] #[deriving(PartialEq, Clone)]
struct Foo<T> { struct Foo<T> {
a: int, a: int,
b: T 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 } # 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 { fn eq(&self, other: &Foo<T>) -> bool {
self.a == other.a && self.b == other.b self.a == other.a && self.b == other.b
} }
@ -2188,7 +2188,7 @@ impl<T: Eq> Eq for Foo<T> {
Supported traits for `deriving` are: Supported traits for `deriving` are:
* Comparison traits: `Eq`, `TotalEq`, `Ord`, `TotalOrd`. * Comparison traits: `PartialEq`, `TotalEq`, `PartialOrd`, `TotalOrd`.
* Serialization: `Encodable`, `Decodable`. These require `serialize`. * Serialization: `Encodable`, `Decodable`. These require `serialize`.
* `Clone`, to create `T` from `&T` via a copy. * `Clone`, to create `T` from `&T` via a copy.
* `Hash`, to iterate over the bytes in a data type. * `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. : Equal to.
Calls the `eq` method on the `std::cmp::Eq` trait. Calls the `eq` method on the `std::cmp::PartialEq` trait.
* `!=` * `!=`
: Unequal to. : Unequal to.
Calls the `ne` method on the `std::cmp::Eq` trait. Calls the `ne` method on the `std::cmp::PartialEq` trait.
* `<` * `<`
: Less than. : Less than.
Calls the `lt` method on the `std::cmp::Ord` trait. Calls the `lt` method on the `std::cmp::PartialOrd` trait.
* `>` * `>`
: Greater than. : 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. : 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. : 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 #### Type cast expressions

View file

@ -61,7 +61,7 @@ There are two ways to install the Rust compiler: by building from source or
by downloading prebuilt binaries or installers for your platform. The by downloading prebuilt binaries or installers for your platform. The
[install page][rust-install] contains links to download binaries for both [install page][rust-install] contains links to download binaries for both
the nightly build and the most current Rust major release. For Windows and the nightly build and the most current Rust major release. For Windows and
OS X, the install page provides links to native installers. OS X, the install page provides links to native installers.
> *Note:* Windows users should read the detailed > *Note:* Windows users should read the detailed
> [Getting started][wiki-start] notes on the wiki. Even when using > [Getting started][wiki-start] notes on the wiki. Even when using
@ -69,8 +69,8 @@ OS X, the install page provides links to native installers.
> the precise details of which are not discussed here. > the precise details of which are not discussed here.
For Linux and OS X, the install page provides links to binary tarballs. For Linux and OS X, the install page provides links to binary tarballs.
To install the Rust compiler from the from a binary tarball, download To install the Rust compiler from the from a binary tarball, download
the binary package, extract it, and execute the `install.sh` script in the binary package, extract it, and execute the `install.sh` script in
the root directory of the package. the root directory of the package.
To build the Rust compiler from source, you will need to obtain the source through To build the Rust compiler from source, you will need to obtain the source through
@ -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 the `==` operator available, and took advantage of the lack of a destructor on `u32` to copy it
without a move of ownership. 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: 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>>), # Cons(T, Box<List<T>>),
# Nil # 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 on the next node in both lists.
match (xs, ys) { match (xs, ys) {
// If we have reached the end of both lists, they are equal. // 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)); assert!(eq(&xs, &ys));
~~~ ~~~
This would be a good opportunity to implement the `Eq` trait for our list type, making the `==` and 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 `Eq` trait and a definition of the `!=` 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 `eq` method. In a method, the `self` parameter refers to an instance of the type we're implementing
on. on.
@ -1339,7 +1339,7 @@ on.
# Cons(T, Box<List<T>>), # Cons(T, Box<List<T>>),
# Nil # Nil
# } # }
impl<T: Eq> Eq for List<T> { impl<T: PartialEq> PartialEq for List<T> {
fn eq(&self, ys: &List<T>) -> bool { fn eq(&self, ys: &List<T>) -> bool {
// Match on the next node in both lists. // Match on the next node in both lists.
match (self, ys) { match (self, ys) {
@ -1356,12 +1356,12 @@ impl<T: Eq> Eq for List<T> {
let xs = Cons(5, box Cons(10, box Nil)); let xs = Cons(5, box Cons(10, box Nil));
let ys = 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. // which we implemented on our linked list.
assert!(xs.eq(&ys)); assert!(xs.eq(&ys));
assert!(!xs.ne(&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.eq(&ys)`
assert!(!(xs != ys)); // `xs != ys` is short for `xs.ne(&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. // In a trait, `self` refers to the self argument.
// `Self` refers to the type implementing the trait. // `Self` refers to the type implementing the trait.
trait Eq { trait PartialEq {
fn equals(&self, other: &Self) -> bool; fn equals(&self, other: &Self) -> bool;
} }
// In an impl, `self` refers just to the value of the receiver // 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 } 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 that can be automatically derived. These instances are specified by
placing the `deriving` attribute on a data type declaration. For placing the `deriving` attribute on a data type declaration. For
example, the following will mean that `Circle` has an implementation 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: of type `ABC` can be randomly generated and converted to a string:
~~~ ~~~
extern crate rand; extern crate rand;
#[deriving(Eq)] #[deriving(PartialEq)]
struct Circle { radius: f64 } struct Circle { radius: f64 }
#[deriving(Rand, Show)] #[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`, `TotalOrd`, `Encodable`, `Decodable`, `Clone`,
`Hash`, `Rand`, `Default`, `Zero`, `FromPrimitive` and `Show`. `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 // option. This file may not be copied, modified, or distributed
// except according to those terms. // 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)] #![feature(struct_variant)]
extern crate rand; extern crate rand;
@ -117,8 +117,10 @@ traits = {
for (trait, supers, errs) in [('Rand', [], 1), for (trait, supers, errs) in [('Rand', [], 1),
('Clone', [], 1), ('Clone', [], 1),
('Eq', [], 2), ('Ord', [], 8), ('PartialEq', [], 2),
('TotalEq', [], 1), ('TotalOrd', ['TotalEq'], 1), ('PartialOrd', ['PartialEq'], 8),
('TotalEq', ['PartialEq'], 1),
('TotalOrd', ['TotalEq', 'PartialOrd', 'PartialEq'], 1),
('Show', [], 1), ('Show', [], 1),
('Hash', [], 1)]: ('Hash', [], 1)]:
traits[trait] = (ALL, supers, errs) traits[trait] = (ALL, supers, errs)

View file

@ -133,14 +133,7 @@ unsafe fn exchange_malloc(size: uint, align: uint) -> *mut u8 {
} }
} }
#[cfg(not(test), stage0)] #[cfg(not(test))]
#[lang="exchange_free"]
#[inline]
unsafe fn exchange_free(ptr: *mut u8) {
deallocate(ptr, 0, 8);
}
#[cfg(not(test), not(stage0))]
#[lang="exchange_free"] #[lang="exchange_free"]
#[inline] #[inline]
unsafe fn exchange_free(ptr: *mut u8, size: uint, align: uint) { unsafe fn exchange_free(ptr: *mut u8, size: uint, align: uint) {

View file

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

View file

@ -26,7 +26,7 @@ pointers, and then storing the parent pointers as `Weak` pointers.
use core::mem::transmute; use core::mem::transmute;
use core::cell::Cell; use core::cell::Cell;
use core::clone::Clone; use core::clone::Clone;
use core::cmp::{Eq, Ord, TotalEq, TotalOrd, Ordering}; use core::cmp::{PartialEq, PartialOrd, TotalEq, TotalOrd, Ordering};
use core::kinds::marker; use core::kinds::marker;
use core::ops::{Deref, Drop}; use core::ops::{Deref, Drop};
use core::option::{Option, Some, None}; use core::option::{Option, Some, None};
@ -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)] #[inline(always)]
fn eq(&self, other: &Rc<T>) -> bool { **self == **other } fn eq(&self, other: &Rc<T>) -> bool { **self == **other }
#[inline(always)] #[inline(always)]
@ -159,7 +159,7 @@ impl<T: Eq> Eq for Rc<T> {
impl<T: TotalEq> TotalEq 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)] #[inline(always)]
fn lt(&self, other: &Rc<T>) -> bool { **self < **other } 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 // The way arena uses arrays is really deeply awful. The arrays are
// allocated, and have capacities reserved, but the fill for the array // allocated, and have capacities reserved, but the fill for the array
// will always stay at 0. // will always stay at 0.
#[deriving(Clone, Eq)] #[deriving(Clone, PartialEq)]
struct Chunk { struct Chunk {
data: Rc<RefCell<Vec<u8> >>, data: Rc<RefCell<Vec<u8> >>,
fill: Cell<uint>, 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 { fn eq(&self, other: &BitvSet) -> bool {
if self.size != other.size { if self.size != other.size {
return false; 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 { fn eq(&self, other: &BTree<K, V>) -> bool {
self.root.cmp(&other.root) == Equal 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> 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 { fn lt(&self, other: &BTree<K, V>) -> bool {
self.cmp(other) == Less 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 { fn eq(&self, other: &Node<K, V>) -> bool {
match *self{ match *self{
BranchNode(ref branch) => { 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> 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 { fn lt(&self, other: &Node<K, V>) -> bool {
self.cmp(other) == Less 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 { fn eq(&self, other: &Leaf<K, V>) -> bool {
self.elts == other.elts 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> 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 { fn lt(&self, other: &Leaf<K, V>) -> bool {
self.cmp(other) == Less 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 { fn eq(&self, other: &Branch<K, V>) -> bool {
self.elts == other.elts 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> 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 { fn lt(&self, other: &Branch<K, V>) -> bool {
self.cmp(other) == Less 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 { fn eq(&self, other: &LeafElt<K, V>) -> bool {
self.key == other.key && self.value == other.value 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> 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 { fn lt(&self, other: &LeafElt<K, V>) -> bool {
self.cmp(other) == Less 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 { fn eq(&self, other: &BranchElt<K, V>) -> bool {
self.key == other.key && self.value == other.value 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> 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 { fn lt(&self, other: &BranchElt<K, V>) -> bool {
self.cmp(other) == Less 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 { fn eq(&self, other: &DList<A>) -> bool {
self.len() == other.len() && self.len() == other.len() &&
iter::order::eq(self.iter(), other.iter()) 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 { fn lt(&self, other: &DList<A>) -> bool {
iter::order::lt(self.iter(), other.iter()) iter::order::lt(self.iter(), other.iter())
} }

View file

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

View file

@ -12,7 +12,7 @@
use std::container::{Container, Mutable, Map, MutableMap, Set, MutableSet}; use std::container::{Container, Mutable, Map, MutableMap, Set, MutableSet};
use std::clone::Clone; use std::clone::Clone;
use std::cmp::{Eq, TotalEq, Equiv, max}; use std::cmp::{PartialEq, TotalEq, Equiv, max};
use std::default::Default; use std::default::Default;
use std::fmt; use std::fmt;
use std::fmt::Show; use std::fmt::Show;
@ -32,7 +32,7 @@ use std::slice::ImmutableVector;
mod table { mod table {
use std::clone::Clone; use std::clone::Clone;
use std::cmp; use std::cmp;
use std::cmp::Eq; use std::cmp::PartialEq;
use std::hash::{Hash, Hasher}; use std::hash::{Hash, Hasher};
use std::kinds::marker; use std::kinds::marker;
use std::num::{CheckedMul, is_power_of_two}; 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 /// A hash that is not zero, since we use a hash of zero to represent empty
/// buckets. /// buckets.
#[deriving(Eq)] #[deriving(PartialEq)]
pub struct SafeHash { pub struct SafeHash {
hash: u64, hash: u64,
} }
@ -661,8 +661,8 @@ static INITIAL_LOAD_FACTOR: Fraction = (9, 10);
/// denial-of-service attacks (Hash DoS). This behaviour can be /// denial-of-service attacks (Hash DoS). This behaviour can be
/// overridden with one of the constructors. /// overridden with one of the constructors.
/// ///
/// It is required that the keys implement the `Eq` and `Hash` traits, although /// It is required that the keys implement the `PartialEq` and `Hash` traits, although
/// this can frequently be achieved by using `#[deriving(Eq, Hash)]`. /// this can frequently be achieved by using `#[deriving(PartialEq, Hash)]`.
/// ///
/// Relevant papers/articles: /// 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 { fn eq(&self, other: &HashMap<K, V, H>) -> bool {
if self.len() != other.len() { return false; } 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 /// An implementation of a hash set using the underlying representation of a
/// HashMap where the value is (). As with the `HashMap` type, a `HashSet` /// 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)] #[deriving(Clone)]
pub struct HashSet<T, H = sip::SipHasher> { pub struct HashSet<T, H = sip::SipHasher> {
map: HashMap<T, (), H> 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 { fn eq(&self, other: &HashSet<T, H>) -> bool {
if self.len() != other.len() { return false; } if self.len() != other.len() { return false; }
@ -1691,7 +1691,7 @@ mod test_map {
local_data_key!(drop_vector: RefCell<Vec<int>>) local_data_key!(drop_vector: RefCell<Vec<int>>)
#[deriving(Hash, Eq, TotalEq)] #[deriving(Hash, PartialEq, TotalEq)]
struct Dropable { struct Dropable {
k: uint 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 { fn eq(&self, other: &KeyRef<K>) -> bool {
unsafe{ (*self.k).eq(&*other.k) } unsafe{ (*self.k).eq(&*other.k) }
} }
@ -253,7 +253,7 @@ impl<K, V> Drop for LruCache<K, V> {
mod tests { mod tests {
use super::LruCache; 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.is_some());
assert!(opt.unwrap() == &v); 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 { fn eq(&self, other: &RingBuf<A>) -> bool {
self.nelts == other.nelts && self.nelts == other.nelts &&
self.iter().zip(other.iter()).all(|(a, b)| a.eq(b)) self.iter().zip(other.iter()).all(|(a, b)| a.eq(b))
@ -397,7 +397,7 @@ mod tests {
use self::test::Bencher; use self::test::Bencher;
use deque::Deque; use deque::Deque;
use std::clone::Clone; use std::clone::Clone;
use std::cmp::Eq; use std::cmp::PartialEq;
use std::fmt::Show; use std::fmt::Show;
use super::RingBuf; use super::RingBuf;
@ -483,7 +483,7 @@ mod tests {
} }
#[cfg(test)] #[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(); let mut deq = RingBuf::new();
assert_eq!(deq.len(), 0); assert_eq!(deq.len(), 0);
deq.push_front(a.clone()); deq.push_front(a.clone());
@ -568,21 +568,21 @@ mod tests {
}) })
} }
#[deriving(Clone, Eq, Show)] #[deriving(Clone, PartialEq, Show)]
enum Taggy { enum Taggy {
One(int), One(int),
Two(int, int), Two(int, int),
Three(int, int, int), Three(int, int, int),
} }
#[deriving(Clone, Eq, Show)] #[deriving(Clone, PartialEq, Show)]
enum Taggypar<T> { enum Taggypar<T> {
Onepar(int), Onepar(int),
Twopar(int, int), Twopar(int, int),
Threepar(int, int, int), Threepar(int, int, int),
} }
#[deriving(Clone, Eq, Show)] #[deriving(Clone, PartialEq, Show)]
struct RecCy { struct RecCy {
x: int, x: int,
y: int, y: int,

View file

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

View file

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

View file

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

View file

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

View file

@ -30,12 +30,10 @@
use fmt; use fmt;
use intrinsics; use intrinsics;
#[cfg(not(test), stage0)]
use str::raw::c_str_to_static_slice;
#[cold] #[inline(never)] // this is the slow path, always #[cold] #[inline(never)] // this is the slow path, always
#[lang="fail_"] #[lang="fail_"]
#[cfg(not(test), not(stage0))] #[cfg(not(test))]
fn fail_(expr: &'static str, file: &'static str, line: uint) -> ! { fn fail_(expr: &'static str, file: &'static str, line: uint) -> ! {
format_args!(|args| -> () { format_args!(|args| -> () {
begin_unwind(args, file, line); begin_unwind(args, file, line);
@ -44,24 +42,9 @@ fn fail_(expr: &'static str, file: &'static str, line: uint) -> ! {
unsafe { intrinsics::abort() } unsafe { intrinsics::abort() }
} }
#[cold] #[inline(never)] // this is the slow path, always
#[lang="fail_"]
#[cfg(not(test), stage0)]
fn fail_(expr: *u8, file: *u8, line: uint) -> ! {
unsafe {
let expr = c_str_to_static_slice(expr as *i8);
let file = c_str_to_static_slice(file as *i8);
format_args!(|args| -> () {
begin_unwind(args, file, line);
}, "{}", expr);
intrinsics::abort()
}
}
#[cold] #[cold]
#[lang="fail_bounds_check"] #[lang="fail_bounds_check"]
#[cfg(not(test), not(stage0))] #[cfg(not(test))]
fn fail_bounds_check(file: &'static str, line: uint, fn fail_bounds_check(file: &'static str, line: uint,
index: uint, len: uint) -> ! { index: uint, len: uint) -> ! {
format_args!(|args| -> () { format_args!(|args| -> () {
@ -70,28 +53,9 @@ fn fail_bounds_check(file: &'static str, line: uint,
unsafe { intrinsics::abort() } unsafe { intrinsics::abort() }
} }
#[cold]
#[lang="fail_bounds_check"]
#[cfg(not(test), stage0)]
fn fail_bounds_check(file: *u8, line: uint, index: uint, len: uint) -> ! {
let file = unsafe { c_str_to_static_slice(file as *i8) };
format_args!(|args| -> () {
begin_unwind(args, file, line);
}, "index out of bounds: the len is {} but the index is {}", len, index);
unsafe { intrinsics::abort() }
}
#[cold] #[cold]
pub fn begin_unwind(fmt: &fmt::Arguments, file: &'static str, line: uint) -> ! { pub fn begin_unwind(fmt: &fmt::Arguments, file: &'static str, line: uint) -> ! {
#[allow(ctypes)] #[allow(ctypes)]
#[cfg(stage0)]
extern {
#[link_name = "rust_begin_unwind"]
fn begin_unwind(fmt: &fmt::Arguments, file: &'static str,
line: uint) -> !;
}
#[allow(ctypes)]
#[cfg(not(stage0))]
extern { extern {
#[lang = "begin_unwind"] #[lang = "begin_unwind"]
fn begin_unwind(fmt: &fmt::Arguments, file: &'static str, fn begin_unwind(fmt: &fmt::Arguments, file: &'static str,

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -45,7 +45,8 @@ pub use mem::drop;
pub use char::Char; pub use char::Char;
pub use clone::Clone; 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 container::{Container, Mutable, Map, MutableMap, Set, MutableSet};
pub use iter::{FromIterator, Extendable}; pub use iter::{FromIterator, Extendable};
pub use iter::{Iterator, DoubleEndedIterator, RandomAccessIterator, CloneableIterator}; pub use iter::{Iterator, DoubleEndedIterator, RandomAccessIterator, CloneableIterator};

View file

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

View file

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

View file

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

View file

@ -16,7 +16,7 @@ use mem;
use char; use char;
use clone::Clone; use clone::Clone;
use cmp; use cmp;
use cmp::{Eq, TotalEq}; use cmp::{PartialEq, TotalEq};
use container::Container; use container::Container;
use default::Default; use default::Default;
use iter::{Filter, Map, Iterator}; use iter::{Filter, Map, Iterator};
@ -696,7 +696,7 @@ pub struct Utf16Items<'a> {
iter: slice::Items<'a, u16> iter: slice::Items<'a, u16>
} }
/// The possibilities for values decoded from a `u16` stream. /// The possibilities for values decoded from a `u16` stream.
#[deriving(Eq, TotalEq, Clone, Show)] #[deriving(PartialEq, TotalEq, Clone, Show)]
pub enum Utf16Item { pub enum Utf16Item {
/// A valid codepoint. /// A valid codepoint.
ScalarValue(char), ScalarValue(char),
@ -930,7 +930,7 @@ Section: Trait implementations
#[allow(missing_doc)] #[allow(missing_doc)]
pub mod traits { pub mod traits {
use container::Container; use container::Container;
use cmp::{TotalOrd, Ordering, Less, Equal, Greater, Eq, Ord, Equiv, TotalEq}; use cmp::{TotalOrd, Ordering, Less, Equal, Greater, PartialEq, PartialOrd, Equiv, TotalEq};
use iter::Iterator; use iter::Iterator;
use option::{Some, None}; use option::{Some, None};
use str::{Str, StrSlice, eq_slice}; use str::{Str, StrSlice, eq_slice};
@ -950,7 +950,7 @@ pub mod traits {
} }
} }
impl<'a> Eq for &'a str { impl<'a> PartialEq for &'a str {
#[inline] #[inline]
fn eq(&self, other: & &'a str) -> bool { fn eq(&self, other: & &'a str) -> bool {
eq_slice((*self), (*other)) eq_slice((*self), (*other))
@ -961,7 +961,7 @@ pub mod traits {
impl<'a> TotalEq for &'a str {} impl<'a> TotalEq for &'a str {}
impl<'a> Ord for &'a str { impl<'a> PartialOrd for &'a str {
#[inline] #[inline]
fn lt(&self, other: & &'a str) -> bool { self.cmp(other) == Less } 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. //! traits, then a tuple itself also implements it.
//! //!
//! * `Clone` //! * `Clone`
//! * `Eq` //! * `PartialEq`
//! * `TotalEq` //! * `TotalEq`
//! * `Ord` //! * `PartialOrd`
//! * `TotalOrd` //! * `TotalOrd`
//! * `Default` //! * `Default`
//! //!
@ -109,7 +109,7 @@ macro_rules! tuple_impls {
} }
#[cfg(not(test))] #[cfg(not(test))]
impl<$($T:Eq),+> Eq for ($($T,)+) { impl<$($T:PartialEq),+> PartialEq for ($($T,)+) {
#[inline] #[inline]
fn eq(&self, other: &($($T,)+)) -> bool { fn eq(&self, other: &($($T,)+)) -> bool {
$(*self.$refN() == *other.$refN())&&+ $(*self.$refN() == *other.$refN())&&+
@ -124,7 +124,7 @@ macro_rules! tuple_impls {
impl<$($T:TotalEq),+> TotalEq for ($($T,)+) {} impl<$($T:TotalEq),+> TotalEq for ($($T,)+) {}
#[cfg(not(test))] #[cfg(not(test))]
impl<$($T:Ord + Eq),+> Ord for ($($T,)+) { impl<$($T:PartialOrd + PartialEq),+> PartialOrd for ($($T,)+) {
#[inline] #[inline]
fn lt(&self, other: &($($T,)+)) -> bool { fn lt(&self, other: &($($T,)+)) -> bool {
lexical_ord!(lt, $(self.$refN(), other.$refN()),+) lexical_ord!(lt, $(self.$refN(), other.$refN()),+)
@ -335,13 +335,13 @@ mod tests {
let nan = 0.0/0.0; let nan = 0.0/0.0;
// Eq // PartialEq
assert_eq!(small, small); assert_eq!(small, small);
assert_eq!(big, big); assert_eq!(big, big);
assert!(small != big); assert!(small != big);
assert!(big != small); assert!(big != small);
// Ord // PartialOrd
assert!(small < big); assert!(small < big);
assert!(!(small < small)); assert!(!(small < small));
assert!(!(big < 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 /// 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. /// to emit. These are emitted as a stream by the `Parser` class.
#[deriving(Eq)] #[deriving(PartialEq)]
pub enum Piece<'a> { pub enum Piece<'a> {
/// A literal string which should directly be emitted /// A literal string which should directly be emitted
String(&'a str), String(&'a str),
@ -39,7 +39,7 @@ pub enum Piece<'a> {
} }
/// Representation of an argument specification. /// Representation of an argument specification.
#[deriving(Eq)] #[deriving(PartialEq)]
pub struct Argument<'a> { pub struct Argument<'a> {
/// Where to find this argument /// Where to find this argument
pub position: Position<'a>, pub position: Position<'a>,
@ -50,7 +50,7 @@ pub struct Argument<'a> {
} }
/// Specification for the formatting of an argument in the format string. /// Specification for the formatting of an argument in the format string.
#[deriving(Eq)] #[deriving(PartialEq)]
pub struct FormatSpec<'a> { pub struct FormatSpec<'a> {
/// Optionally specified character to fill alignment with /// Optionally specified character to fill alignment with
pub fill: Option<char>, pub fill: Option<char>,
@ -69,7 +69,7 @@ pub struct FormatSpec<'a> {
} }
/// Enum describing where an argument for a format can be located. /// Enum describing where an argument for a format can be located.
#[deriving(Eq)] #[deriving(PartialEq)]
pub enum Position<'a> { pub enum Position<'a> {
/// The argument will be in the next position. This is the default. /// The argument will be in the next position. This is the default.
ArgumentNext, ArgumentNext,
@ -80,7 +80,7 @@ pub enum Position<'a> {
} }
/// Enum of alignments which are supported. /// Enum of alignments which are supported.
#[deriving(Eq)] #[deriving(PartialEq)]
pub enum Alignment { pub enum Alignment {
/// The value will be aligned to the left. /// The value will be aligned to the left.
AlignLeft, AlignLeft,
@ -92,7 +92,7 @@ pub enum Alignment {
/// Various flags which can be applied to format strings. The meaning of these /// Various flags which can be applied to format strings. The meaning of these
/// flags is defined by the formatters themselves. /// flags is defined by the formatters themselves.
#[deriving(Eq)] #[deriving(PartialEq)]
pub enum Flag { pub enum Flag {
/// A `+` will be used to denote positive numbers. /// A `+` will be used to denote positive numbers.
FlagSignPlus, FlagSignPlus,
@ -108,7 +108,7 @@ pub enum Flag {
/// A count is used for the precision and width parameters of an integer, and /// A count is used for the precision and width parameters of an integer, and
/// can reference either an argument or a literal integer. /// can reference either an argument or a literal integer.
#[deriving(Eq)] #[deriving(PartialEq)]
pub enum Count<'a> { pub enum Count<'a> {
/// The count is specified explicitly. /// The count is specified explicitly.
CountIs(uint), CountIs(uint),
@ -124,7 +124,7 @@ pub enum Count<'a> {
/// Enum describing all of the possible methods which the formatting language /// Enum describing all of the possible methods which the formatting language
/// currently supports. /// currently supports.
#[deriving(Eq)] #[deriving(PartialEq)]
pub enum Method<'a> { pub enum Method<'a> {
/// A plural method selects on an integer over a list of either integer or /// 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 /// 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 /// A selector for what pluralization a plural method should take
#[deriving(Eq, TotalEq, Hash)] #[deriving(PartialEq, TotalEq, Hash)]
pub enum PluralSelector { pub enum PluralSelector {
/// One of the plural keywords should be used /// One of the plural keywords should be used
Keyword(PluralKeyword), Keyword(PluralKeyword),
@ -155,7 +155,7 @@ pub enum PluralSelector {
} }
/// Structure representing one "arm" of the `plural` function. /// Structure representing one "arm" of the `plural` function.
#[deriving(Eq)] #[deriving(PartialEq)]
pub struct PluralArm<'a> { pub struct PluralArm<'a> {
/// A selector can either be specified by a keyword or with an integer /// A selector can either be specified by a keyword or with an integer
/// literal. /// literal.
@ -168,7 +168,7 @@ pub struct PluralArm<'a> {
/// is specially placed in the `Plural` variant of `Method`. /// is specially placed in the `Plural` variant of `Method`.
/// ///
/// http://www.icu-project.org/apiref/icu4c/classicu_1_1PluralRules.html /// http://www.icu-project.org/apiref/icu4c/classicu_1_1PluralRules.html
#[deriving(Eq, TotalEq, Hash, Show)] #[deriving(PartialEq, TotalEq, Hash, Show)]
#[allow(missing_doc)] #[allow(missing_doc)]
pub enum PluralKeyword { pub enum PluralKeyword {
/// The plural form for zero objects. /// The plural form for zero objects.
@ -184,7 +184,7 @@ pub enum PluralKeyword {
} }
/// Structure representing one "arm" of the `select` function. /// Structure representing one "arm" of the `select` function.
#[deriving(Eq)] #[deriving(PartialEq)]
pub struct SelectArm<'a> { pub struct SelectArm<'a> {
/// String selector which guards this arm /// String selector which guards this arm
pub selector: &'a str, pub selector: &'a str,

View file

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

View file

@ -198,12 +198,12 @@ fn list_dir_sorted(path: &Path) -> Option<Vec<Path>> {
/** /**
* A compiled Unix shell style pattern. * A compiled Unix shell style pattern.
*/ */
#[deriving(Clone, Eq, TotalEq, Ord, TotalOrd, Hash, Default)] #[deriving(Clone, PartialEq, TotalEq, PartialOrd, TotalOrd, Hash, Default)]
pub struct Pattern { pub struct Pattern {
tokens: Vec<PatternToken>, tokens: Vec<PatternToken>,
} }
#[deriving(Clone, Eq, TotalEq, Ord, TotalOrd, Hash)] #[deriving(Clone, PartialEq, TotalEq, PartialOrd, TotalOrd, Hash)]
enum PatternToken { enum PatternToken {
Char(char), Char(char),
AnyChar, AnyChar,
@ -212,13 +212,13 @@ enum PatternToken {
AnyExcept(Vec<CharSpecifier> ) AnyExcept(Vec<CharSpecifier> )
} }
#[deriving(Clone, Eq, TotalEq, Ord, TotalOrd, Hash)] #[deriving(Clone, PartialEq, TotalEq, PartialOrd, TotalOrd, Hash)]
enum CharSpecifier { enum CharSpecifier {
SingleChar(char), SingleChar(char),
CharRange(char, char) CharRange(char, char)
} }
#[deriving(Eq)] #[deriving(PartialEq)]
enum MatchResult { enum MatchResult {
Match, Match,
SubPatternDoesntMatch, 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(..)` * 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 { 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 /// An indication of how hard to work on a given operation, the difference
/// mainly being whether memory is synchronized or not /// mainly being whether memory is synchronized or not
#[deriving(Eq)] #[deriving(PartialEq)]
enum EffortLevel { enum EffortLevel {
DontTryTooHard, DontTryTooHard,
GiveItYourBest GiveItYourBest

View file

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

View file

@ -83,7 +83,7 @@ pub struct BigUint {
data: Vec<BigDigit> data: Vec<BigDigit>
} }
impl Eq for BigUint { impl PartialEq for BigUint {
#[inline] #[inline]
fn eq(&self, other: &BigUint) -> bool { fn eq(&self, other: &BigUint) -> bool {
match self.cmp(other) { Equal => true, _ => false } match self.cmp(other) { Equal => true, _ => false }
@ -91,7 +91,7 @@ impl Eq for BigUint {
} }
impl TotalEq for BigUint {} impl TotalEq for BigUint {}
impl Ord for BigUint { impl PartialOrd for BigUint {
#[inline] #[inline]
fn lt(&self, other: &BigUint) -> bool { fn lt(&self, other: &BigUint) -> bool {
match self.cmp(other) { Less => true, _ => false} 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. /// 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 } pub enum Sign { Minus, Zero, Plus }
impl Neg<Sign> for Sign { impl Neg<Sign> for Sign {
@ -808,7 +808,7 @@ pub struct BigInt {
data: BigUint data: BigUint
} }
impl Eq for BigInt { impl PartialEq for BigInt {
#[inline] #[inline]
fn eq(&self, other: &BigInt) -> bool { fn eq(&self, other: &BigInt) -> bool {
match self.cmp(other) { Equal => true, _ => false } match self.cmp(other) { Equal => true, _ => false }
@ -817,7 +817,7 @@ impl Eq for BigInt {
impl TotalEq for BigInt {} impl TotalEq for BigInt {}
impl Ord for BigInt { impl PartialOrd for BigInt {
#[inline] #[inline]
fn lt(&self, other: &BigInt) -> bool { fn lt(&self, other: &BigInt) -> bool {
match self.cmp(other) { Less => true, _ => false} 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. // probably doesn't map to C's _Complex correctly.
/// A complex number in Cartesian form. /// A complex number in Cartesian form.
#[deriving(Eq,Clone)] #[deriving(PartialEq,Clone)]
pub struct Complex<T> { pub struct Complex<T> {
/// Real portion of the complex number /// Real portion of the complex number
pub re: T, pub re: T,
@ -164,7 +164,7 @@ impl<T: Clone + Num> One for Complex<T> {
} }
/* string conversions */ /* 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 { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
if self.im < Zero::zero() { if self.im < Zero::zero() {
write!(f, "{}-{}i", self.re, -self.im) 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 { fn to_str_radix(&self, radix: uint) -> String {
if self.im < Zero::zero() { if self.im < Zero::zero() {
format!("{}-{}i", format!("{}-{}i",

View file

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

View file

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

View file

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

View file

@ -54,7 +54,7 @@ pub struct Range<X> {
accept_zone: 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 /// Create a new `Range` instance that samples uniformly from
/// `[low, high)`. Fails if `low >= high`. /// `[low, high)`. Fails if `low >= high`.
pub fn new(low: X, high: X) -> Range<X> { 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); /// let m: f64 = rng.gen_range(-40.0, 1.3e5);
/// println!("{}", m); /// 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"); assert!(low < high, "Rng.gen_range called with low >= high");
Range::new(low, high).ind_sample(self) Range::new(low, high).ind_sample(self)
} }

View file

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

View file

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

View file

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

View file

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

View file

@ -29,7 +29,7 @@ pub static False: Bool = 0 as Bool;
// Consts for the LLVM CallConv type, pre-cast to uint. // Consts for the LLVM CallConv type, pre-cast to uint.
#[deriving(Eq)] #[deriving(PartialEq)]
pub enum CallConv { pub enum CallConv {
CCallConv = 0, CCallConv = 0,
FastCallConv = 8, FastCallConv = 8,
@ -156,7 +156,7 @@ pub enum RealPredicate {
// The LLVM TypeKind type - must stay in sync with the def of // The LLVM TypeKind type - must stay in sync with the def of
// LLVMTypeKind in llvm/include/llvm-c/Core.h // LLVMTypeKind in llvm/include/llvm-c/Core.h
#[deriving(Eq)] #[deriving(PartialEq)]
#[repr(C)] #[repr(C)]
pub enum TypeKind { pub enum TypeKind {
Void = 0, Void = 0,
@ -226,7 +226,7 @@ pub enum AsmDialect {
AD_Intel = 1 AD_Intel = 1
} }
#[deriving(Eq)] #[deriving(PartialEq)]
#[repr(C)] #[repr(C)]
pub enum CodeGenOptLevel { pub enum CodeGenOptLevel {
CodeGenLevelNone = 0, 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; pub static tag_items_data_item_reexport_name: uint = 0x3a;
// used to encode crate_ctxt side tables // used to encode crate_ctxt side tables
#[deriving(Eq)] #[deriving(PartialEq)]
#[repr(uint)] #[repr(uint)]
pub enum astencode_tag { // Reserves 0x40 -- 0x5f pub enum astencode_tag { // Reserves 0x40 -- 0x5f
tag_ast = 0x40, tag_ast = 0x40,

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -215,7 +215,7 @@ enum useful {
not_useful, not_useful,
} }
#[deriving(Clone, Eq)] #[deriving(Clone, PartialEq)]
enum ctor { enum ctor {
single, single,
variant(DefId), 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 // FIXME (#33): this doesn't handle big integer/float literals correctly
// (nor does the rest of our literal handling). // (nor does the rest of our literal handling).
#[deriving(Clone, Eq)] #[deriving(Clone, PartialEq)]
pub enum const_val { pub enum const_val {
const_float(f64), const_float(f64),
const_int(i64), 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 }) 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> { 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;
use syntax::visit::Visitor; use syntax::visit::Visitor;
#[deriving(Eq)] #[deriving(PartialEq)]
enum UnsafeContext { enum UnsafeContext {
SafeContext, SafeContext,
UnsafeFn, UnsafeFn,

View file

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

View file

@ -55,11 +55,11 @@ pub struct Edge<E> {
pub data: E, pub data: E,
} }
#[deriving(Eq)] #[deriving(PartialEq)]
pub struct NodeIndex(pub uint); pub struct NodeIndex(pub uint);
pub static InvalidNodeIndex: NodeIndex = NodeIndex(uint::MAX); pub static InvalidNodeIndex: NodeIndex = NodeIndex(uint::MAX);
#[deriving(Eq)] #[deriving(PartialEq)]
pub struct EdgeIndex(pub uint); pub struct EdgeIndex(pub uint);
pub static InvalidEdgeIndex: EdgeIndex = EdgeIndex(uint::MAX); 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_index: NodeIndex,
start_data: N, start_data: N,
expected_incoming: &[(E,N)], expected_incoming: &[(E,N)],

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -55,7 +55,7 @@ pub enum CleanupScopeKind<'a> {
LoopScopeKind(ast::NodeId, [&'a Block<'a>, ..EXIT_MAX]) LoopScopeKind(ast::NodeId, [&'a Block<'a>, ..EXIT_MAX])
} }
#[deriving(Eq)] #[deriving(PartialEq)]
pub enum EarlyExitLabel { pub enum EarlyExitLabel {
UnwindExit, UnwindExit,
ReturnExit, 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. // Key used to lookup values supplied for type parameters in an expr.
#[deriving(Eq)] #[deriving(PartialEq)]
pub enum ExprOrMethodCall { pub enum ExprOrMethodCall {
// Type parameters for a path like `None::<int>` // Type parameters for a path like `None::<int>`
ExprId(ast::NodeId), ExprId(ast::NodeId),

View file

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

View file

@ -2403,7 +2403,7 @@ fn type_metadata(cx: &CrateContext,
type_metadata type_metadata
} }
#[deriving(Eq)] #[deriving(PartialEq)]
enum DebugLocation { enum DebugLocation {
KnownLocation { scope: DIScope, line: uint, col: uint }, KnownLocation { scope: DIScope, line: uint, col: uint },
UnknownLocation 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 // These are passed around by the code generating functions to track the
// destination of a computation's value. // destination of a computation's value.
#[deriving(Eq)] #[deriving(PartialEq)]
pub enum Dest { pub enum Dest {
SaveIn(ValueRef), SaveIn(ValueRef),
Ignore, Ignore,
@ -1497,7 +1497,7 @@ fn float_cast(bcx: &Block,
} else { llsrc }; } else { llsrc };
} }
#[deriving(Eq)] #[deriving(PartialEq)]
pub enum cast_kind { pub enum cast_kind {
cast_pointer, cast_pointer,
cast_integral, cast_integral,

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -456,7 +456,7 @@ trait CresCompare<T> {
fn compare(&self, t: T, f: || -> ty::type_err) -> cres<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> { fn compare(&self, t: T, f: || -> ty::type_err) -> cres<T> {
(*self).clone().and_then(|s| { (*self).clone().and_then(|s| {
if s == t { if s == t {

View file

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

View file

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

View file

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

View file

@ -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); pub struct Lifetime(String);
impl Lifetime { 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 { pub enum SelfTy {
SelfStatic, SelfStatic,
SelfValue, 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 { pub enum Mutability {
Mutable, Mutable,
Immutable, Immutable,

View file

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

View file

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

View file

@ -34,14 +34,14 @@ pub struct Guard<'a> {
pub can_timeout: bool, pub can_timeout: bool,
} }
#[deriving(Eq)] #[deriving(PartialEq)]
enum TimeoutState { enum TimeoutState {
NoTimeout, NoTimeout,
TimeoutPending(ClientState), TimeoutPending(ClientState),
TimedOut, TimedOut,
} }
#[deriving(Eq)] #[deriving(PartialEq)]
enum ClientState { enum ClientState {
NoWaiter, NoWaiter,
AccessPending, 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; #[cfg(windows)] pub type uv_gid_t = libc::c_uchar;
#[repr(C)] #[repr(C)]
#[deriving(Eq)] #[deriving(PartialEq)]
pub enum uv_handle_type { pub enum uv_handle_type {
UV_UNKNOWN_HANDLE, UV_UNKNOWN_HANDLE,
UV_ASYNC, UV_ASYNC,
@ -279,7 +279,7 @@ pub enum uv_handle_type {
#[repr(C)] #[repr(C)]
#[cfg(unix)] #[cfg(unix)]
#[deriving(Eq)] #[deriving(PartialEq)]
pub enum uv_req_type { pub enum uv_req_type {
UV_UNKNOWN_REQ, UV_UNKNOWN_REQ,
UV_REQ, UV_REQ,
@ -297,7 +297,7 @@ pub enum uv_req_type {
// See UV_REQ_TYPE_PRIVATE at libuv/include/uv-win.h // See UV_REQ_TYPE_PRIVATE at libuv/include/uv-win.h
#[repr(C)] #[repr(C)]
#[cfg(windows)] #[cfg(windows)]
#[deriving(Eq)] #[deriving(PartialEq)]
pub enum uv_req_type { pub enum uv_req_type {
UV_UNKNOWN_REQ, UV_UNKNOWN_REQ,
UV_REQ, UV_REQ,
@ -320,7 +320,7 @@ pub enum uv_req_type {
} }
#[repr(C)] #[repr(C)]
#[deriving(Eq)] #[deriving(PartialEq)]
pub enum uv_membership { pub enum uv_membership {
UV_LEAVE_GROUP, UV_LEAVE_GROUP,
UV_JOIN_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 /// 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`. /// be parsed as a decimal value, it will be represented with `Numeric`.
#[deriving(Clone, Eq)] #[deriving(Clone, PartialEq)]
#[allow(missing_doc)] #[allow(missing_doc)]
pub enum Identifier { pub enum Identifier {
Numeric(uint), Numeric(uint),
AlphaNumeric(String) AlphaNumeric(String)
} }
impl cmp::Ord for Identifier { impl cmp::PartialOrd for Identifier {
#[inline] #[inline]
fn lt(&self, other: &Identifier) -> bool { fn lt(&self, other: &Identifier) -> bool {
match (self, other) { match (self, other) {
@ -115,7 +115,7 @@ impl fmt::Show for Version {
} }
} }
impl cmp::Eq for Version { impl cmp::PartialEq for Version {
#[inline] #[inline]
fn eq(&self, other: &Version) -> bool { fn eq(&self, other: &Version) -> bool {
// We should ignore build metadata here, otherwise versions v1 and v2 // 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] #[inline]
fn lt(&self, other: &Version) -> bool { 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< impl<
E, E,
S: Encoder<E>, S: Encoder<E>,
K: Encodable<S, E> + Eq + TotalOrd, K: Encodable<S, E> + PartialEq + TotalOrd,
V: Encodable<S, E> + Eq V: Encodable<S, E> + PartialEq
> Encodable<S, E> for TreeMap<K, V> { > Encodable<S, E> for TreeMap<K, V> {
fn encode(&self, e: &mut S) -> Result<(), E> { fn encode(&self, e: &mut S) -> Result<(), E> {
e.emit_map(self.len(), |e| { e.emit_map(self.len(), |e| {
@ -95,8 +95,8 @@ impl<
impl< impl<
E, E,
D: Decoder<E>, D: Decoder<E>,
K: Decodable<D, E> + Eq + TotalOrd, K: Decodable<D, E> + PartialEq + TotalOrd,
V: Decodable<D, E> + Eq V: Decodable<D, E> + PartialEq
> Decodable<D, E> for TreeMap<K, V> { > Decodable<D, E> for TreeMap<K, V> {
fn decode(d: &mut D) -> Result<TreeMap<K, V>, E> { fn decode(d: &mut D) -> Result<TreeMap<K, V>, E> {
d.read_map(|d, len| { d.read_map(|d, len| {
@ -114,7 +114,7 @@ impl<
impl< impl<
E, E,
S: Encoder<E>, S: Encoder<E>,
T: Encodable<S, E> + Eq + TotalOrd T: Encodable<S, E> + PartialEq + TotalOrd
> Encodable<S, E> for TreeSet<T> { > Encodable<S, E> for TreeSet<T> {
fn encode(&self, s: &mut S) -> Result<(), E> { fn encode(&self, s: &mut S) -> Result<(), E> {
s.emit_seq(self.len(), |s| { s.emit_seq(self.len(), |s| {
@ -131,7 +131,7 @@ impl<
impl< impl<
E, E,
D: Decoder<E>, D: Decoder<E>,
T: Decodable<D, E> + Eq + TotalOrd T: Decodable<D, E> + PartialEq + TotalOrd
> Decodable<D, E> for TreeSet<T> { > Decodable<D, E> for TreeSet<T> {
fn decode(d: &mut D) -> Result<TreeSet<T>, E> { fn decode(d: &mut D) -> Result<TreeSet<T>, E> {
d.read_seq(|d, len| { d.read_seq(|d, len| {

View file

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

View file

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

View file

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

View file

@ -66,7 +66,7 @@ fn main() {
*/ */
use clone::Clone; use clone::Clone;
use cmp::Eq; use cmp::PartialEq;
use container::Container; use container::Container;
use iter::{Iterator, range}; use iter::{Iterator, range};
use kinds::marker; 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 { fn eq(&self, other: &CString) -> bool {
if self.buf as uint == other.buf as uint { if self.buf as uint == other.buf as uint {
true 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 /// This enumeration is the list of the possible reasons that try_recv could not
/// return data when called. /// return data when called.
#[deriving(Eq, Clone, Show)] #[deriving(PartialEq, Clone, Show)]
pub enum TryRecvError { pub enum TryRecvError {
/// This channel is currently empty, but the sender(s) have not yet /// This channel is currently empty, but the sender(s) have not yet
/// disconnected, so data may yet become available. /// 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 /// This enumeration is the list of the possible error outcomes for the
/// `SyncSender::try_send` method. /// `SyncSender::try_send` method.
#[deriving(Eq, Clone, Show)] #[deriving(PartialEq, Clone, Show)]
pub enum TrySendError<T> { pub enum TrySendError<T> {
/// The data could not be sent on the channel because it would require that /// The data could not be sent on the channel because it would require that
/// the callee block to send the data. /// the callee block to send the data.

View file

@ -492,10 +492,6 @@ will look like `"\\{"`.
use io::Writer; use io::Writer;
use io; use io;
#[cfg(stage0)]
use option::None;
#[cfg(stage0)]
use repr;
use result::{Ok, Err}; use result::{Ok, Err};
use str::{Str, StrAllocating}; use str::{Str, StrAllocating};
use str; use str;
@ -524,21 +520,6 @@ pub use core::fmt::{secret_float, secret_upper_exp, secret_lower_exp};
#[doc(hidden)] #[doc(hidden)]
pub use core::fmt::{secret_pointer}; pub use core::fmt::{secret_pointer};
#[doc(hidden)]
#[cfg(stage0)]
pub fn secret_poly<T: Poly>(x: &T, fmt: &mut Formatter) -> Result {
// FIXME #11938 - UFCS would make us able call the this method
// directly Poly::fmt(x, fmt).
x.fmt(fmt)
}
/// Format trait for the `?` character
#[cfg(stage0)]
pub trait Poly {
/// Formats the value using the given formatter.
fn fmt(&self, &mut Formatter) -> Result;
}
/// The format function takes a precompiled format string and a list of /// The format function takes a precompiled format string and a list of
/// arguments, to return the resulting formatted string. /// arguments, to return the resulting formatted string.
/// ///
@ -562,27 +543,6 @@ pub fn format(args: &Arguments) -> string::String{
str::from_utf8(output.unwrap().as_slice()).unwrap().into_string() str::from_utf8(output.unwrap().as_slice()).unwrap().into_string()
} }
#[cfg(stage0)]
impl<T> Poly for T {
fn fmt(&self, f: &mut Formatter) -> Result {
match (f.width, f.precision) {
(None, None) => {
match repr::write_repr(f, self) {
Ok(()) => Ok(()),
Err(..) => Err(WriteError),
}
}
// If we have a specified width for formatting, then we have to make
// this allocation of a new string
_ => {
let s = repr::repr_to_str(self);
f.pad(s.as_slice())
}
}
}
}
impl<'a> Writer for Formatter<'a> { impl<'a> Writer for Formatter<'a> {
fn write(&mut self, b: &[u8]) -> io::IoResult<()> { fn write(&mut self, b: &[u8]) -> io::IoResult<()> {
match (*self).write(b) { match (*self).write(b) {

View file

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

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