diff --git a/src/compiletest/common.rs b/src/compiletest/common.rs index 4788229ff79c5..3df46fde59ae8 100644 --- a/src/compiletest/common.rs +++ b/src/compiletest/common.rs @@ -12,7 +12,7 @@ use std::from_str::FromStr; use std::fmt; use regex::Regex; -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] pub enum Mode { CompileFail, RunFail, diff --git a/src/doc/rust.md b/src/doc/rust.md index bf4fd3dcc9377..ee37cd2126c50 100644 --- a/src/doc/rust.md +++ b/src/doc/rust.md @@ -1436,7 +1436,7 @@ trait Circle : Shape { fn radius() -> f64; } ~~~~ the syntax `Circle : Shape` means that types that implement `Circle` must also have an implementation for `Shape`. -Multiple supertraits are separated by `+`, `trait Circle : Shape + Eq { }`. +Multiple supertraits are separated by `+`, `trait Circle : Shape + PartialEq { }`. In an implementation of `Circle` for a given type `T`, methods can refer to `Shape` methods, since the typechecker checks that any type with an implementation of `Circle` also has an implementation of `Shape`. @@ -2159,23 +2159,23 @@ There are three different types of inline attributes: The `deriving` attribute allows certain traits to be automatically implemented for data structures. For example, the following will -create an `impl` for the `Eq` and `Clone` traits for `Foo`, the type -parameter `T` will be given the `Eq` or `Clone` constraints for the +create an `impl` for the `PartialEq` and `Clone` traits for `Foo`, the type +parameter `T` will be given the `PartialEq` or `Clone` constraints for the appropriate `impl`: ~~~~ -#[deriving(Eq, Clone)] +#[deriving(PartialEq, Clone)] struct Foo { a: int, b: T } ~~~~ -The generated `impl` for `Eq` is equivalent to +The generated `impl` for `PartialEq` is equivalent to ~~~~ # struct Foo { a: int, b: T } -impl Eq for Foo { +impl PartialEq for Foo { fn eq(&self, other: &Foo) -> bool { self.a == other.a && self.b == other.b } @@ -2188,7 +2188,7 @@ impl Eq for Foo { Supported traits for `deriving` are: -* Comparison traits: `Eq`, `TotalEq`, `Ord`, `TotalOrd`. +* Comparison traits: `PartialEq`, `TotalEq`, `PartialOrd`, `TotalOrd`. * Serialization: `Encodable`, `Decodable`. These require `serialize`. * `Clone`, to create `T` from `&T` via a copy. * `Hash`, to iterate over the bytes in a data type. @@ -2734,22 +2734,22 @@ The default meaning of the operators on standard types is given here. * `==` : Equal to. - Calls the `eq` method on the `std::cmp::Eq` trait. + Calls the `eq` method on the `std::cmp::PartialEq` trait. * `!=` : Unequal to. - Calls the `ne` method on the `std::cmp::Eq` trait. + Calls the `ne` method on the `std::cmp::PartialEq` trait. * `<` : Less than. - Calls the `lt` method on the `std::cmp::Ord` trait. + Calls the `lt` method on the `std::cmp::PartialOrd` trait. * `>` : Greater than. - Calls the `gt` method on the `std::cmp::Ord` trait. + Calls the `gt` method on the `std::cmp::PartialOrd` trait. * `<=` : Less than or equal. - Calls the `le` method on the `std::cmp::Ord` trait. + Calls the `le` method on the `std::cmp::PartialOrd` trait. * `>=` : Greater than or equal. - Calls the `ge` method on the `std::cmp::Ord` trait. + Calls the `ge` method on the `std::cmp::PartialOrd` trait. #### Type cast expressions diff --git a/src/doc/tutorial.md b/src/doc/tutorial.md index a22256650b854..a4c89436d50af 100644 --- a/src/doc/tutorial.md +++ b/src/doc/tutorial.md @@ -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 [install page][rust-install] contains links to download binaries for both 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 > [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. 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 -the binary package, extract it, and execute the `install.sh` script in +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 root directory of the package. 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 without a move of ownership. -We can add a *trait bound* on the `Eq` trait to require that the type implement the `==` operator. +We can add a *trait bound* on the `PartialEq` trait to require that the type implement the `==` operator. Two more `ref` annotations need to be added to avoid attempting to move out the element types: ~~~ @@ -1311,7 +1311,7 @@ Two more `ref` annotations need to be added to avoid attempting to move out the # Cons(T, Box>), # Nil # } -fn eq(xs: &List, ys: &List) -> bool { +fn eq(xs: &List, ys: &List) -> bool { // Match on the next node in both lists. match (xs, ys) { // If we have reached the end of both lists, they are equal. @@ -1329,8 +1329,8 @@ let ys = Cons('c', box Cons('a', box Cons('t', box Nil))); assert!(eq(&xs, &ys)); ~~~ -This would be a good opportunity to implement the `Eq` trait for our list type, making the `==` and -`!=` operators available. We'll need to provide an `impl` for the `Eq` trait and a definition of the +This would be a good opportunity to implement the `PartialEq` trait for our list type, making the `==` and +`!=` operators available. We'll need to provide an `impl` for the `PartialEq` trait and a definition of the `eq` method. In a method, the `self` parameter refers to an instance of the type we're implementing on. @@ -1339,7 +1339,7 @@ on. # Cons(T, Box>), # Nil # } -impl Eq for List { +impl PartialEq for List { fn eq(&self, ys: &List) -> bool { // Match on the next node in both lists. match (self, ys) { @@ -1356,12 +1356,12 @@ impl Eq for List { let xs = Cons(5, box Cons(10, box Nil)); let ys = Cons(5, box Cons(10, box Nil)); -// The methods below are part of the Eq trait, +// The methods below are part of the PartialEq trait, // which we implemented on our linked list. assert!(xs.eq(&ys)); assert!(!xs.ne(&ys)); -// The Eq trait also allows us to use the shorthand infix operators. +// The PartialEq trait also allows us to use the shorthand infix operators. assert!(xs == ys); // `xs == ys` is short for `xs.eq(&ys)` assert!(!(xs != ys)); // `xs != ys` is short for `xs.ne(&ys)` ~~~ @@ -2345,12 +2345,12 @@ trait describes types that support an equality operation: ~~~~ // In a trait, `self` refers to the self argument. // `Self` refers to the type implementing the trait. -trait Eq { +trait PartialEq { fn equals(&self, other: &Self) -> bool; } // In an impl, `self` refers just to the value of the receiver -impl Eq for int { +impl PartialEq for int { fn equals(&self, other: &int) -> bool { *other == *self } } ~~~~ @@ -2600,13 +2600,13 @@ A small number of traits in `std` and `extra` can have implementations that can be automatically derived. These instances are specified by placing the `deriving` attribute on a data type declaration. For example, the following will mean that `Circle` has an implementation -for `Eq` and can be used with the equality operators, and that a value +for `PartialEq` and can be used with the equality operators, and that a value of type `ABC` can be randomly generated and converted to a string: ~~~ extern crate rand; -#[deriving(Eq)] +#[deriving(PartialEq)] struct Circle { radius: f64 } #[deriving(Rand, Show)] @@ -2618,7 +2618,7 @@ fn main() { } ~~~ -The full list of derivable traits is `Eq`, `TotalEq`, `Ord`, +The full list of derivable traits is `PartialEq`, `TotalEq`, `Ord`, `TotalOrd`, `Encodable`, `Decodable`, `Clone`, `Hash`, `Rand`, `Default`, `Zero`, `FromPrimitive` and `Show`. diff --git a/src/etc/generate-deriving-span-tests.py b/src/etc/generate-deriving-span-tests.py index 51bec8f4c249b..7e6bfcdd4ec64 100755 --- a/src/etc/generate-deriving-span-tests.py +++ b/src/etc/generate-deriving-span-tests.py @@ -35,7 +35,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' +// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #![feature(struct_variant)] extern crate rand; @@ -117,8 +117,10 @@ def write_file(name, string): for (trait, supers, errs) in [('Rand', [], 1), ('Clone', [], 1), - ('Eq', [], 2), ('Ord', [], 8), - ('TotalEq', [], 1), ('TotalOrd', ['TotalEq'], 1), + ('PartialEq', [], 2), + ('PartialOrd', ['PartialEq'], 8), + ('TotalEq', ['PartialEq'], 1), + ('TotalOrd', ['TotalEq', 'PartialOrd', 'PartialEq'], 1), ('Show', [], 1), ('Hash', [], 1)]: traits[trait] = (ALL, supers, errs) diff --git a/src/liballoc/owned.rs b/src/liballoc/owned.rs index 114fe4eb0d49e..61fff41374bfb 100644 --- a/src/liballoc/owned.rs +++ b/src/liballoc/owned.rs @@ -12,7 +12,7 @@ use core::any::{Any, AnyRefExt}; use core::clone::Clone; -use core::cmp::{Eq, Ord, TotalEq, TotalOrd, Ordering}; +use core::cmp::{PartialEq, PartialOrd, TotalEq, TotalOrd, Ordering}; use core::default::Default; use core::fmt; use core::intrinsics; @@ -51,13 +51,13 @@ impl Clone for Box { } // box pointers -impl Eq for Box { +impl PartialEq for Box { #[inline] fn eq(&self, other: &Box) -> bool { *(*self) == *(*other) } #[inline] fn ne(&self, other: &Box) -> bool { *(*self) != *(*other) } } -impl Ord for Box { +impl PartialOrd for Box { #[inline] fn lt(&self, other: &Box) -> bool { *(*self) < *(*other) } #[inline] diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index 96d90e6ed6395..8bf7f64a719b6 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -26,7 +26,7 @@ pointers, and then storing the parent pointers as `Weak` pointers. use core::mem::transmute; use core::cell::Cell; use core::clone::Clone; -use core::cmp::{Eq, Ord, TotalEq, TotalOrd, Ordering}; +use core::cmp::{PartialEq, PartialOrd, TotalEq, TotalOrd, Ordering}; use core::kinds::marker; use core::ops::{Deref, Drop}; use core::option::{Option, Some, None}; @@ -150,7 +150,7 @@ impl Clone for Rc { } } -impl Eq for Rc { +impl PartialEq for Rc { #[inline(always)] fn eq(&self, other: &Rc) -> bool { **self == **other } #[inline(always)] @@ -159,7 +159,7 @@ impl Eq for Rc { impl TotalEq for Rc {} -impl Ord for Rc { +impl PartialOrd for Rc { #[inline(always)] fn lt(&self, other: &Rc) -> bool { **self < **other } diff --git a/src/libarena/lib.rs b/src/libarena/lib.rs index 58d8bf289e173..7acef128016cf 100644 --- a/src/libarena/lib.rs +++ b/src/libarena/lib.rs @@ -43,7 +43,7 @@ use std::rt::heap::allocate; // The way arena uses arrays is really deeply awful. The arrays are // allocated, and have capacities reserved, but the fill for the array // will always stay at 0. -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] struct Chunk { data: Rc >>, fill: Cell, diff --git a/src/libcollections/bitv.rs b/src/libcollections/bitv.rs index 54bc6989d7cf8..c91a5289faa13 100644 --- a/src/libcollections/bitv.rs +++ b/src/libcollections/bitv.rs @@ -796,7 +796,7 @@ impl BitvSet { } } -impl cmp::Eq for BitvSet { +impl cmp::PartialEq for BitvSet { fn eq(&self, other: &BitvSet) -> bool { if self.size != other.size { return false; diff --git a/src/libcollections/btree.rs b/src/libcollections/btree.rs index 184a59303f3a4..e0bb8658c13e9 100644 --- a/src/libcollections/btree.rs +++ b/src/libcollections/btree.rs @@ -92,7 +92,7 @@ impl Clone for BTree { } } -impl Eq for BTree { +impl PartialEq for BTree { fn eq(&self, other: &BTree) -> bool { self.root.cmp(&other.root) == Equal } @@ -100,7 +100,7 @@ impl Eq for BTree { impl TotalEq for BTree {} -impl Ord for BTree { +impl PartialOrd for BTree { fn lt(&self, other: &BTree) -> bool { self.cmp(other) == Less } @@ -198,7 +198,7 @@ impl Clone for Node { } } -impl Eq for Node { +impl PartialEq for Node { fn eq(&self, other: &Node) -> bool { match *self{ BranchNode(ref branch) => { @@ -222,7 +222,7 @@ impl Eq for Node { impl TotalEq for Node {} -impl Ord for Node { +impl PartialOrd for Node { fn lt(&self, other: &Node) -> bool { self.cmp(other) == Less } @@ -393,7 +393,7 @@ impl Clone for Leaf { } } -impl Eq for Leaf { +impl PartialEq for Leaf { fn eq(&self, other: &Leaf) -> bool { self.elts == other.elts } @@ -401,7 +401,7 @@ impl Eq for Leaf { impl TotalEq for Leaf {} -impl Ord for Leaf { +impl PartialOrd for Leaf { fn lt(&self, other: &Leaf) -> bool { self.cmp(other) == Less } @@ -623,7 +623,7 @@ impl Clone for Branch { } } -impl Eq for Branch { +impl PartialEq for Branch { fn eq(&self, other: &Branch) -> bool { self.elts == other.elts } @@ -631,7 +631,7 @@ impl Eq for Branch { impl TotalEq for Branch {} -impl Ord for Branch { +impl PartialOrd for Branch { fn lt(&self, other: &Branch) -> bool { self.cmp(other) == Less } @@ -691,7 +691,7 @@ impl Clone for LeafElt { } } -impl Eq for LeafElt { +impl PartialEq for LeafElt { fn eq(&self, other: &LeafElt) -> bool { self.key == other.key && self.value == other.value } @@ -699,7 +699,7 @@ impl Eq for LeafElt { impl TotalEq for LeafElt {} -impl Ord for LeafElt { +impl PartialOrd for LeafElt { fn lt(&self, other: &LeafElt) -> bool { self.cmp(other) == Less } @@ -740,7 +740,7 @@ impl Clone for BranchElt { } } -impl Eq for BranchElt{ +impl PartialEq for BranchElt{ fn eq(&self, other: &BranchElt) -> bool { self.key == other.key && self.value == other.value } @@ -748,7 +748,7 @@ impl Eq for BranchElt{ impl TotalEq for BranchElt{} -impl Ord for BranchElt { +impl PartialOrd for BranchElt { fn lt(&self, other: &BranchElt) -> bool { self.cmp(other) == Less } diff --git a/src/libcollections/dlist.rs b/src/libcollections/dlist.rs index 957299197386f..d99474cf5f842 100644 --- a/src/libcollections/dlist.rs +++ b/src/libcollections/dlist.rs @@ -572,7 +572,7 @@ impl Extendable for DList { } } -impl Eq for DList { +impl PartialEq for DList { fn eq(&self, other: &DList) -> bool { self.len() == other.len() && iter::order::eq(self.iter(), other.iter()) @@ -584,7 +584,7 @@ impl Eq for DList { } } -impl Ord for DList { +impl PartialOrd for DList { fn lt(&self, other: &DList) -> bool { iter::order::lt(self.iter(), other.iter()) } diff --git a/src/libcollections/enum_set.rs b/src/libcollections/enum_set.rs index 41501f2d261ec..797fbbcebf764 100644 --- a/src/libcollections/enum_set.rs +++ b/src/libcollections/enum_set.rs @@ -15,7 +15,7 @@ use std::num::Bitwise; -#[deriving(Clone, Eq, TotalEq, Hash, Show)] +#[deriving(Clone, PartialEq, TotalEq, Hash, Show)] /// A specialized Set implementation to use enum types. pub struct EnumSet { // We must maintain the invariant that no bits are set @@ -141,7 +141,7 @@ mod test { use enum_set::{EnumSet, CLike}; - #[deriving(Eq, Show)] + #[deriving(PartialEq, Show)] #[repr(uint)] enum Foo { A, B, C diff --git a/src/libcollections/hashmap.rs b/src/libcollections/hashmap.rs index c1bc379f0b785..f535e87de5c23 100644 --- a/src/libcollections/hashmap.rs +++ b/src/libcollections/hashmap.rs @@ -12,7 +12,7 @@ use std::container::{Container, Mutable, Map, MutableMap, Set, MutableSet}; use std::clone::Clone; -use std::cmp::{Eq, TotalEq, Equiv, max}; +use std::cmp::{PartialEq, TotalEq, Equiv, max}; use std::default::Default; use std::fmt; use std::fmt::Show; @@ -32,7 +32,7 @@ use std::slice::ImmutableVector; mod table { use std::clone::Clone; use std::cmp; - use std::cmp::Eq; + use std::cmp::PartialEq; use std::hash::{Hash, Hasher}; use std::kinds::marker; use std::num::{CheckedMul, is_power_of_two}; @@ -145,7 +145,7 @@ mod table { /// A hash that is not zero, since we use a hash of zero to represent empty /// buckets. - #[deriving(Eq)] + #[deriving(PartialEq)] pub struct SafeHash { hash: u64, } @@ -661,8 +661,8 @@ static INITIAL_LOAD_FACTOR: Fraction = (9, 10); /// denial-of-service attacks (Hash DoS). This behaviour can be /// overridden with one of the constructors. /// -/// It is required that the keys implement the `Eq` and `Hash` traits, although -/// this can frequently be achieved by using `#[deriving(Eq, Hash)]`. +/// It is required that the keys implement the `PartialEq` and `Hash` traits, although +/// this can frequently be achieved by using `#[deriving(PartialEq, Hash)]`. /// /// Relevant papers/articles: /// @@ -1402,7 +1402,7 @@ impl, V: Clone, S, H: Hasher> HashMap { } } -impl, V: Eq, S, H: Hasher> Eq for HashMap { +impl, V: PartialEq, S, H: Hasher> PartialEq for HashMap { fn eq(&self, other: &HashMap) -> bool { if self.len() != other.len() { return false; } @@ -1480,13 +1480,13 @@ pub type SetMoveItems = /// An implementation of a hash set using the underlying representation of a /// HashMap where the value is (). As with the `HashMap` type, a `HashSet` -/// requires that the elements implement the `Eq` and `Hash` traits. +/// requires that the elements implement the `PartialEq` and `Hash` traits. #[deriving(Clone)] pub struct HashSet { map: HashMap } -impl, S, H: Hasher> Eq for HashSet { +impl, S, H: Hasher> PartialEq for HashSet { fn eq(&self, other: &HashSet) -> bool { if self.len() != other.len() { return false; } @@ -1691,7 +1691,7 @@ mod test_map { local_data_key!(drop_vector: RefCell>) - #[deriving(Hash, Eq, TotalEq)] + #[deriving(Hash, PartialEq, TotalEq)] struct Dropable { k: uint } diff --git a/src/libcollections/lru_cache.rs b/src/libcollections/lru_cache.rs index 7db3525a36ece..7c8513bac3293 100644 --- a/src/libcollections/lru_cache.rs +++ b/src/libcollections/lru_cache.rs @@ -67,7 +67,7 @@ impl> Hash for KeyRef { } } -impl Eq for KeyRef { +impl PartialEq for KeyRef { fn eq(&self, other: &KeyRef) -> bool { unsafe{ (*self.k).eq(&*other.k) } } @@ -253,7 +253,7 @@ impl Drop for LruCache { mod tests { use super::LruCache; - fn assert_opt_eq(opt: Option<&V>, v: V) { + fn assert_opt_eq(opt: Option<&V>, v: V) { assert!(opt.is_some()); assert!(opt.unwrap() == &v); } diff --git a/src/libcollections/ringbuf.rs b/src/libcollections/ringbuf.rs index f45c9685be58b..0ca4177b7aa82 100644 --- a/src/libcollections/ringbuf.rs +++ b/src/libcollections/ringbuf.rs @@ -364,7 +364,7 @@ fn raw_index(lo: uint, len: uint, index: uint) -> uint { } } -impl Eq for RingBuf { +impl PartialEq for RingBuf { fn eq(&self, other: &RingBuf) -> bool { self.nelts == other.nelts && self.iter().zip(other.iter()).all(|(a, b)| a.eq(b)) @@ -397,7 +397,7 @@ mod tests { use self::test::Bencher; use deque::Deque; use std::clone::Clone; - use std::cmp::Eq; + use std::cmp::PartialEq; use std::fmt::Show; use super::RingBuf; @@ -483,7 +483,7 @@ mod tests { } #[cfg(test)] - fn test_parameterized(a: T, b: T, c: T, d: T) { + fn test_parameterized(a: T, b: T, c: T, d: T) { let mut deq = RingBuf::new(); assert_eq!(deq.len(), 0); deq.push_front(a.clone()); @@ -568,21 +568,21 @@ mod tests { }) } - #[deriving(Clone, Eq, Show)] + #[deriving(Clone, PartialEq, Show)] enum Taggy { One(int), Two(int, int), Three(int, int, int), } - #[deriving(Clone, Eq, Show)] + #[deriving(Clone, PartialEq, Show)] enum Taggypar { Onepar(int), Twopar(int, int), Threepar(int, int, int), } - #[deriving(Clone, Eq, Show)] + #[deriving(Clone, PartialEq, Show)] struct RecCy { x: int, y: int, diff --git a/src/libcollections/treemap.rs b/src/libcollections/treemap.rs index 793b562b582f3..98816003a3768 100644 --- a/src/libcollections/treemap.rs +++ b/src/libcollections/treemap.rs @@ -43,7 +43,7 @@ pub struct TreeMap { length: uint } -impl Eq for TreeMap { +impl PartialEq for TreeMap { fn eq(&self, other: &TreeMap) -> bool { self.len() == other.len() && self.iter().zip(other.iter()).all(|(a, b)| a == b) @@ -51,7 +51,7 @@ impl Eq for TreeMap { } // Lexicographical comparison -fn lt(a: &TreeMap, +fn lt(a: &TreeMap, b: &TreeMap) -> bool { // the Zip iterator is as long as the shortest of a and b. for ((key_a, value_a), (key_b, value_b)) in a.iter().zip(b.iter()) { @@ -64,7 +64,7 @@ fn lt(a: &TreeMap, a.len() < b.len() } -impl Ord for TreeMap { +impl PartialOrd for TreeMap { #[inline] fn lt(&self, other: &TreeMap) -> bool { lt(self, other) } } @@ -552,12 +552,12 @@ pub struct TreeSet { map: TreeMap } -impl Eq for TreeSet { +impl PartialEq for TreeSet { #[inline] fn eq(&self, other: &TreeSet) -> bool { self.map == other.map } } -impl Ord for TreeSet { +impl PartialOrd for TreeSet { #[inline] fn lt(&self, other: &TreeSet) -> bool { self.map < other.map } } @@ -1070,7 +1070,7 @@ mod test_treemap { assert_eq!(m.find(&k1), Some(&v1)); } - fn check_equal(ctrl: &[(K, V)], + fn check_equal(ctrl: &[(K, V)], map: &TreeMap) { assert_eq!(ctrl.is_empty(), map.is_empty()); for x in ctrl.iter() { diff --git a/src/libcore/any.rs b/src/libcore/any.rs index f463c194424da..2a03eacf13cb3 100644 --- a/src/libcore/any.rs +++ b/src/libcore/any.rs @@ -121,7 +121,7 @@ mod tests { use realstd::owned::{Box, AnyOwnExt}; use realstd::str::Str; - #[deriving(Eq, Show)] + #[deriving(PartialEq, Show)] struct Test; static TEST: &'static str = "Test"; diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs index e03e24e606d81..f6c438698b488 100644 --- a/src/libcore/cell.rs +++ b/src/libcore/cell.rs @@ -160,7 +160,7 @@ // FIXME: Relationship to Atomic types and RWLock use clone::Clone; -use cmp::Eq; +use cmp::PartialEq; use kinds::{marker, Copy}; use ops::{Deref, DerefMut, Drop}; use option::{None, Option, Some}; @@ -202,7 +202,7 @@ impl Clone for Cell { } } -impl Eq for Cell { +impl PartialEq for Cell { fn eq(&self, other: &Cell) -> bool { self.get() == other.get() } @@ -308,7 +308,7 @@ impl Clone for RefCell { } } -impl Eq for RefCell { +impl PartialEq for RefCell { fn eq(&self, other: &RefCell) -> bool { *self.borrow() == *other.borrow() } diff --git a/src/libcore/cmp.rs b/src/libcore/cmp.rs index 32fc3331fa2f7..5bf15ff18f005 100644 --- a/src/libcore/cmp.rs +++ b/src/libcore/cmp.rs @@ -8,14 +8,14 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -//! Defines the `Ord` and `Eq` comparison traits. +//! Defines the `PartialOrd` and `PartialEq` comparison traits. //! -//! This module defines both `Ord` and `Eq` traits which are used by the +//! This module defines both `PartialOrd` and `PartialEq` traits which are used by the //! compiler to implement comparison operators. Rust programs may implement -//!`Ord` to overload the `<`, `<=`, `>`, and `>=` operators, and may implement -//! `Eq` to overload the `==` and `!=` operators. +//!`PartialOrd` to overload the `<`, `<=`, `>`, and `>=` operators, and may implement +//! `PartialEq` to overload the `==` and `!=` operators. //! -//! For example, to define a type with a customized definition for the Eq +//! For example, to define a type with a customized definition for the PartialEq //! operators, you could do the following: //! //! ```rust @@ -24,8 +24,8 @@ //! num : int //! } //! -//! // Our implementation of `Eq` to support `==` and `!=`. -//! impl Eq for SketchyNum { +//! // Our implementation of `PartialEq` to support `==` and `!=`. +//! impl PartialEq for SketchyNum { //! // Our custom eq allows numbers which are near each other to be equal! :D //! fn eq(&self, other: &SketchyNum) -> bool { //! (self.num - other.num).abs() < 5 @@ -37,9 +37,6 @@ //! assert!(SketchyNum {num: 25} != SketchyNum {num: 57}); //! ``` -pub use PartialEq = cmp::Eq; -pub use PartialOrd = cmp::Ord; - /// Trait for values that can be compared for equality and inequality. /// /// This trait allows partial equality, where types can be unordered instead of @@ -47,13 +44,13 @@ pub use PartialOrd = cmp::Ord; /// types `a == b` and `a != b` will both evaluate to false if either `a` or /// `b` is NaN (cf. IEEE 754-2008 section 5.11). /// -/// Eq only requires the `eq` method to be implemented; `ne` is its negation by +/// PartialEq only requires the `eq` method to be implemented; `ne` is its negation by /// default. /// /// Eventually, this will be implemented by default for types that implement /// `TotalEq`. #[lang="eq"] -pub trait Eq { +pub trait PartialEq { /// This method tests for `self` and `other` values to be equal, and is used by `==`. fn eq(&self, other: &Self) -> bool; @@ -71,7 +68,7 @@ pub trait Eq { /// - reflexive: `a == a`; /// - symmetric: `a == b` implies `b == a`; and /// - transitive: `a == b` and `b == c` implies `a == c`. -pub trait TotalEq: Eq { +pub trait TotalEq: PartialEq { // FIXME #13101: this method is used solely by #[deriving] to // assert that every component of a type implements #[deriving] // itself, the current deriving infrastructure means doing this @@ -85,7 +82,7 @@ pub trait TotalEq: Eq { } /// An ordering is, e.g, a result of a comparison between two values. -#[deriving(Clone, Eq, Show)] +#[deriving(Clone, PartialEq, Show)] pub enum Ordering { /// An ordering where a compared value is less [than another]. Less = -1, @@ -104,7 +101,7 @@ pub enum Ordering { /// true; and /// - transitive, `a < b` and `b < c` implies `a < c`. The same must hold for /// both `==` and `>`. -pub trait TotalOrd: TotalEq + Ord { +pub trait TotalOrd: TotalEq + PartialOrd { /// This method returns an ordering between `self` and `other` values. /// /// By convention, `self.cmp(&other)` returns the ordering matching @@ -127,7 +124,7 @@ impl TotalOrd for Ordering { } } -impl Ord for Ordering { +impl PartialOrd for Ordering { #[inline] fn lt(&self, other: &Ordering) -> bool { (*self as int) < (*other as int) } } @@ -147,14 +144,14 @@ pub fn lexical_ordering(o1: Ordering, o2: Ordering) -> Ordering { /// Trait for values that can be compared for a sort-order. /// -/// Ord only requires implementation of the `lt` method, +/// PartialOrd only requires implementation of the `lt` method, /// with the others generated from default implementations. /// /// However it remains possible to implement the others separately, /// for compatibility with floating-point NaN semantics /// (cf. IEEE 754-2008 section 5.11). #[lang="ord"] -pub trait Ord: Eq { +pub trait PartialOrd: PartialEq { /// This method tests less than (for `self` and `other`) and is used by the `<` operator. fn lt(&self, other: &Self) -> bool; @@ -192,14 +189,15 @@ pub fn max(v1: T, v2: T) -> T { if v1 > v2 { v1 } else { v2 } } -// Implementation of Eq, TotalEq, Ord and TotalOrd for primitive types +// Implementation of PartialEq, TotalEq, PartialOrd and TotalOrd for primitive types #[cfg(not(test))] mod impls { - use cmp::{Ord, TotalOrd, Eq, TotalEq, Ordering, Less, Greater, Equal}; + use cmp::{PartialOrd, TotalOrd, PartialEq, TotalEq, Ordering, + Less, Greater, Equal}; macro_rules! eq_impl( ($($t:ty)*) => ($( - impl Eq for $t { + impl PartialEq for $t { #[inline] fn eq(&self, other: &$t) -> bool { (*self) == (*other) } #[inline] @@ -208,7 +206,7 @@ mod impls { )*) ) - impl Eq for () { + impl PartialEq for () { #[inline] fn eq(&self, _other: &()) -> bool { true } #[inline] @@ -227,7 +225,7 @@ mod impls { macro_rules! ord_impl( ($($t:ty)*) => ($( - impl Ord for $t { + impl PartialOrd for $t { #[inline] fn lt(&self, other: &$t) -> bool { (*self) < (*other) } #[inline] @@ -240,12 +238,12 @@ mod impls { )*) ) - impl Ord for () { + impl PartialOrd for () { #[inline] fn lt(&self, _other: &()) -> bool { false } } - impl Ord for bool { + impl PartialOrd for bool { #[inline] fn lt(&self, other: &bool) -> bool { (*self as u8) < (*other as u8) @@ -282,13 +280,13 @@ mod impls { totalord_impl!(char uint u8 u16 u32 u64 int i8 i16 i32 i64) // & pointers - impl<'a, T: Eq> Eq for &'a T { + impl<'a, T: PartialEq> PartialEq for &'a T { #[inline] fn eq(&self, other: & &'a T) -> bool { *(*self) == *(*other) } #[inline] fn ne(&self, other: & &'a T) -> bool { *(*self) != *(*other) } } - impl<'a, T: Ord> Ord for &'a T { + impl<'a, T: PartialOrd> PartialOrd for &'a T { #[inline] fn lt(&self, other: & &'a T) -> bool { *(*self) < *(*other) } #[inline] @@ -305,13 +303,13 @@ mod impls { impl<'a, T: TotalEq> TotalEq for &'a T {} // &mut pointers - impl<'a, T: Eq> Eq for &'a mut T { + impl<'a, T: PartialEq> PartialEq for &'a mut T { #[inline] fn eq(&self, other: &&'a mut T) -> bool { **self == *(*other) } #[inline] fn ne(&self, other: &&'a mut T) -> bool { **self != *(*other) } } - impl<'a, T: Ord> Ord for &'a mut T { + impl<'a, T: PartialOrd> PartialOrd for &'a mut T { #[inline] fn lt(&self, other: &&'a mut T) -> bool { **self < **other } #[inline] @@ -328,13 +326,13 @@ mod impls { impl<'a, T: TotalEq> TotalEq for &'a mut T {} // @ pointers - impl Eq for @T { + impl PartialEq for @T { #[inline] fn eq(&self, other: &@T) -> bool { *(*self) == *(*other) } #[inline] fn ne(&self, other: &@T) -> bool { *(*self) != *(*other) } } - impl Ord for @T { + impl PartialOrd for @T { #[inline] fn lt(&self, other: &@T) -> bool { *(*self) < *(*other) } #[inline] @@ -400,8 +398,8 @@ mod test { num : int } - // Our implementation of `Eq` to support `==` and `!=`. - impl Eq for SketchyNum { + // Our implementation of `PartialEq` to support `==` and `!=`. + impl PartialEq for SketchyNum { // Our custom eq allows numbers which are near each other to be equal! :D fn eq(&self, other: &SketchyNum) -> bool { (self.num - other.num).abs() < 5 diff --git a/src/libcore/fmt/num.rs b/src/libcore/fmt/num.rs index 7ad78df2fe8ce..890733dc229af 100644 --- a/src/libcore/fmt/num.rs +++ b/src/libcore/fmt/num.rs @@ -65,23 +65,23 @@ trait GenericRadix { } /// A binary (base 2) radix -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] struct Binary; /// An octal (base 8) radix -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] struct Octal; /// A decimal (base 10) radix -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] struct Decimal; /// A hexadecimal (base 16) radix, formatted with lower-case characters -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] struct LowerHex; /// A hexadecimal (base 16) radix, formatted with upper-case characters -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] pub struct UpperHex; macro_rules! radix { @@ -108,7 +108,7 @@ radix!(UpperHex, 16, "0x", x @ 0 .. 9 => '0' as u8 + x, x @ 10 ..15 => 'A' as u8 + (x - 10)) /// A radix with in the range of `2..36`. -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] pub struct Radix { base: u8, } diff --git a/src/libcore/fmt/rt.rs b/src/libcore/fmt/rt.rs index 00c8661c8e383..f2e1476cc1c3a 100644 --- a/src/libcore/fmt/rt.rs +++ b/src/libcore/fmt/rt.rs @@ -40,7 +40,7 @@ pub struct FormatSpec { pub width: Count, } -#[deriving(Eq)] +#[deriving(PartialEq)] pub enum Alignment { AlignLeft, AlignRight, diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs index 095c48c818bf6..b36735713af70 100644 --- a/src/libcore/intrinsics.rs +++ b/src/libcore/intrinsics.rs @@ -550,7 +550,7 @@ extern "rust-intrinsic" { /// `TypeId` represents a globally unique identifier for a type #[lang="type_id"] // This needs to be kept in lockstep with the code in trans/intrinsic.rs and // middle/lang_items.rs -#[deriving(Eq, TotalEq, Show)] +#[deriving(PartialEq, TotalEq, Show)] #[cfg(not(test))] pub struct TypeId { t: u64, diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index e58ef49c17fa6..e18244280bf99 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -68,7 +68,7 @@ use cmp; use num::{Zero, One, CheckedAdd, CheckedSub, Saturating, ToPrimitive, Int}; use option::{Option, Some, None}; use ops::{Add, Mul, Sub}; -use cmp::{Eq, Ord, TotalOrd}; +use cmp::{PartialEq, PartialOrd, TotalOrd}; use clone::Clone; use uint; use mem; @@ -847,7 +847,7 @@ impl + One, T: Iterator> MultiplicativeIterator for T { } /// A trait for iterators over elements which can be compared to one another. -/// The type of each element must ascribe to the `Ord` trait. +/// The type of each element must ascribe to the `PartialOrd` trait. pub trait OrdIterator { /// Consumes the entire iterator to return the maximum element. /// @@ -971,7 +971,7 @@ impl> OrdIterator for T { } /// `MinMaxResult` is an enum returned by `min_max`. See `OrdIterator::min_max` for more detail. -#[deriving(Clone, Eq, Show)] +#[deriving(Clone, PartialEq, Show)] pub enum MinMaxResult { /// Empty iterator NoElements, @@ -1945,12 +1945,12 @@ pub struct Range { /// Return an iterator over the range [start, stop) #[inline] -pub fn range + Ord + Clone + One>(start: A, stop: A) -> Range { +pub fn range + PartialOrd + Clone + One>(start: A, stop: A) -> Range { Range{state: start, stop: stop, one: One::one()} } // FIXME: #10414: Unfortunate type bound -impl + Ord + Clone + ToPrimitive> Iterator for Range { +impl + PartialOrd + Clone + ToPrimitive> Iterator for Range { #[inline] fn next(&mut self) -> Option { if self.state < self.stop { @@ -1997,7 +1997,7 @@ impl + Ord + Clone + ToPrimitive> Iterator for Range { /// `Int` is required to ensure the range will be the same regardless of /// the direction it is consumed. -impl DoubleEndedIterator for Range { +impl DoubleEndedIterator for Range { #[inline] fn next_back(&mut self) -> Option { if self.stop > self.state { @@ -2018,12 +2018,12 @@ pub struct RangeInclusive { /// Return an iterator over the range [start, stop] #[inline] -pub fn range_inclusive + Ord + Clone + One>(start: A, stop: A) +pub fn range_inclusive + PartialOrd + Clone + One>(start: A, stop: A) -> RangeInclusive { RangeInclusive{range: range(start, stop), done: false} } -impl + Ord + Clone + ToPrimitive> Iterator for RangeInclusive { +impl + PartialOrd + Clone + ToPrimitive> Iterator for RangeInclusive { #[inline] fn next(&mut self) -> Option { match self.range.next() { @@ -2055,7 +2055,7 @@ impl + Ord + Clone + ToPrimitive> Iterator for RangeInclusive } } -impl + Int + Ord + Clone + ToPrimitive> DoubleEndedIterator +impl + Int + PartialOrd + Clone + ToPrimitive> DoubleEndedIterator for RangeInclusive { #[inline] fn next_back(&mut self) -> Option { @@ -2083,12 +2083,12 @@ pub struct RangeStep { /// Return an iterator over the range [start, stop) by `step`. It handles overflow by stopping. #[inline] -pub fn range_step(start: A, stop: A, step: A) -> RangeStep { +pub fn range_step(start: A, stop: A, step: A) -> RangeStep { let rev = step < Zero::zero(); RangeStep{state: start, stop: stop, step: step, rev: rev} } -impl Iterator for RangeStep { +impl Iterator for RangeStep { #[inline] fn next(&mut self) -> Option { if (self.rev && self.state > self.stop) || (!self.rev && self.state < self.stop) { @@ -2116,13 +2116,13 @@ pub struct RangeStepInclusive { /// Return an iterator over the range [start, stop] by `step`. It handles overflow by stopping. #[inline] -pub fn range_step_inclusive(start: A, stop: A, +pub fn range_step_inclusive(start: A, stop: A, step: A) -> RangeStepInclusive { let rev = step < Zero::zero(); RangeStepInclusive{state: start, stop: stop, step: step, rev: rev, done: false} } -impl Iterator for RangeStepInclusive { +impl Iterator for RangeStepInclusive { #[inline] fn next(&mut self) -> Option { if !self.done && ((self.rev && self.state >= self.stop) || @@ -2175,13 +2175,13 @@ impl RandomAccessIterator for Repeat { /// Functions for lexicographical ordering of sequences. /// /// Lexicographical ordering through `<`, `<=`, `>=`, `>` requires -/// that the elements implement both `Eq` and `Ord`. +/// that the elements implement both `PartialEq` and `PartialOrd`. /// /// If two sequences are equal up until the point where one ends, /// the shorter sequence compares less. pub mod order { use cmp; - use cmp::{TotalEq, TotalOrd, Ord, Eq}; + use cmp::{TotalEq, TotalOrd, PartialOrd, PartialEq}; use option::{Some, None}; use super::Iterator; @@ -2211,8 +2211,8 @@ pub mod order { } } - /// Compare `a` and `b` for equality (Using partial equality, `Eq`) - pub fn eq, S: Iterator>(mut a: T, mut b: S) -> bool { + /// Compare `a` and `b` for equality (Using partial equality, `PartialEq`) + pub fn eq, S: Iterator>(mut a: T, mut b: S) -> bool { loop { match (a.next(), b.next()) { (None, None) => return true, @@ -2222,8 +2222,8 @@ pub mod order { } } - /// Compare `a` and `b` for nonequality (Using partial equality, `Eq`) - pub fn ne, S: Iterator>(mut a: T, mut b: S) -> bool { + /// Compare `a` and `b` for nonequality (Using partial equality, `PartialEq`) + pub fn ne, S: Iterator>(mut a: T, mut b: S) -> bool { loop { match (a.next(), b.next()) { (None, None) => return false, @@ -2233,8 +2233,8 @@ pub mod order { } } - /// Return `a` < `b` lexicographically (Using partial order, `Ord`) - pub fn lt, S: Iterator>(mut a: T, mut b: S) -> bool { + /// Return `a` < `b` lexicographically (Using partial order, `PartialOrd`) + pub fn lt, S: Iterator>(mut a: T, mut b: S) -> bool { loop { match (a.next(), b.next()) { (None, None) => return false, @@ -2245,8 +2245,8 @@ pub mod order { } } - /// Return `a` <= `b` lexicographically (Using partial order, `Ord`) - pub fn le, S: Iterator>(mut a: T, mut b: S) -> bool { + /// Return `a` <= `b` lexicographically (Using partial order, `PartialOrd`) + pub fn le, S: Iterator>(mut a: T, mut b: S) -> bool { loop { match (a.next(), b.next()) { (None, None) => return true, @@ -2257,8 +2257,8 @@ pub mod order { } } - /// Return `a` > `b` lexicographically (Using partial order, `Ord`) - pub fn gt, S: Iterator>(mut a: T, mut b: S) -> bool { + /// Return `a` > `b` lexicographically (Using partial order, `PartialOrd`) + pub fn gt, S: Iterator>(mut a: T, mut b: S) -> bool { loop { match (a.next(), b.next()) { (None, None) => return false, @@ -2269,8 +2269,8 @@ pub mod order { } } - /// Return `a` >= `b` lexicographically (Using partial order, `Ord`) - pub fn ge, S: Iterator>(mut a: T, mut b: S) -> bool { + /// Return `a` >= `b` lexicographically (Using partial order, `PartialOrd`) + pub fn ge, S: Iterator>(mut a: T, mut b: S) -> bool { loop { match (a.next(), b.next()) { (None, None) => return true, @@ -2849,7 +2849,7 @@ mod tests { #[cfg(test)] - fn check_randacc_iter>(a: T, len: uint) + fn check_randacc_iter>(a: T, len: uint) { let mut b = a.clone(); assert_eq!(len, b.indexable()); @@ -3009,13 +3009,13 @@ mod tests { } } - impl Eq for Foo { + impl PartialEq for Foo { fn eq(&self, _: &Foo) -> bool { true } } - impl Ord for Foo { + impl PartialOrd for Foo { fn lt(&self, _: &Foo) -> bool { false } diff --git a/src/libcore/kinds.rs b/src/libcore/kinds.rs index 770aa7547ff94..40b716181e6fc 100644 --- a/src/libcore/kinds.rs +++ b/src/libcore/kinds.rs @@ -133,7 +133,7 @@ pub mod marker { /// (for example, `S<&'static int>` is a subtype of `S<&'a int>` /// for some lifetime `'a`, but not the other way around). #[lang="covariant_type"] - #[deriving(Eq,Clone)] + #[deriving(PartialEq,Clone)] pub struct CovariantType; /// A marker type whose type parameter `T` is considered to be @@ -176,7 +176,7 @@ pub mod marker { /// function requires arguments of type `T`, it must also accept /// arguments of type `U`, hence such a conversion is safe. #[lang="contravariant_type"] - #[deriving(Eq,Clone)] + #[deriving(PartialEq,Clone)] pub struct ContravariantType; /// A marker type whose type parameter `T` is considered to be @@ -201,7 +201,7 @@ pub mod marker { /// never written, but in fact `Cell` uses unsafe code to achieve /// interior mutability. #[lang="invariant_type"] - #[deriving(Eq,Clone)] + #[deriving(PartialEq,Clone)] pub struct InvariantType; /// As `CovariantType`, but for lifetime parameters. Using @@ -221,7 +221,7 @@ pub mod marker { /// For more information about variance, refer to this Wikipedia /// article . #[lang="covariant_lifetime"] - #[deriving(Eq,Clone)] + #[deriving(PartialEq,Clone)] pub struct CovariantLifetime<'a>; /// As `ContravariantType`, but for lifetime parameters. Using @@ -237,7 +237,7 @@ pub mod marker { /// For more information about variance, refer to this Wikipedia /// article . #[lang="contravariant_lifetime"] - #[deriving(Eq,Clone)] + #[deriving(PartialEq,Clone)] pub struct ContravariantLifetime<'a>; /// As `InvariantType`, but for lifetime parameters. Using @@ -248,7 +248,7 @@ pub mod marker { /// and this pointer is itself stored in an inherently mutable /// location (such as a `Cell`). #[lang="invariant_lifetime"] - #[deriving(Eq,Clone)] + #[deriving(PartialEq,Clone)] pub struct InvariantLifetime<'a>; /// A type which is considered "not sendable", meaning that it cannot @@ -256,26 +256,26 @@ pub mod marker { /// typically embedded in other types, such as `Gc`, to ensure that /// their instances remain thread-local. #[lang="no_send_bound"] - #[deriving(Eq,Clone)] + #[deriving(PartialEq,Clone)] pub struct NoSend; /// A type which is considered "not POD", meaning that it is not /// implicitly copyable. This is typically embedded in other types to /// ensure that they are never copied, even if they lack a destructor. #[lang="no_copy_bound"] - #[deriving(Eq,Clone)] + #[deriving(PartialEq,Clone)] pub struct NoCopy; /// A type which is considered "not shareable", meaning that /// its contents are not threadsafe, hence they cannot be /// shared between tasks. #[lang="no_share_bound"] - #[deriving(Eq,Clone)] + #[deriving(PartialEq,Clone)] pub struct NoShare; /// A type which is considered managed by the GC. This is typically /// embedded in other types. #[lang="managed_bound"] - #[deriving(Eq,Clone)] + #[deriving(PartialEq,Clone)] pub struct Managed; } diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index fe3f07c6024e0..a80b20775de4b 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -17,7 +17,7 @@ use {int, i8, i16, i32, i64}; use {uint, u8, u16, u32, u64}; use {f32, f64}; use clone::Clone; -use cmp::{Eq, Ord}; +use cmp::{PartialEq, PartialOrd}; use kinds::Copy; use mem::size_of; use ops::{Add, Sub, Mul, Div, Rem, Neg}; @@ -25,7 +25,7 @@ use ops::{Not, BitAnd, BitOr, BitXor, Shl, Shr}; use option::{Option, Some, None}; /// The base trait for numeric types -pub trait Num: Eq + Zero + One +pub trait Num: PartialEq + Zero + One + Neg + Add + Sub @@ -495,7 +495,7 @@ pub trait Primitive: Copy + Clone + Num + NumCast - + Ord + + PartialOrd + Bounded {} trait_impl!(Primitive for uint u8 u16 u32 u64 int i8 i16 i32 i64 f32 f64) @@ -1043,7 +1043,7 @@ pub trait Saturating { fn saturating_sub(self, v: Self) -> Self; } -impl Saturating for T { +impl Saturating for T { #[inline] fn saturating_add(self, v: T) -> T { match self.checked_add(&v) { @@ -1238,7 +1238,7 @@ pub fn test_num(ten: T, two: T) { } /// Used for representing the classification of floating point numbers -#[deriving(Eq, Show)] +#[deriving(PartialEq, Show)] pub enum FPCategory { /// "Not a Number", often obtained by dividing by zero FPNaN, diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 975736cb40cef..379d14a6e6a75 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -141,14 +141,14 @@ //! } //! ``` -use cmp::{Eq, TotalEq, TotalOrd}; +use cmp::{PartialEq, TotalEq, TotalOrd}; use default::Default; use iter::{Iterator, DoubleEndedIterator, FromIterator, ExactSize}; use mem; use slice; /// The `Option` -#[deriving(Clone, Eq, Ord, TotalEq, TotalOrd, Show)] +#[deriving(Clone, PartialEq, PartialOrd, TotalEq, TotalOrd, Show)] pub enum Option { /// No value None, diff --git a/src/libcore/prelude.rs b/src/libcore/prelude.rs index a8e78e52b12f8..466f981c926c3 100644 --- a/src/libcore/prelude.rs +++ b/src/libcore/prelude.rs @@ -45,7 +45,8 @@ pub use mem::drop; pub use char::Char; pub use clone::Clone; -pub use cmp::{Eq, Ord, TotalEq, TotalOrd, Ordering, Less, Equal, Greater, Equiv}; +pub use cmp::{PartialEq, PartialOrd, TotalEq, TotalOrd}; +pub use cmp::{Ordering, Less, Equal, Greater, Equiv}; pub use container::{Container, Mutable, Map, MutableMap, Set, MutableSet}; pub use iter::{FromIterator, Extendable}; pub use iter::{Iterator, DoubleEndedIterator, RandomAccessIterator, CloneableIterator}; diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index 34596480273c3..442838b3d08e6 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -93,7 +93,7 @@ use intrinsics; use iter::{range, Iterator}; use option::{Some, None, Option}; -#[cfg(not(test))] use cmp::{Eq, TotalEq, Ord, Equiv}; +#[cfg(not(test))] use cmp::{PartialEq, TotalEq, PartialOrd, Equiv}; /// Return the offset of the first null pointer in `buf`. #[inline] @@ -386,7 +386,7 @@ impl RawPtr for *mut T { // Equality for pointers #[cfg(not(test))] -impl Eq for *T { +impl PartialEq for *T { #[inline] fn eq(&self, other: &*T) -> bool { *self == *other @@ -399,7 +399,7 @@ impl Eq for *T { impl TotalEq for *T {} #[cfg(not(test))] -impl Eq for *mut T { +impl PartialEq for *mut T { #[inline] fn eq(&self, other: &*mut T) -> bool { *self == *other @@ -430,9 +430,9 @@ impl Equiv<*T> for *mut T { #[cfg(not(test))] mod externfnpointers { use mem; - use cmp::Eq; + use cmp::PartialEq; - impl<_R> Eq for extern "C" fn() -> _R { + impl<_R> PartialEq for extern "C" fn() -> _R { #[inline] fn eq(&self, other: &extern "C" fn() -> _R) -> bool { let self_: *() = unsafe { mem::transmute(*self) }; @@ -442,7 +442,7 @@ mod externfnpointers { } macro_rules! fnptreq( ($($p:ident),*) => { - impl<_R,$($p),*> Eq for extern "C" fn($($p),*) -> _R { + impl<_R,$($p),*> PartialEq for extern "C" fn($($p),*) -> _R { #[inline] fn eq(&self, other: &extern "C" fn($($p),*) -> _R) -> bool { let self_: *() = unsafe { mem::transmute(*self) }; @@ -461,13 +461,13 @@ mod externfnpointers { // Comparison for pointers #[cfg(not(test))] -impl Ord for *T { +impl PartialOrd for *T { #[inline] fn lt(&self, other: &*T) -> bool { *self < *other } } #[cfg(not(test))] -impl Ord for *mut T { +impl PartialOrd for *mut T { #[inline] fn lt(&self, other: &*mut T) -> bool { *self < *other } } diff --git a/src/libcore/result.rs b/src/libcore/result.rs index fd51ede204ff1..f3ec95d958247 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -275,7 +275,7 @@ //! will not resume after failure, that failure is catastrophic. use clone::Clone; -use cmp::Eq; +use cmp::PartialEq; use std::fmt::Show; use iter::{Iterator, FromIterator}; use option::{None, Option, Some}; @@ -283,7 +283,7 @@ use option::{None, Option, Some}; /// `Result` is a type that represents either success (`Ok`) or failure (`Err`). /// /// See the [`std::result`](index.html) module documentation for details. -#[deriving(Clone, Eq, Ord, TotalEq, TotalOrd, Show)] +#[deriving(Clone, PartialEq, PartialOrd, TotalEq, TotalOrd, Show)] #[must_use] pub enum Result { /// Contains the success value diff --git a/src/libcore/slice.rs b/src/libcore/slice.rs index 795dd389958ee..9771d766e65fe 100644 --- a/src/libcore/slice.rs +++ b/src/libcore/slice.rs @@ -15,7 +15,7 @@ use mem::transmute; use clone::Clone; use container::Container; -use cmp::{Eq, TotalOrd, Ordering, Less, Equal, Greater}; +use cmp::{PartialEq, TotalOrd, Ordering, Less, Equal, Greater}; use cmp; use default::Default; use iter::*; @@ -249,11 +249,11 @@ impl<'a, T> RandomAccessIterator<&'a [T]> for Chunks<'a, T> { pub mod traits { use super::*; - use cmp::{Eq, Ord, TotalEq, TotalOrd, Ordering, Equiv}; + use cmp::{PartialEq, PartialOrd, TotalEq, TotalOrd, Ordering, Equiv}; use iter::{order, Iterator}; use container::Container; - impl<'a,T:Eq> Eq for &'a [T] { + impl<'a,T:PartialEq> PartialEq for &'a [T] { fn eq(&self, other: & &'a [T]) -> bool { self.len() == other.len() && order::eq(self.iter(), other.iter()) @@ -264,7 +264,7 @@ pub mod traits { } } - impl Eq for ~[T] { + impl PartialEq for ~[T] { #[inline] fn eq(&self, other: &~[T]) -> bool { self.as_slice() == *other } #[inline] @@ -275,12 +275,12 @@ pub mod traits { impl TotalEq for ~[T] {} - impl<'a,T:Eq, V: Vector> Equiv for &'a [T] { + impl<'a,T:PartialEq, V: Vector> Equiv for &'a [T] { #[inline] fn equiv(&self, other: &V) -> bool { self.as_slice() == other.as_slice() } } - impl<'a,T:Eq, V: Vector> Equiv for ~[T] { + impl<'a,T:PartialEq, V: Vector> Equiv for ~[T] { #[inline] fn equiv(&self, other: &V) -> bool { self.as_slice() == other.as_slice() } } @@ -296,7 +296,7 @@ pub mod traits { fn cmp(&self, other: &~[T]) -> Ordering { self.as_slice().cmp(&other.as_slice()) } } - impl<'a, T: Ord> Ord for &'a [T] { + impl<'a, T: PartialOrd> PartialOrd for &'a [T] { fn lt(&self, other: & &'a [T]) -> bool { order::lt(self.iter(), other.iter()) } @@ -314,7 +314,7 @@ pub mod traits { } } - impl Ord for ~[T] { + impl PartialOrd for ~[T] { #[inline] fn lt(&self, other: &~[T]) -> bool { self.as_slice() < other.as_slice() } #[inline] @@ -692,8 +692,8 @@ impl<'a,T> ImmutableVector<'a, T> for &'a [T] { } } -/// Extension methods for vectors contain `Eq` elements. -pub trait ImmutableEqVector { +/// Extension methods for vectors contain `PartialEq` elements. +pub trait ImmutableEqVector { /// Find the first index containing a matching value fn position_elem(&self, t: &T) -> Option; @@ -710,7 +710,7 @@ pub trait ImmutableEqVector { fn ends_with(&self, needle: &[T]) -> bool; } -impl<'a,T:Eq> ImmutableEqVector for &'a [T] { +impl<'a,T:PartialEq> ImmutableEqVector for &'a [T] { #[inline] fn position_elem(&self, x: &T) -> Option { self.iter().position(|y| *x == *y) diff --git a/src/libcore/str.rs b/src/libcore/str.rs index 8b8ddbe847c01..a19e720446b44 100644 --- a/src/libcore/str.rs +++ b/src/libcore/str.rs @@ -16,7 +16,7 @@ use mem; use char; use clone::Clone; use cmp; -use cmp::{Eq, TotalEq}; +use cmp::{PartialEq, TotalEq}; use container::Container; use default::Default; use iter::{Filter, Map, Iterator}; @@ -696,7 +696,7 @@ pub struct Utf16Items<'a> { iter: slice::Items<'a, u16> } /// The possibilities for values decoded from a `u16` stream. -#[deriving(Eq, TotalEq, Clone, Show)] +#[deriving(PartialEq, TotalEq, Clone, Show)] pub enum Utf16Item { /// A valid codepoint. ScalarValue(char), @@ -930,7 +930,7 @@ Section: Trait implementations #[allow(missing_doc)] pub mod traits { use container::Container; - use cmp::{TotalOrd, Ordering, Less, Equal, Greater, Eq, Ord, Equiv, TotalEq}; + use cmp::{TotalOrd, Ordering, Less, Equal, Greater, PartialEq, PartialOrd, Equiv, TotalEq}; use iter::Iterator; use option::{Some, None}; use str::{Str, StrSlice, eq_slice}; @@ -950,7 +950,7 @@ pub mod traits { } } - impl<'a> Eq for &'a str { + impl<'a> PartialEq for &'a str { #[inline] fn eq(&self, other: & &'a str) -> bool { eq_slice((*self), (*other)) @@ -961,7 +961,7 @@ pub mod traits { impl<'a> TotalEq for &'a str {} - impl<'a> Ord for &'a str { + impl<'a> PartialOrd for &'a str { #[inline] fn lt(&self, other: & &'a str) -> bool { self.cmp(other) == Less } } diff --git a/src/libcore/tuple.rs b/src/libcore/tuple.rs index edcb37dbb64c2..7639700eac9aa 100644 --- a/src/libcore/tuple.rs +++ b/src/libcore/tuple.rs @@ -27,9 +27,9 @@ //! traits, then a tuple itself also implements it. //! //! * `Clone` -//! * `Eq` +//! * `PartialEq` //! * `TotalEq` -//! * `Ord` +//! * `PartialOrd` //! * `TotalOrd` //! * `Default` //! @@ -109,7 +109,7 @@ macro_rules! tuple_impls { } #[cfg(not(test))] - impl<$($T:Eq),+> Eq for ($($T,)+) { + impl<$($T:PartialEq),+> PartialEq for ($($T,)+) { #[inline] fn eq(&self, other: &($($T,)+)) -> bool { $(*self.$refN() == *other.$refN())&&+ @@ -124,7 +124,7 @@ macro_rules! tuple_impls { impl<$($T:TotalEq),+> TotalEq for ($($T,)+) {} #[cfg(not(test))] - impl<$($T:Ord + Eq),+> Ord for ($($T,)+) { + impl<$($T:PartialOrd + PartialEq),+> PartialOrd for ($($T,)+) { #[inline] fn lt(&self, other: &($($T,)+)) -> bool { lexical_ord!(lt, $(self.$refN(), other.$refN()),+) @@ -335,13 +335,13 @@ mod tests { let nan = 0.0/0.0; - // Eq + // PartialEq assert_eq!(small, small); assert_eq!(big, big); assert!(small != big); assert!(big != small); - // Ord + // PartialOrd assert!(small < big); assert!(!(small < small)); assert!(!(big < small)); diff --git a/src/libfmt_macros/lib.rs b/src/libfmt_macros/lib.rs index 5300374333b2e..bcdeb2bf329dd 100644 --- a/src/libfmt_macros/lib.rs +++ b/src/libfmt_macros/lib.rs @@ -26,7 +26,7 @@ use std::str; /// A piece is a portion of the format string which represents the next part /// to emit. These are emitted as a stream by the `Parser` class. -#[deriving(Eq)] +#[deriving(PartialEq)] pub enum Piece<'a> { /// A literal string which should directly be emitted String(&'a str), @@ -39,7 +39,7 @@ pub enum Piece<'a> { } /// Representation of an argument specification. -#[deriving(Eq)] +#[deriving(PartialEq)] pub struct Argument<'a> { /// Where to find this argument pub position: Position<'a>, @@ -50,7 +50,7 @@ pub struct Argument<'a> { } /// Specification for the formatting of an argument in the format string. -#[deriving(Eq)] +#[deriving(PartialEq)] pub struct FormatSpec<'a> { /// Optionally specified character to fill alignment with pub fill: Option, @@ -69,7 +69,7 @@ pub struct FormatSpec<'a> { } /// Enum describing where an argument for a format can be located. -#[deriving(Eq)] +#[deriving(PartialEq)] pub enum Position<'a> { /// The argument will be in the next position. This is the default. ArgumentNext, @@ -80,7 +80,7 @@ pub enum Position<'a> { } /// Enum of alignments which are supported. -#[deriving(Eq)] +#[deriving(PartialEq)] pub enum Alignment { /// The value will be aligned to the left. AlignLeft, @@ -92,7 +92,7 @@ pub enum Alignment { /// Various flags which can be applied to format strings. The meaning of these /// flags is defined by the formatters themselves. -#[deriving(Eq)] +#[deriving(PartialEq)] pub enum Flag { /// A `+` will be used to denote positive numbers. FlagSignPlus, @@ -108,7 +108,7 @@ pub enum Flag { /// A count is used for the precision and width parameters of an integer, and /// can reference either an argument or a literal integer. -#[deriving(Eq)] +#[deriving(PartialEq)] pub enum Count<'a> { /// The count is specified explicitly. CountIs(uint), @@ -124,7 +124,7 @@ pub enum Count<'a> { /// Enum describing all of the possible methods which the formatting language /// currently supports. -#[deriving(Eq)] +#[deriving(PartialEq)] pub enum Method<'a> { /// A plural method selects on an integer over a list of either integer or /// keyword-defined clauses. The meaning of the keywords is defined by the @@ -146,7 +146,7 @@ pub enum Method<'a> { } /// A selector for what pluralization a plural method should take -#[deriving(Eq, TotalEq, Hash)] +#[deriving(PartialEq, TotalEq, Hash)] pub enum PluralSelector { /// One of the plural keywords should be used Keyword(PluralKeyword), @@ -155,7 +155,7 @@ pub enum PluralSelector { } /// Structure representing one "arm" of the `plural` function. -#[deriving(Eq)] +#[deriving(PartialEq)] pub struct PluralArm<'a> { /// A selector can either be specified by a keyword or with an integer /// literal. @@ -168,7 +168,7 @@ pub struct PluralArm<'a> { /// is specially placed in the `Plural` variant of `Method`. /// /// http://www.icu-project.org/apiref/icu4c/classicu_1_1PluralRules.html -#[deriving(Eq, TotalEq, Hash, Show)] +#[deriving(PartialEq, TotalEq, Hash, Show)] #[allow(missing_doc)] pub enum PluralKeyword { /// The plural form for zero objects. @@ -184,7 +184,7 @@ pub enum PluralKeyword { } /// Structure representing one "arm" of the `select` function. -#[deriving(Eq)] +#[deriving(PartialEq)] pub struct SelectArm<'a> { /// String selector which guards this arm pub selector: &'a str, diff --git a/src/libgetopts/lib.rs b/src/libgetopts/lib.rs index 37c3fe0d2ef8e..0311c3339241a 100644 --- a/src/libgetopts/lib.rs +++ b/src/libgetopts/lib.rs @@ -92,13 +92,13 @@ #[cfg(test)] extern crate debug; #[cfg(test)] #[phase(syntax, link)] extern crate log; -use std::cmp::Eq; +use std::cmp::PartialEq; use std::result::{Err, Ok}; use std::result; use std::string::String; /// Name of an option. Either a string or a single char. -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] pub enum Name { /// A string representing the long name of an option. /// For example: "help" @@ -109,7 +109,7 @@ pub enum Name { } /// Describes whether an option has an argument. -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] pub enum HasArg { /// The option requires an argument. Yes, @@ -120,7 +120,7 @@ pub enum HasArg { } /// Describes how often an option may occur. -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] pub enum Occur { /// The option occurs once. Req, @@ -131,7 +131,7 @@ pub enum Occur { } /// A description of a possible option. -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] pub struct Opt { /// Name of the option pub name: Name, @@ -145,7 +145,7 @@ pub struct Opt { /// One group of options, e.g., both -h and --help, along with /// their shared description and properties. -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] pub struct OptGroup { /// Short Name of the `OptGroup` pub short_name: String, @@ -162,7 +162,7 @@ pub struct OptGroup { } /// Describes wether an option is given at all or has a value. -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] enum Optval { Val(String), Given, @@ -170,7 +170,7 @@ enum Optval { /// The result of checking command line arguments. Contains a vector /// of matches and a vector of free strings. -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] pub struct Matches { /// Options that matched opts: Vec , @@ -183,7 +183,7 @@ pub struct Matches { /// The type returned when the command line does not conform to the /// expected format. Call the `to_err_msg` method to retrieve the /// error as a string. -#[deriving(Clone, Eq, Show)] +#[deriving(Clone, PartialEq, Show)] pub enum Fail_ { /// The option requires an argument but none was passed. ArgumentMissing(String), @@ -198,7 +198,7 @@ pub enum Fail_ { } /// The type of failure that occurred. -#[deriving(Eq)] +#[deriving(PartialEq)] #[allow(missing_doc)] pub enum FailType { ArgumentMissing_, diff --git a/src/libglob/lib.rs b/src/libglob/lib.rs index 1affeadbff1f2..8db8f0dac1022 100644 --- a/src/libglob/lib.rs +++ b/src/libglob/lib.rs @@ -198,12 +198,12 @@ fn list_dir_sorted(path: &Path) -> Option> { /** * A compiled Unix shell style pattern. */ -#[deriving(Clone, Eq, TotalEq, Ord, TotalOrd, Hash, Default)] +#[deriving(Clone, PartialEq, TotalEq, PartialOrd, TotalOrd, Hash, Default)] pub struct Pattern { tokens: Vec, } -#[deriving(Clone, Eq, TotalEq, Ord, TotalOrd, Hash)] +#[deriving(Clone, PartialEq, TotalEq, PartialOrd, TotalOrd, Hash)] enum PatternToken { Char(char), AnyChar, @@ -212,13 +212,13 @@ enum PatternToken { AnyExcept(Vec ) } -#[deriving(Clone, Eq, TotalEq, Ord, TotalOrd, Hash)] +#[deriving(Clone, PartialEq, TotalEq, PartialOrd, TotalOrd, Hash)] enum CharSpecifier { SingleChar(char), CharRange(char, char) } -#[deriving(Eq)] +#[deriving(PartialEq)] enum MatchResult { Match, SubPatternDoesntMatch, @@ -596,7 +596,7 @@ fn chars_eq(a: char, b: char, case_sensitive: bool) -> bool { /** * Configuration options to modify the behaviour of `Pattern::matches_with(..)` */ -#[deriving(Clone, Eq, TotalEq, Ord, TotalOrd, Hash, Default)] +#[deriving(Clone, PartialEq, TotalEq, PartialOrd, TotalOrd, Hash, Default)] pub struct MatchOptions { /** diff --git a/src/libgreen/sched.rs b/src/libgreen/sched.rs index 6dc6ccb790180..e410d2719b147 100644 --- a/src/libgreen/sched.rs +++ b/src/libgreen/sched.rs @@ -105,7 +105,7 @@ pub struct Scheduler { /// An indication of how hard to work on a given operation, the difference /// mainly being whether memory is synchronized or not -#[deriving(Eq)] +#[deriving(PartialEq)] enum EffortLevel { DontTryTooHard, GiveItYourBest diff --git a/src/liblog/lib.rs b/src/liblog/lib.rs index 6f9f3f2e21e03..11df847122b3f 100644 --- a/src/liblog/lib.rs +++ b/src/liblog/lib.rs @@ -172,7 +172,7 @@ struct DefaultLogger { } /// Wraps the log level with fmt implementations. -#[deriving(Eq, Ord)] +#[deriving(PartialEq, PartialOrd)] pub struct LogLevel(pub u32); impl fmt::Show for LogLevel { diff --git a/src/libnum/bigint.rs b/src/libnum/bigint.rs index c6af8ac9b4b89..9264cb541a9b2 100644 --- a/src/libnum/bigint.rs +++ b/src/libnum/bigint.rs @@ -83,7 +83,7 @@ pub struct BigUint { data: Vec } -impl Eq for BigUint { +impl PartialEq for BigUint { #[inline] fn eq(&self, other: &BigUint) -> bool { match self.cmp(other) { Equal => true, _ => false } @@ -91,7 +91,7 @@ impl Eq for BigUint { } impl TotalEq for BigUint {} -impl Ord for BigUint { +impl PartialOrd for BigUint { #[inline] fn lt(&self, other: &BigUint) -> bool { match self.cmp(other) { Less => true, _ => false} @@ -786,7 +786,7 @@ fn get_radix_base(radix: uint) -> (DoubleBigDigit, uint) { } /// A Sign is a `BigInt`'s composing element. -#[deriving(Eq, Ord, TotalEq, TotalOrd, Clone, Show)] +#[deriving(PartialEq, PartialOrd, TotalEq, TotalOrd, Clone, Show)] pub enum Sign { Minus, Zero, Plus } impl Neg for Sign { @@ -808,7 +808,7 @@ pub struct BigInt { data: BigUint } -impl Eq for BigInt { +impl PartialEq for BigInt { #[inline] fn eq(&self, other: &BigInt) -> bool { match self.cmp(other) { Equal => true, _ => false } @@ -817,7 +817,7 @@ impl Eq for BigInt { impl TotalEq for BigInt {} -impl Ord for BigInt { +impl PartialOrd for BigInt { #[inline] fn lt(&self, other: &BigInt) -> bool { match self.cmp(other) { Less => true, _ => false} diff --git a/src/libnum/complex.rs b/src/libnum/complex.rs index 6c5547b28e8cf..7febeb2661658 100644 --- a/src/libnum/complex.rs +++ b/src/libnum/complex.rs @@ -18,7 +18,7 @@ use std::num::{Zero,One,ToStrRadix}; // probably doesn't map to C's _Complex correctly. /// A complex number in Cartesian form. -#[deriving(Eq,Clone)] +#[deriving(PartialEq,Clone)] pub struct Complex { /// Real portion of the complex number pub re: T, @@ -164,7 +164,7 @@ impl One for Complex { } /* string conversions */ -impl fmt::Show for Complex { +impl fmt::Show for Complex { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { if self.im < Zero::zero() { write!(f, "{}-{}i", self.re, -self.im) @@ -174,7 +174,7 @@ impl fmt::Show for Complex { } } -impl ToStrRadix for Complex { +impl ToStrRadix for Complex { fn to_str_radix(&self, radix: uint) -> String { if self.im < Zero::zero() { format!("{}-{}i", diff --git a/src/libnum/lib.rs b/src/libnum/lib.rs index d42c197cab798..29cf769ffc9d8 100644 --- a/src/libnum/lib.rs +++ b/src/libnum/lib.rs @@ -60,7 +60,7 @@ pub mod bigint; pub mod rational; pub mod complex; -pub trait Integer: Num + Ord +pub trait Integer: Num + PartialOrd + Div + Rem { /// Simultaneous truncated integer division and modulus diff --git a/src/libnum/rational.rs b/src/libnum/rational.rs index ba0a571268f44..71a23a23a2679 100644 --- a/src/libnum/rational.rs +++ b/src/libnum/rational.rs @@ -34,7 +34,7 @@ pub type Rational64 = Ratio; /// Alias for arbitrary precision rationals. pub type BigRational = Ratio; -impl +impl Ratio { /// Create a ratio representing the integer `t`. #[inline] @@ -192,14 +192,14 @@ macro_rules! cmp_impl { } }; } -cmp_impl!(impl Eq, eq, ne) -cmp_impl!(impl Ord, lt, gt, le, ge) +cmp_impl!(impl PartialEq, eq, ne) +cmp_impl!(impl PartialOrd, lt, gt, le, ge) cmp_impl!(impl TotalEq, ) cmp_impl!(impl TotalOrd, cmp -> cmp::Ordering) /* Arithmetic */ // a/b * c/d = (a*c)/(b*d) -impl +impl Mul,Ratio> for Ratio { #[inline] fn mul(&self, rhs: &Ratio) -> Ratio { @@ -208,7 +208,7 @@ impl } // (a/b) / (c/d) = (a*d)/(b*c) -impl +impl Div,Ratio> for Ratio { #[inline] fn div(&self, rhs: &Ratio) -> Ratio { @@ -219,7 +219,7 @@ impl // Abstracts the a/b `op` c/d = (a*d `op` b*d) / (b*d) pattern macro_rules! arith_impl { (impl $imp:ident, $method:ident) => { - impl + impl $imp,Ratio> for Ratio { #[inline] fn $method(&self, rhs: &Ratio) -> Ratio { @@ -239,7 +239,7 @@ arith_impl!(impl Sub, sub) // a/b % c/d = (a*d % b*c)/(b*d) arith_impl!(impl Rem, rem) -impl +impl Neg> for Ratio { #[inline] fn neg(&self) -> Ratio { @@ -248,7 +248,7 @@ impl } /* Constants */ -impl +impl Zero for Ratio { #[inline] fn zero() -> Ratio { @@ -261,7 +261,7 @@ impl } } -impl +impl One for Ratio { #[inline] fn one() -> Ratio { @@ -269,7 +269,7 @@ impl } } -impl +impl Num for Ratio {} /* String conversions */ @@ -288,7 +288,7 @@ impl ToStrRadix for Ratio { } } -impl +impl FromStr for Ratio { /// Parses `numer/denom`. fn from_str(s: &str) -> Option> { @@ -305,7 +305,7 @@ impl }) } } -impl +impl FromStrRadix for Ratio { /// Parses `numer/denom` where the numbers are in base `radix`. fn from_str_radix(s: &str, radix: uint) -> Option> { diff --git a/src/librand/distributions/mod.rs b/src/librand/distributions/mod.rs index bb09db4880269..2e3c039474753 100644 --- a/src/librand/distributions/mod.rs +++ b/src/librand/distributions/mod.rs @@ -260,7 +260,7 @@ mod tests { use {Rng, Rand}; use super::{RandSample, WeightedChoice, Weighted, Sample, IndependentSample}; - #[deriving(Eq, Show)] + #[deriving(PartialEq, Show)] struct ConstRand(uint); impl Rand for ConstRand { fn rand(_: &mut R) -> ConstRand { diff --git a/src/librand/distributions/range.rs b/src/librand/distributions/range.rs index f0e1d1715a2ba..13f6d2e81c064 100644 --- a/src/librand/distributions/range.rs +++ b/src/librand/distributions/range.rs @@ -54,7 +54,7 @@ pub struct Range { accept_zone: X } -impl Range { +impl Range { /// Create a new `Range` instance that samples uniformly from /// `[low, high)`. Fails if `low >= high`. pub fn new(low: X, high: X) -> Range { diff --git a/src/librand/lib.rs b/src/librand/lib.rs index 353ac4cfed1af..3ed086e9b13cc 100644 --- a/src/librand/lib.rs +++ b/src/librand/lib.rs @@ -182,7 +182,7 @@ pub trait Rng { /// let m: f64 = rng.gen_range(-40.0, 1.3e5); /// println!("{}", m); /// ``` - fn gen_range(&mut self, low: T, high: T) -> T { + fn gen_range(&mut self, low: T, high: T) -> T { assert!(low < high, "Rng.gen_range called with low >= high"); Range::new(low, high).ind_sample(self) } diff --git a/src/libregex/parse/mod.rs b/src/libregex/parse/mod.rs index 87b6e2b110441..bd2e454a9f811 100644 --- a/src/libregex/parse/mod.rs +++ b/src/libregex/parse/mod.rs @@ -67,7 +67,7 @@ pub enum Ast { Rep(Box, Repeater, Greed), } -#[deriving(Show, Eq, Clone)] +#[deriving(Show, PartialEq, Clone)] pub enum Repeater { ZeroOne, ZeroMore, diff --git a/src/librustc/back/link.rs b/src/librustc/back/link.rs index 5f53cd8570520..95c08d6a41ec6 100644 --- a/src/librustc/back/link.rs +++ b/src/librustc/back/link.rs @@ -45,7 +45,7 @@ use syntax::attr::AttrMetaMethods; use syntax::crateid::CrateId; use syntax::parse::token; -#[deriving(Clone, Eq, Ord, TotalOrd, TotalEq)] +#[deriving(Clone, PartialEq, PartialOrd, TotalOrd, TotalEq)] pub enum OutputType { OutputTypeBitcode, OutputTypeAssembly, diff --git a/src/librustc/back/svh.rs b/src/librustc/back/svh.rs index 9fd829ab901f6..1fce6eaf8e1b0 100644 --- a/src/librustc/back/svh.rs +++ b/src/librustc/back/svh.rs @@ -53,7 +53,7 @@ use std::iter::range_step; use syntax::ast; use syntax::visit; -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] pub struct Svh { hash: String, } diff --git a/src/librustc/driver/config.rs b/src/librustc/driver/config.rs index 16965bfa67fa8..db934c7a4045f 100644 --- a/src/librustc/driver/config.rs +++ b/src/librustc/driver/config.rs @@ -46,7 +46,7 @@ pub struct Config { pub uint_type: UintTy, } -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] pub enum OptLevel { No, // -O0 Less, // -O1 @@ -54,7 +54,7 @@ pub enum OptLevel { Aggressive // -O3 } -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] pub enum DebugInfoLevel { NoDebugInfo, LimitedDebugInfo, @@ -125,14 +125,14 @@ pub fn basic_options() -> Options { // users can have their own entry // functions that don't start a // scheduler -#[deriving(Eq)] +#[deriving(PartialEq)] pub enum EntryFnType { EntryMain, EntryStart, EntryNone, } -#[deriving(Eq, Ord, Clone, TotalOrd, TotalEq, Hash)] +#[deriving(PartialEq, PartialOrd, Clone, TotalOrd, TotalEq, Hash)] pub enum CrateType { CrateTypeExecutable, CrateTypeDylib, diff --git a/src/librustc/lib/llvm.rs b/src/librustc/lib/llvm.rs index 4a36dfd784285..a6c2d75dc0d4f 100644 --- a/src/librustc/lib/llvm.rs +++ b/src/librustc/lib/llvm.rs @@ -29,7 +29,7 @@ pub static False: Bool = 0 as Bool; // Consts for the LLVM CallConv type, pre-cast to uint. -#[deriving(Eq)] +#[deriving(PartialEq)] pub enum CallConv { CCallConv = 0, FastCallConv = 8, @@ -156,7 +156,7 @@ pub enum RealPredicate { // The LLVM TypeKind type - must stay in sync with the def of // LLVMTypeKind in llvm/include/llvm-c/Core.h -#[deriving(Eq)] +#[deriving(PartialEq)] #[repr(C)] pub enum TypeKind { Void = 0, @@ -226,7 +226,7 @@ pub enum AsmDialect { AD_Intel = 1 } -#[deriving(Eq)] +#[deriving(PartialEq)] #[repr(C)] pub enum CodeGenOptLevel { CodeGenLevelNone = 0, diff --git a/src/librustc/metadata/common.rs b/src/librustc/metadata/common.rs index c798118bbd0fa..8aeef3dca9867 100644 --- a/src/librustc/metadata/common.rs +++ b/src/librustc/metadata/common.rs @@ -114,7 +114,7 @@ pub static tag_items_data_item_reexport_def_id: uint = 0x39; pub static tag_items_data_item_reexport_name: uint = 0x3a; // used to encode crate_ctxt side tables -#[deriving(Eq)] +#[deriving(PartialEq)] #[repr(uint)] pub enum astencode_tag { // Reserves 0x40 -- 0x5f tag_ast = 0x40, diff --git a/src/librustc/metadata/cstore.rs b/src/librustc/metadata/cstore.rs index eb1beda898fd5..b355ede72c6ee 100644 --- a/src/librustc/metadata/cstore.rs +++ b/src/librustc/metadata/cstore.rs @@ -45,13 +45,13 @@ pub struct crate_metadata { pub span: Span, } -#[deriving(Show, Eq, Clone)] +#[deriving(Show, PartialEq, Clone)] pub enum LinkagePreference { RequireDynamic, RequireStatic, } -#[deriving(Eq, FromPrimitive)] +#[deriving(PartialEq, FromPrimitive)] pub enum NativeLibaryKind { NativeStatic, // native static library (.a archive) NativeFramework, // OSX-specific @@ -60,7 +60,7 @@ pub enum NativeLibaryKind { // Where a crate came from on the local filesystem. One of these two options // must be non-None. -#[deriving(Eq, Clone)] +#[deriving(PartialEq, Clone)] pub struct CrateSource { pub dylib: Option, pub rlib: Option, diff --git a/src/librustc/metadata/decoder.rs b/src/librustc/metadata/decoder.rs index 56b320d2a0722..30b40369c105a 100644 --- a/src/librustc/metadata/decoder.rs +++ b/src/librustc/metadata/decoder.rs @@ -103,7 +103,7 @@ fn lookup_item<'a>(item_id: ast::NodeId, data: &'a [u8]) -> ebml::Doc<'a> { find_item(item_id, items) } -#[deriving(Eq)] +#[deriving(PartialEq)] enum Family { ImmStatic, // c MutStatic, // b diff --git a/src/librustc/middle/borrowck/check_loans.rs b/src/librustc/middle/borrowck/check_loans.rs index 77fad454e6ec4..140bfcd684ad1 100644 --- a/src/librustc/middle/borrowck/check_loans.rs +++ b/src/librustc/middle/borrowck/check_loans.rs @@ -82,7 +82,7 @@ pub fn check_loans(bccx: &BorrowckCtxt, clcx.visit_block(body, ()); } -#[deriving(Eq)] +#[deriving(PartialEq)] enum MoveError { MoveOk, MoveWhileBorrowed(/*loan*/Rc, /*loan*/Span) diff --git a/src/librustc/middle/borrowck/mod.rs b/src/librustc/middle/borrowck/mod.rs index e52d8ba3975a0..c1f8ea4d00cb7 100644 --- a/src/librustc/middle/borrowck/mod.rs +++ b/src/librustc/middle/borrowck/mod.rs @@ -166,7 +166,7 @@ pub struct BorrowStats { pub type BckResult = Result; -#[deriving(Eq)] +#[deriving(PartialEq)] pub enum PartialTotal { Partial, // Loan affects some portion Total // Loan affects entire path @@ -188,13 +188,13 @@ pub struct Loan { cause: euv::LoanCause, } -#[deriving(Eq, TotalEq, Hash)] +#[deriving(PartialEq, TotalEq, Hash)] pub enum LoanPath { LpVar(ast::NodeId), // `x` in doc.rs LpExtend(Rc, mc::MutabilityCategory, LoanPathElem) } -#[deriving(Eq, TotalEq, Hash)] +#[deriving(PartialEq, TotalEq, Hash)] pub enum LoanPathElem { LpDeref(mc::PointerKind), // `*LV` in doc.rs LpInterior(mc::InteriorKind) // `LV.f` in doc.rs @@ -267,7 +267,7 @@ pub struct Restriction { set: RestrictionSet } -#[deriving(Eq)] +#[deriving(PartialEq)] pub struct RestrictionSet { bits: u32 } @@ -305,7 +305,7 @@ impl Repr for RestrictionSet { // Errors // Errors that can occur -#[deriving(Eq)] +#[deriving(PartialEq)] pub enum bckerr_code { err_mutbl, err_out_of_scope(ty::Region, ty::Region), // superscope, subscope @@ -315,7 +315,7 @@ pub enum bckerr_code { // Combination of an error code and the categorization of the expression // that caused it -#[deriving(Eq)] +#[deriving(PartialEq)] pub struct BckError { span: Span, cause: euv::LoanCause, diff --git a/src/librustc/middle/borrowck/move_data.rs b/src/librustc/middle/borrowck/move_data.rs index 068f8442c5184..5a95343c6228b 100644 --- a/src/librustc/middle/borrowck/move_data.rs +++ b/src/librustc/middle/borrowck/move_data.rs @@ -65,7 +65,7 @@ pub struct FlowedMoveData<'a> { } /// Index into `MoveData.paths`, used like a pointer -#[deriving(Eq)] +#[deriving(PartialEq)] pub struct MovePathIndex(uint); impl MovePathIndex { @@ -84,7 +84,7 @@ static InvalidMovePathIndex: MovePathIndex = MovePathIndex(uint::MAX); /// Index into `MoveData.moves`, used like a pointer -#[deriving(Eq)] +#[deriving(PartialEq)] pub struct MoveIndex(uint); impl MoveIndex { diff --git a/src/librustc/middle/check_loop.rs b/src/librustc/middle/check_loop.rs index 6e738b1430833..0c677f164d424 100644 --- a/src/librustc/middle/check_loop.rs +++ b/src/librustc/middle/check_loop.rs @@ -15,7 +15,7 @@ use syntax::codemap::Span; use syntax::visit::Visitor; use syntax::visit; -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] enum Context { Normal, Loop, Closure } diff --git a/src/librustc/middle/check_match.rs b/src/librustc/middle/check_match.rs index e21c8348a8b82..2053f7dd01b26 100644 --- a/src/librustc/middle/check_match.rs +++ b/src/librustc/middle/check_match.rs @@ -215,7 +215,7 @@ enum useful { not_useful, } -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] enum ctor { single, variant(DefId), diff --git a/src/librustc/middle/const_eval.rs b/src/librustc/middle/const_eval.rs index d8fe801b395c6..e7ad08d4eb2a5 100644 --- a/src/librustc/middle/const_eval.rs +++ b/src/librustc/middle/const_eval.rs @@ -288,7 +288,7 @@ pub fn process_crate(krate: &ast::Crate, // FIXME (#33): this doesn't handle big integer/float literals correctly // (nor does the rest of our literal handling). -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] pub enum const_val { const_float(f64), const_int(i64), @@ -514,7 +514,7 @@ pub fn lit_to_const(lit: &Lit) -> const_val { } } -fn compare_vals(a: T, b: T) -> Option { +fn compare_vals(a: T, b: T) -> Option { Some(if a == b { 0 } else if a < b { -1 } else { 1 }) } pub fn compare_const_vals(a: &const_val, b: &const_val) -> Option { diff --git a/src/librustc/middle/effect.rs b/src/librustc/middle/effect.rs index b3b09ba631e26..bc9a1c9b5fc65 100644 --- a/src/librustc/middle/effect.rs +++ b/src/librustc/middle/effect.rs @@ -20,7 +20,7 @@ use syntax::codemap::Span; use syntax::visit; use syntax::visit::Visitor; -#[deriving(Eq)] +#[deriving(PartialEq)] enum UnsafeContext { SafeContext, UnsafeFn, diff --git a/src/librustc/middle/expr_use_visitor.rs b/src/librustc/middle/expr_use_visitor.rs index 9d735dbaeae56..467cd726a65af 100644 --- a/src/librustc/middle/expr_use_visitor.rs +++ b/src/librustc/middle/expr_use_visitor.rs @@ -68,7 +68,7 @@ pub trait Delegate { mode: MutateMode); } -#[deriving(Eq)] +#[deriving(PartialEq)] pub enum LoanCause { ClosureCapture(Span), AddrOf, @@ -78,13 +78,13 @@ pub enum LoanCause { ClosureInvocation } -#[deriving(Eq,Show)] +#[deriving(PartialEq,Show)] pub enum ConsumeMode { Copy, // reference to x where x has a type that copies Move, // reference to x where x has a type that moves } -#[deriving(Eq,Show)] +#[deriving(PartialEq,Show)] pub enum MutateMode { JustWrite, // x = y WriteAndRead, // x += y diff --git a/src/librustc/middle/graph.rs b/src/librustc/middle/graph.rs index 5773d0bafa1d1..cd6010127084b 100644 --- a/src/librustc/middle/graph.rs +++ b/src/librustc/middle/graph.rs @@ -55,11 +55,11 @@ pub struct Edge { pub data: E, } -#[deriving(Eq)] +#[deriving(PartialEq)] pub struct NodeIndex(pub uint); pub static InvalidNodeIndex: NodeIndex = NodeIndex(uint::MAX); -#[deriving(Eq)] +#[deriving(PartialEq)] pub struct EdgeIndex(pub uint); pub static InvalidEdgeIndex: EdgeIndex = EdgeIndex(uint::MAX); @@ -356,7 +356,7 @@ mod test { }); } - fn test_adjacent_edges(graph: &Graph, + fn test_adjacent_edges(graph: &Graph, start_index: NodeIndex, start_data: N, expected_incoming: &[(E,N)], diff --git a/src/librustc/middle/lang_items.rs b/src/librustc/middle/lang_items.rs index f80c325496dd4..d5bd44fd27ce3 100644 --- a/src/librustc/middle/lang_items.rs +++ b/src/librustc/middle/lang_items.rs @@ -42,7 +42,7 @@ macro_rules! lets_do_this { $( $variant:ident, $name:expr, $method:ident; )* ) => { -#[deriving(FromPrimitive, Eq, TotalEq, Hash)] +#[deriving(FromPrimitive, PartialEq, TotalEq, Hash)] pub enum LangItem { $($variant),* } diff --git a/src/librustc/middle/lint.rs b/src/librustc/middle/lint.rs index 8cceb16b34fe8..7a11924800bb1 100644 --- a/src/librustc/middle/lint.rs +++ b/src/librustc/middle/lint.rs @@ -72,7 +72,7 @@ use syntax::parse::token; use syntax::visit::Visitor; use syntax::{ast, ast_util, visit}; -#[deriving(Clone, Show, Eq, Ord, TotalEq, TotalOrd, Hash)] +#[deriving(Clone, Show, PartialEq, PartialOrd, TotalEq, TotalOrd, Hash)] pub enum Lint { CTypes, UnusedImports, @@ -135,12 +135,12 @@ pub fn level_to_str(lv: Level) -> &'static str { } } -#[deriving(Clone, Eq, Ord, TotalEq, TotalOrd)] +#[deriving(Clone, PartialEq, PartialOrd, TotalEq, TotalOrd)] pub enum Level { Allow, Warn, Deny, Forbid } -#[deriving(Clone, Eq, Ord, TotalEq, TotalOrd)] +#[deriving(Clone, PartialEq, PartialOrd, TotalEq, TotalOrd)] pub struct LintSpec { pub default: Level, pub lint: Lint, @@ -150,7 +150,7 @@ pub struct LintSpec { pub type LintDict = HashMap<&'static str, LintSpec>; // this is public for the lints that run in trans -#[deriving(Eq)] +#[deriving(PartialEq)] pub enum LintSource { Node(Span), Default, @@ -836,7 +836,7 @@ fn check_type_limits(cx: &Context, e: &ast::Expr) { _ => () }; - fn is_valid(binop: ast::BinOp, v: T, + fn is_valid(binop: ast::BinOp, v: T, min: T, max: T) -> bool { match binop { ast::BiLt => v > min && v <= max, diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs index e0d411f9f97bc..ce02243403ff2 100644 --- a/src/librustc/middle/liveness.rs +++ b/src/librustc/middle/liveness.rs @@ -123,9 +123,9 @@ use syntax::print::pprust::{expr_to_str, block_to_str}; use syntax::{visit, ast_util}; use syntax::visit::{Visitor, FnKind}; -#[deriving(Eq)] +#[deriving(PartialEq)] struct Variable(uint); -#[deriving(Eq)] +#[deriving(PartialEq)] struct LiveNode(uint); impl Variable { @@ -142,7 +142,7 @@ impl Clone for LiveNode { } } -#[deriving(Eq)] +#[deriving(PartialEq)] enum LiveNodeKind { FreeVarNode(Span), ExprNode(Span), diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs index 1fad7b1e60c96..c8cad58a1912d 100644 --- a/src/librustc/middle/mem_categorization.rs +++ b/src/librustc/middle/mem_categorization.rs @@ -76,7 +76,7 @@ use syntax::parse::token; use std::cell::RefCell; use std::rc::Rc; -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] pub enum categorization { cat_rvalue(ty::Region), // temporary val, argument is its scope cat_static_item, @@ -92,14 +92,14 @@ pub enum categorization { // (*1) downcast is only required if the enum has more than one variant } -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] pub struct CopiedUpvar { pub upvar_id: ast::NodeId, pub onceness: ast::Onceness, } // different kinds of pointers: -#[deriving(Clone, Eq, TotalEq, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Hash)] pub enum PointerKind { OwnedPtr, GcPtr, @@ -109,26 +109,26 @@ pub enum PointerKind { // We use the term "interior" to mean "something reachable from the // base without a pointer dereference", e.g. a field -#[deriving(Clone, Eq, TotalEq, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Hash)] pub enum InteriorKind { InteriorField(FieldName), InteriorElement(ElementKind), } -#[deriving(Clone, Eq, TotalEq, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Hash)] pub enum FieldName { NamedField(ast::Name), PositionalField(uint) } -#[deriving(Clone, Eq, TotalEq, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Hash)] pub enum ElementKind { VecElement, StrElement, OtherElement, } -#[deriving(Clone, Eq, TotalEq, Hash, Show)] +#[deriving(Clone, PartialEq, TotalEq, Hash, Show)] pub enum MutabilityCategory { McImmutable, // Immutable. McDeclared, // Directly declared as mutable. @@ -149,7 +149,7 @@ pub enum MutabilityCategory { // dereference, but its type is the type *before* the dereference // (`@T`). So use `cmt.type` to find the type of the value in a consistent // fashion. For more details, see the method `cat_pattern` -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] pub struct cmt_ { pub id: ast::NodeId, // id of expr/pat producing this value pub span: Span, // span of same expr/pat diff --git a/src/librustc/middle/resolve.rs b/src/librustc/middle/resolve.rs index 077f61a34c6bc..4db791ddf7bf9 100644 --- a/src/librustc/middle/resolve.rs +++ b/src/librustc/middle/resolve.rs @@ -87,7 +87,7 @@ pub enum PrivateDep { } // How an import is used. -#[deriving(Eq)] +#[deriving(PartialEq)] pub enum ImportUse { Unused, // The import is not used. Used, // The import is used. @@ -102,20 +102,20 @@ impl LastPrivate { } } -#[deriving(Eq)] +#[deriving(PartialEq)] enum PatternBindingMode { RefutableMode, LocalIrrefutableMode, ArgumentIrrefutableMode, } -#[deriving(Eq, TotalEq, Hash)] +#[deriving(PartialEq, TotalEq, Hash)] enum Namespace { TypeNS, ValueNS } -#[deriving(Eq)] +#[deriving(PartialEq)] enum NamespaceError { NoError, ModuleError, @@ -288,7 +288,7 @@ enum ModulePrefixResult { PrefixFound(Rc, uint) } -#[deriving(Eq)] +#[deriving(PartialEq)] enum NameSearchType { /// We're doing a name search in order to resolve a `use` directive. ImportSearch, @@ -306,7 +306,7 @@ enum BareIdentifierPatternResolution { // Specifies how duplicates should be handled when adding a child item if // another item exists with the same name in some namespace. -#[deriving(Eq)] +#[deriving(PartialEq)] enum DuplicateCheckingMode { ForbidDuplicateModules, ForbidDuplicateTypes, @@ -435,7 +435,7 @@ enum ParentLink { } /// The type of module this is. -#[deriving(Eq)] +#[deriving(PartialEq)] enum ModuleKind { NormalModuleKind, ExternModuleKind, @@ -4900,7 +4900,7 @@ impl<'a> Resolver<'a> { } fn find_fallback_in_self_type(&mut self, name: Name) -> FallbackSuggestion { - #[deriving(Eq)] + #[deriving(PartialEq)] enum FallbackChecks { Everything, OnlyTraitAndStatics diff --git a/src/librustc/middle/trans/_match.rs b/src/librustc/middle/trans/_match.rs index 86ddd5e0e98a1..ddd41072c8d69 100644 --- a/src/librustc/middle/trans/_match.rs +++ b/src/librustc/middle/trans/_match.rs @@ -240,7 +240,7 @@ enum Lit { ConstLit(ast::DefId), // the def ID of the constant } -#[deriving(Eq)] +#[deriving(PartialEq)] pub enum VecLenOpt { vec_len_eq, vec_len_ge(/* length of prefix */uint) @@ -1215,7 +1215,7 @@ fn pick_col(m: &[Match]) -> uint { return best_col; } -#[deriving(Eq)] +#[deriving(PartialEq)] pub enum branch_kind { no_branch, single, switch, compare, compare_vec_len, } // Compiles a comparison between two things. diff --git a/src/librustc/middle/trans/cabi.rs b/src/librustc/middle/trans/cabi.rs index 2c9be587eaa9e..02671b1186631 100644 --- a/src/librustc/middle/trans/cabi.rs +++ b/src/librustc/middle/trans/cabi.rs @@ -18,7 +18,7 @@ use middle::trans::cabi_mips; use middle::trans::type_::Type; use syntax::abi::{X86, X86_64, Arm, Mips}; -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] pub enum ArgKind { /// Pass the argument directly using the normal converted /// LLVM type or by coercing to another specified type diff --git a/src/librustc/middle/trans/cabi_x86_64.rs b/src/librustc/middle/trans/cabi_x86_64.rs index 0ed87ef8092ea..9f98cf57c09b5 100644 --- a/src/librustc/middle/trans/cabi_x86_64.rs +++ b/src/librustc/middle/trans/cabi_x86_64.rs @@ -22,7 +22,7 @@ use middle::trans::type_::Type; use std::cmp; -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] enum RegClass { NoClass, Int, diff --git a/src/librustc/middle/trans/cleanup.rs b/src/librustc/middle/trans/cleanup.rs index 47d8ecec02130..b28db3d378be7 100644 --- a/src/librustc/middle/trans/cleanup.rs +++ b/src/librustc/middle/trans/cleanup.rs @@ -55,7 +55,7 @@ pub enum CleanupScopeKind<'a> { LoopScopeKind(ast::NodeId, [&'a Block<'a>, ..EXIT_MAX]) } -#[deriving(Eq)] +#[deriving(PartialEq)] pub enum EarlyExitLabel { UnwindExit, ReturnExit, diff --git a/src/librustc/middle/trans/common.rs b/src/librustc/middle/trans/common.rs index 0530e2a74630e..5c24a62d2d51e 100644 --- a/src/librustc/middle/trans/common.rs +++ b/src/librustc/middle/trans/common.rs @@ -722,7 +722,7 @@ pub fn expr_ty_adjusted(bcx: &Block, ex: &ast::Expr) -> ty::t { } // Key used to lookup values supplied for type parameters in an expr. -#[deriving(Eq)] +#[deriving(PartialEq)] pub enum ExprOrMethodCall { // Type parameters for a path like `None::` ExprId(ast::NodeId), diff --git a/src/librustc/middle/trans/datum.rs b/src/librustc/middle/trans/datum.rs index af9e614a17ef9..1ea25665c1c9a 100644 --- a/src/librustc/middle/trans/datum.rs +++ b/src/librustc/middle/trans/datum.rs @@ -82,7 +82,7 @@ impl Drop for Rvalue { fn drop(&mut self) { } } -#[deriving(Eq, TotalEq, Hash)] +#[deriving(PartialEq, TotalEq, Hash)] pub enum RvalueMode { /// `val` is a pointer to the actual value (and thus has type *T) ByRef, diff --git a/src/librustc/middle/trans/debuginfo.rs b/src/librustc/middle/trans/debuginfo.rs index 43d0d71154c3f..110dc3a188488 100644 --- a/src/librustc/middle/trans/debuginfo.rs +++ b/src/librustc/middle/trans/debuginfo.rs @@ -2403,7 +2403,7 @@ fn type_metadata(cx: &CrateContext, type_metadata } -#[deriving(Eq)] +#[deriving(PartialEq)] enum DebugLocation { KnownLocation { scope: DIScope, line: uint, col: uint }, UnknownLocation diff --git a/src/librustc/middle/trans/expr.rs b/src/librustc/middle/trans/expr.rs index 1f997c36c42f0..6241c1222f9c3 100644 --- a/src/librustc/middle/trans/expr.rs +++ b/src/librustc/middle/trans/expr.rs @@ -79,7 +79,7 @@ use syntax::print::pprust::{expr_to_str}; // These are passed around by the code generating functions to track the // destination of a computation's value. -#[deriving(Eq)] +#[deriving(PartialEq)] pub enum Dest { SaveIn(ValueRef), Ignore, @@ -1497,7 +1497,7 @@ fn float_cast(bcx: &Block, } else { llsrc }; } -#[deriving(Eq)] +#[deriving(PartialEq)] pub enum cast_kind { cast_pointer, cast_integral, diff --git a/src/librustc/middle/trans/monomorphize.rs b/src/librustc/middle/trans/monomorphize.rs index f77cd0ee44d9a..683fb39c9e907 100644 --- a/src/librustc/middle/trans/monomorphize.rs +++ b/src/librustc/middle/trans/monomorphize.rs @@ -312,14 +312,14 @@ pub fn monomorphic_fn(ccx: &CrateContext, } // Used to identify cached monomorphized functions and vtables -#[deriving(Eq, TotalEq, Hash)] +#[deriving(PartialEq, TotalEq, Hash)] pub struct MonoParamId { pub subst: ty::t, // Do we really need the vtables to be hashed? Isn't the type enough? pub vtables: Vec } -#[deriving(Eq, TotalEq, Hash)] +#[deriving(PartialEq, TotalEq, Hash)] pub struct MonoId { pub def: ast::DefId, pub params: Vec diff --git a/src/librustc/middle/trans/type_.rs b/src/librustc/middle/trans/type_.rs index d5a80edfaedd1..dfe06f9ca4c89 100644 --- a/src/librustc/middle/trans/type_.rs +++ b/src/librustc/middle/trans/type_.rs @@ -23,7 +23,7 @@ use std::mem; use libc::{c_uint}; -#[deriving(Clone, Eq, Show)] +#[deriving(Clone, PartialEq, Show)] pub struct Type { rf: TypeRef } diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index 4dc66427d7f01..7d3c4beb6740f 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -65,7 +65,7 @@ pub static INITIAL_DISCRIMINANT_VALUE: Disr = 0; // Data types -#[deriving(Eq, TotalEq, Hash)] +#[deriving(PartialEq, TotalEq, Hash)] pub struct field { pub ident: ast::Ident, pub mt: mt @@ -121,13 +121,13 @@ impl Method { } } -#[deriving(Clone, Eq, TotalEq, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Hash)] pub struct mt { pub ty: t, pub mutbl: ast::Mutability, } -#[deriving(Clone, Eq, TotalEq, Hash, Encodable, Decodable, Show)] +#[deriving(Clone, PartialEq, TotalEq, Hash, Encodable, Decodable, Show)] pub enum TraitStore { /// Box UniqTraitStore, @@ -145,7 +145,7 @@ pub struct field_ty { // Contains information needed to resolve types and (in the future) look up // the types of AST nodes. -#[deriving(Eq, TotalEq, Hash)] +#[deriving(PartialEq, TotalEq, Hash)] pub struct creader_cache_key { pub cnum: CrateNum, pub pos: uint, @@ -158,10 +158,10 @@ pub struct intern_key { sty: *sty, } -// NB: Do not replace this with #[deriving(Eq)]. The automatically-derived +// NB: Do not replace this with #[deriving(PartialEq)]. The automatically-derived // implementation will not recurse through sty and you will get stack // exhaustion. -impl cmp::Eq for intern_key { +impl cmp::PartialEq for intern_key { fn eq(&self, other: &intern_key) -> bool { unsafe { *self.sty == *other.sty @@ -185,14 +185,14 @@ pub enum ast_ty_to_ty_cache_entry { atttce_resolved(t) /* resolved to a type, irrespective of region */ } -#[deriving(Clone, Eq, Decodable, Encodable)] +#[deriving(Clone, PartialEq, Decodable, Encodable)] pub struct ItemVariances { pub self_param: Option, pub type_params: OwnedSlice, pub region_params: OwnedSlice } -#[deriving(Clone, Eq, Decodable, Encodable, Show)] +#[deriving(Clone, PartialEq, Decodable, Encodable, Show)] pub enum Variance { Covariant, // T <: T iff A <: B -- e.g., function return type Invariant, // T <: T iff B == A -- e.g., type of mutable cell @@ -216,7 +216,7 @@ pub struct AutoDerefRef { pub autoref: Option } -#[deriving(Clone, Decodable, Encodable, Eq, Show)] +#[deriving(Clone, Decodable, Encodable, PartialEq, Show)] pub enum AutoRef { /// Convert from T to &T AutoPtr(Region, ast::Mutability), @@ -387,7 +387,7 @@ pub struct t_box_ { enum t_opaque {} #[allow(raw_pointer_deriving)] -#[deriving(Clone, Eq, TotalEq, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Hash)] pub struct t { inner: *t_opaque } impl fmt::Show for t { @@ -415,14 +415,14 @@ pub fn type_needs_infer(t: t) -> bool { } pub fn type_id(t: t) -> uint { get(t).id } -#[deriving(Clone, Eq, TotalEq, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Hash)] pub struct BareFnTy { pub fn_style: ast::FnStyle, pub abi: abi::Abi, pub sig: FnSig, } -#[deriving(Clone, Eq, TotalEq, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Hash)] pub struct ClosureTy { pub fn_style: ast::FnStyle, pub onceness: ast::Onceness, @@ -443,7 +443,7 @@ pub struct ClosureTy { * - `output` is the return type. * - `variadic` indicates whether this is a varidic function. (only true for foreign fns) */ -#[deriving(Clone, Eq, TotalEq, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Hash)] pub struct FnSig { pub binder_id: ast::NodeId, pub inputs: Vec, @@ -451,14 +451,14 @@ pub struct FnSig { pub variadic: bool } -#[deriving(Clone, Eq, TotalEq, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Hash)] pub struct param_ty { pub idx: uint, pub def_id: DefId } /// Representation of regions: -#[deriving(Clone, Eq, TotalEq, Hash, Encodable, Decodable, Show)] +#[deriving(Clone, PartialEq, TotalEq, Hash, Encodable, Decodable, Show)] pub enum Region { // Region bound in a type or fn declaration which will be // substituted 'early' -- that is, at the same time when type @@ -499,13 +499,13 @@ pub enum Region { * the original var id (that is, the root variable that is referenced * by the upvar) and the id of the closure expression. */ -#[deriving(Clone, Eq, TotalEq, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Hash)] pub struct UpvarId { pub var_id: ast::NodeId, pub closure_expr_id: ast::NodeId, } -#[deriving(Clone, Eq, TotalEq, Hash, Show)] +#[deriving(Clone, PartialEq, TotalEq, Hash, Show)] pub enum BorrowKind { /// Data must be immutable and is aliasable. ImmBorrow, @@ -600,7 +600,7 @@ pub enum BorrowKind { * the closure, so sometimes it is necessary for them to be larger * than the closure lifetime itself. */ -#[deriving(Eq, Clone)] +#[deriving(PartialEq, Clone)] pub struct UpvarBorrow { pub kind: BorrowKind, pub region: ty::Region, @@ -618,13 +618,13 @@ impl Region { } } -#[deriving(Clone, Eq, Ord, TotalEq, TotalOrd, Hash, Encodable, Decodable, Show)] +#[deriving(Clone, PartialEq, PartialOrd, TotalEq, TotalOrd, Hash, Encodable, Decodable, Show)] pub struct FreeRegion { pub scope_id: NodeId, pub bound_region: BoundRegion } -#[deriving(Clone, Eq, Ord, TotalEq, TotalOrd, Hash, Encodable, Decodable, Show)] +#[deriving(Clone, PartialEq, PartialOrd, TotalEq, TotalOrd, Hash, Encodable, Decodable, Show)] pub enum BoundRegion { /// An anonymous region parameter for a given fn (&T) BrAnon(uint), @@ -643,7 +643,7 @@ pub enum BoundRegion { * Represents the values to use when substituting lifetime parameters. * If the value is `ErasedRegions`, then this subst is occurring during * trans, and all region parameters will be replaced with `ty::ReStatic`. */ -#[deriving(Clone, Eq, TotalEq, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Hash)] pub enum RegionSubsts { ErasedRegions, NonerasedRegions(OwnedSlice) @@ -666,7 +666,7 @@ pub enum RegionSubsts { * - `self_ty` is the type to which `self` should be remapped, if any. The * `self` type is rather funny in that it can only appear on traits and is * always substituted away to the implementing type for a trait. */ -#[deriving(Clone, Eq, TotalEq, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Hash)] pub struct substs { pub self_ty: Option, pub tps: Vec, @@ -722,7 +722,7 @@ mod primitives { // NB: If you change this, you'll probably want to change the corresponding // AST structure in libsyntax/ast.rs as well. -#[deriving(Clone, Eq, TotalEq, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Hash)] pub enum sty { ty_nil, ty_bot, @@ -754,7 +754,7 @@ pub enum sty { // on non-useful type error messages) } -#[deriving(Clone, Eq, TotalEq, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Hash)] pub struct TyTrait { pub def_id: DefId, pub substs: substs, @@ -762,13 +762,13 @@ pub struct TyTrait { pub bounds: BuiltinBounds } -#[deriving(Eq, TotalEq, Hash)] +#[deriving(PartialEq, TotalEq, Hash)] pub struct TraitRef { pub def_id: DefId, pub substs: substs } -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] pub enum IntVarValue { IntType(ast::IntTy), UintType(ast::UintTy), @@ -822,7 +822,7 @@ pub enum type_err { terr_variadic_mismatch(expected_found) } -#[deriving(Eq, TotalEq, Hash)] +#[deriving(PartialEq, TotalEq, Hash)] pub struct ParamBounds { pub builtin_bounds: BuiltinBounds, pub trait_bounds: Vec> @@ -830,7 +830,7 @@ pub struct ParamBounds { pub type BuiltinBounds = EnumSet; -#[deriving(Clone, Encodable, Eq, TotalEq, Decodable, Hash, Show)] +#[deriving(Clone, Encodable, PartialEq, TotalEq, Decodable, Hash, Show)] #[repr(uint)] pub enum BuiltinBound { BoundStatic, @@ -862,21 +862,21 @@ impl CLike for BuiltinBound { } } -#[deriving(Clone, Eq, TotalEq, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Hash)] pub struct TyVid(pub uint); -#[deriving(Clone, Eq, TotalEq, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Hash)] pub struct IntVid(pub uint); -#[deriving(Clone, Eq, TotalEq, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Hash)] pub struct FloatVid(pub uint); -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct RegionVid { pub id: uint } -#[deriving(Clone, Eq, TotalEq, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Hash)] pub enum InferTy { TyVar(TyVid), IntVar(IntVid), @@ -889,7 +889,7 @@ pub enum InferRegion { ReSkolemized(uint, BoundRegion) } -impl cmp::Eq for InferRegion { +impl cmp::PartialEq for InferRegion { fn eq(&self, other: &InferRegion) -> bool { match ((*self), *other) { (ReVar(rva), ReVar(rvb)) => { @@ -2402,7 +2402,7 @@ pub fn is_instantiable(cx: &ctxt, r_ty: t) -> bool { /// distinguish between types that are recursive with themselves and types that /// contain a different recursive type. These cases can therefore be treated /// differently when reporting errors. -#[deriving(Eq)] +#[deriving(PartialEq)] pub enum Representability { Representable, SelfRecursive, diff --git a/src/librustc/middle/typeck/check/_match.rs b/src/librustc/middle/typeck/check/_match.rs index 565b951df2502..072b4ea7fe126 100644 --- a/src/librustc/middle/typeck/check/_match.rs +++ b/src/librustc/middle/typeck/check/_match.rs @@ -758,7 +758,7 @@ pub fn check_pointer_pat(pcx: &pat_ctxt, } } -#[deriving(Eq)] +#[deriving(PartialEq)] pub enum PointerKind { Send, Borrowed, diff --git a/src/librustc/middle/typeck/check/method.rs b/src/librustc/middle/typeck/check/method.rs index 735bec4f4dba9..8cea03c59e78a 100644 --- a/src/librustc/middle/typeck/check/method.rs +++ b/src/librustc/middle/typeck/check/method.rs @@ -106,19 +106,19 @@ use syntax::codemap::Span; use syntax::parse::token; use syntax::owned_slice::OwnedSlice; -#[deriving(Eq)] +#[deriving(PartialEq)] pub enum CheckTraitsFlag { CheckTraitsOnly, CheckTraitsAndInherentMethods, } -#[deriving(Eq)] +#[deriving(PartialEq)] pub enum AutoderefReceiverFlag { AutoderefReceiver, DontAutoderefReceiver, } -#[deriving(Eq)] +#[deriving(PartialEq)] pub enum StaticMethodsFlag { ReportStaticMethods, IgnoreStaticMethods, diff --git a/src/librustc/middle/typeck/check/mod.rs b/src/librustc/middle/typeck/check/mod.rs index 1987f4b07512d..70d8deaf03ce7 100644 --- a/src/librustc/middle/typeck/check/mod.rs +++ b/src/librustc/middle/typeck/check/mod.rs @@ -213,7 +213,7 @@ impl FnStyleState { /// Whether `check_binop` is part of an assignment or not. /// Used to know wether we allow user overloads and to print /// better messages on error. -#[deriving(Eq)] +#[deriving(PartialEq)] enum IsBinopAssignment{ SimpleBinop, BinopAssignment, diff --git a/src/librustc/middle/typeck/infer/lattice.rs b/src/librustc/middle/typeck/infer/lattice.rs index 41a59dae74083..6737a638dd8d2 100644 --- a/src/librustc/middle/typeck/infer/lattice.rs +++ b/src/librustc/middle/typeck/infer/lattice.rs @@ -72,19 +72,19 @@ impl LatticeValue for ty::t { pub trait CombineFieldsLatticeMethods { fn var_sub_var>>(&self, + V:Clone + PartialEq + ToStr + Vid + UnifyVid>>(&self, a_id: V, b_id: V) -> ures; /// make variable a subtype of T fn var_sub_t>>( + V:Clone + PartialEq + ToStr + Vid + UnifyVid>>( &self, a_id: V, b: T) -> ures; fn t_sub_var>>( + V:Clone + PartialEq + ToStr + Vid + UnifyVid>>( &self, a: T, b_id: V) @@ -96,7 +96,7 @@ pub trait CombineFieldsLatticeMethods { lattice_op: LatticeOp) -> cres>; fn set_var_to_merged_bounds>>( + V:Clone+PartialEq+ToStr+Vid+UnifyVid>>( &self, v_id: V, a: &Bounds, @@ -112,7 +112,7 @@ pub trait CombineFieldsLatticeMethods { impl<'f> CombineFieldsLatticeMethods for CombineFields<'f> { fn var_sub_var>>( + V:Clone + PartialEq + ToStr + Vid + UnifyVid>>( &self, a_id: V, b_id: V) @@ -165,7 +165,7 @@ impl<'f> CombineFieldsLatticeMethods for CombineFields<'f> { /// make variable a subtype of T fn var_sub_t>>( + V:Clone + PartialEq + ToStr + Vid + UnifyVid>>( &self, a_id: V, b: T) @@ -189,7 +189,7 @@ impl<'f> CombineFieldsLatticeMethods for CombineFields<'f> { } fn t_sub_var>>( + V:Clone + PartialEq + ToStr + Vid + UnifyVid>>( &self, a: T, b_id: V) @@ -238,7 +238,7 @@ impl<'f> CombineFieldsLatticeMethods for CombineFields<'f> { } fn set_var_to_merged_bounds>>( + V:Clone+PartialEq+ToStr+Vid+UnifyVid>>( &self, v_id: V, a: &Bounds, @@ -432,7 +432,7 @@ pub enum LatticeVarResult { * return. */ pub fn lattice_vars>>( + V:Clone + PartialEq + ToStr + Vid + UnifyVid>>( this: &L, // defines whether we want LUB or GLB a_vid: V, // first variable b_vid: V, // second variable @@ -478,7 +478,7 @@ pub fn lattice_vars>>( + V:Clone + PartialEq + ToStr + Vid + UnifyVid>>( this: &L, a_id: V, b: &T, diff --git a/src/librustc/middle/typeck/infer/mod.rs b/src/librustc/middle/typeck/infer/mod.rs index d560b1c9a99ca..fa52ef5dab684 100644 --- a/src/librustc/middle/typeck/infer/mod.rs +++ b/src/librustc/middle/typeck/infer/mod.rs @@ -456,7 +456,7 @@ trait CresCompare { fn compare(&self, t: T, f: || -> ty::type_err) -> cres; } -impl CresCompare for cres { +impl CresCompare for cres { fn compare(&self, t: T, f: || -> ty::type_err) -> cres { (*self).clone().and_then(|s| { if s == t { diff --git a/src/librustc/middle/typeck/infer/region_inference/mod.rs b/src/librustc/middle/typeck/infer/region_inference/mod.rs index c964530a5f9fe..8ec4b52ffd19d 100644 --- a/src/librustc/middle/typeck/infer/region_inference/mod.rs +++ b/src/librustc/middle/typeck/infer/region_inference/mod.rs @@ -31,7 +31,7 @@ use syntax::ast; mod doc; -#[deriving(Eq, TotalEq, Hash)] +#[deriving(PartialEq, TotalEq, Hash)] pub enum Constraint { ConstrainVarSubVar(RegionVid, RegionVid), ConstrainRegSubVar(Region, RegionVid), @@ -39,7 +39,7 @@ pub enum Constraint { ConstrainRegSubReg(Region, Region), } -#[deriving(Eq, TotalEq, Hash)] +#[deriving(PartialEq, TotalEq, Hash)] pub struct TwoRegions { a: Region, b: Region, @@ -759,7 +759,7 @@ impl<'a> RegionVarBindings<'a> { // ______________________________________________________________________ -#[deriving(Eq, Show)] +#[deriving(PartialEq, Show)] enum Classification { Expanding, Contracting } pub enum VarValue { NoValue, Value(Region), ErrorValue } diff --git a/src/librustc/middle/typeck/infer/unify.rs b/src/librustc/middle/typeck/infer/unify.rs index 867e52056a7b1..653624bf8eeda 100644 --- a/src/librustc/middle/typeck/infer/unify.rs +++ b/src/librustc/middle/typeck/infer/unify.rs @@ -52,7 +52,7 @@ pub trait UnifyVid { pub trait UnifyInferCtxtMethods { fn get>( + V:Clone + PartialEq + Vid + UnifyVid>( &self, vid: V) -> Node; @@ -71,7 +71,7 @@ pub trait UnifyInferCtxtMethods { impl<'a> UnifyInferCtxtMethods for InferCtxt<'a> { fn get>( + V:Clone + PartialEq + Vid + UnifyVid>( &self, vid: V) -> Node { @@ -86,7 +86,7 @@ impl<'a> UnifyInferCtxtMethods for InferCtxt<'a> { let vb = UnifyVid::appropriate_vals_and_bindings(self); return helper(tcx, &mut *vb.borrow_mut(), vid); - fn helper( + fn helper( tcx: &ty::ctxt, vb: &mut ValsAndBindings, vid: V) -> Node @@ -191,15 +191,15 @@ pub fn mk_err(a_is_expected: bool, } pub trait InferCtxtMethods { - fn simple_vars>>( + fn simple_vars>>( &self, a_is_expected: bool, a_id: V, b_id: V) -> ures; - fn simple_var_t>>( + fn simple_var_t>>( &self, a_is_expected: bool, a_id: V, @@ -208,8 +208,8 @@ pub trait InferCtxtMethods { } impl<'a> InferCtxtMethods for InferCtxt<'a> { - fn simple_vars>>( + fn simple_vars>>( &self, a_is_expected: bool, a_id: V, @@ -248,8 +248,8 @@ impl<'a> InferCtxtMethods for InferCtxt<'a> { return uok(); } - fn simple_var_t>>( + fn simple_var_t>>( &self, a_is_expected: bool, a_id: V, diff --git a/src/librustc/middle/typeck/mod.rs b/src/librustc/middle/typeck/mod.rs index bfe09fdd2b287..156479dc7a33d 100644 --- a/src/librustc/middle/typeck/mod.rs +++ b/src/librustc/middle/typeck/mod.rs @@ -84,7 +84,7 @@ pub mod collect; pub mod coherence; pub mod variance; -#[deriving(Clone, Encodable, Decodable, Eq, Ord)] +#[deriving(Clone, Encodable, Decodable, PartialEq, PartialOrd)] pub enum param_index { param_numbered(uint), param_self @@ -147,7 +147,7 @@ pub struct MethodCallee { pub substs: ty::substs } -#[deriving(Clone, Eq, TotalEq, Hash, Show)] +#[deriving(Clone, PartialEq, TotalEq, Hash, Show)] pub struct MethodCall { pub expr_id: ast::NodeId, pub autoderef: u32 diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 610cc992eed6e..5deadc8867267 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -490,7 +490,7 @@ impl Clean>> for ty::substs { } } -#[deriving(Clone, Encodable, Decodable, Eq)] +#[deriving(Clone, Encodable, Decodable, PartialEq)] pub struct Lifetime(String); impl Lifetime { @@ -631,7 +631,7 @@ impl Clean for ast::TypeMethod { } } -#[deriving(Clone, Encodable, Decodable, Eq)] +#[deriving(Clone, Encodable, Decodable, PartialEq)] pub enum SelfTy { SelfStatic, SelfValue, @@ -1458,7 +1458,7 @@ impl Clean for doctree::Static { } } -#[deriving(Show, Clone, Encodable, Decodable, Eq)] +#[deriving(Show, Clone, Encodable, Decodable, PartialEq)] pub enum Mutability { Mutable, Immutable, diff --git a/src/librustdoc/html/item_type.rs b/src/librustdoc/html/item_type.rs index a19d0b6fb301b..0f000f4e5aea1 100644 --- a/src/librustdoc/html/item_type.rs +++ b/src/librustdoc/html/item_type.rs @@ -19,7 +19,7 @@ use clean; /// discriminants. JavaScript then is used to decode them into the original value. /// Consequently, every change to this type should be synchronized to /// the `itemTypes` mapping table in `static/main.js`. -#[deriving(Eq, Clone)] +#[deriving(PartialEq, Clone)] pub enum ItemType { Module = 0, Struct = 1, diff --git a/src/librustdoc/html/toc.rs b/src/librustdoc/html/toc.rs index aa01247c1b682..2356d4c754fa9 100644 --- a/src/librustdoc/html/toc.rs +++ b/src/librustdoc/html/toc.rs @@ -14,7 +14,7 @@ use std::fmt; use std::string::String; /// A (recursive) table of contents -#[deriving(Eq)] +#[deriving(PartialEq)] pub struct Toc { /// The levels are strictly decreasing, i.e. /// @@ -36,7 +36,7 @@ impl Toc { } } -#[deriving(Eq)] +#[deriving(PartialEq)] pub struct TocEntry { level: u32, sec_number: String, @@ -46,7 +46,7 @@ pub struct TocEntry { } /// Progressive construction of a table of contents. -#[deriving(Eq)] +#[deriving(PartialEq)] pub struct TocBuilder { top_level: Toc, /// The current heirachy of parent headings, the levels are diff --git a/src/librustuv/timeout.rs b/src/librustuv/timeout.rs index a67b2b481e4ca..15add60b59c48 100644 --- a/src/librustuv/timeout.rs +++ b/src/librustuv/timeout.rs @@ -34,14 +34,14 @@ pub struct Guard<'a> { pub can_timeout: bool, } -#[deriving(Eq)] +#[deriving(PartialEq)] enum TimeoutState { NoTimeout, TimeoutPending(ClientState), TimedOut, } -#[deriving(Eq)] +#[deriving(PartialEq)] enum ClientState { NoWaiter, AccessPending, diff --git a/src/librustuv/uvll.rs b/src/librustuv/uvll.rs index 6236fd0e0e563..91c6814725144 100644 --- a/src/librustuv/uvll.rs +++ b/src/librustuv/uvll.rs @@ -254,7 +254,7 @@ pub type uv_shutdown_cb = extern "C" fn(req: *uv_shutdown_t, status: c_int); #[cfg(windows)] pub type uv_gid_t = libc::c_uchar; #[repr(C)] -#[deriving(Eq)] +#[deriving(PartialEq)] pub enum uv_handle_type { UV_UNKNOWN_HANDLE, UV_ASYNC, @@ -279,7 +279,7 @@ pub enum uv_handle_type { #[repr(C)] #[cfg(unix)] -#[deriving(Eq)] +#[deriving(PartialEq)] pub enum uv_req_type { UV_UNKNOWN_REQ, UV_REQ, @@ -297,7 +297,7 @@ pub enum uv_req_type { // See UV_REQ_TYPE_PRIVATE at libuv/include/uv-win.h #[repr(C)] #[cfg(windows)] -#[deriving(Eq)] +#[deriving(PartialEq)] pub enum uv_req_type { UV_UNKNOWN_REQ, UV_REQ, @@ -320,7 +320,7 @@ pub enum uv_req_type { } #[repr(C)] -#[deriving(Eq)] +#[deriving(PartialEq)] pub enum uv_membership { UV_LEAVE_GROUP, UV_JOIN_GROUP diff --git a/src/libsemver/lib.rs b/src/libsemver/lib.rs index 51dcc6d3faf55..dbde1a7486d09 100644 --- a/src/libsemver/lib.rs +++ b/src/libsemver/lib.rs @@ -46,14 +46,14 @@ use std::string::String; /// An identifier in the pre-release or build metadata. If the identifier can /// be parsed as a decimal value, it will be represented with `Numeric`. -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] #[allow(missing_doc)] pub enum Identifier { Numeric(uint), AlphaNumeric(String) } -impl cmp::Ord for Identifier { +impl cmp::PartialOrd for Identifier { #[inline] fn lt(&self, other: &Identifier) -> bool { match (self, other) { @@ -115,7 +115,7 @@ impl fmt::Show for Version { } } -impl cmp::Eq for Version { +impl cmp::PartialEq for Version { #[inline] fn eq(&self, other: &Version) -> bool { // We should ignore build metadata here, otherwise versions v1 and v2 @@ -128,7 +128,7 @@ impl cmp::Eq for Version { } } -impl cmp::Ord for Version { +impl cmp::PartialOrd for Version { #[inline] fn lt(&self, other: &Version) -> bool { diff --git a/src/libserialize/collection_impls.rs b/src/libserialize/collection_impls.rs index 8631fef5168ab..7ca0f372891b6 100644 --- a/src/libserialize/collection_impls.rs +++ b/src/libserialize/collection_impls.rs @@ -76,8 +76,8 @@ impl,T:Decodable> Decodable for RingBuf { impl< E, S: Encoder, - K: Encodable + Eq + TotalOrd, - V: Encodable + Eq + K: Encodable + PartialEq + TotalOrd, + V: Encodable + PartialEq > Encodable for TreeMap { fn encode(&self, e: &mut S) -> Result<(), E> { e.emit_map(self.len(), |e| { @@ -95,8 +95,8 @@ impl< impl< E, D: Decoder, - K: Decodable + Eq + TotalOrd, - V: Decodable + Eq + K: Decodable + PartialEq + TotalOrd, + V: Decodable + PartialEq > Decodable for TreeMap { fn decode(d: &mut D) -> Result, E> { d.read_map(|d, len| { @@ -114,7 +114,7 @@ impl< impl< E, S: Encoder, - T: Encodable + Eq + TotalOrd + T: Encodable + PartialEq + TotalOrd > Encodable for TreeSet { fn encode(&self, s: &mut S) -> Result<(), E> { s.emit_seq(self.len(), |s| { @@ -131,7 +131,7 @@ impl< impl< E, D: Decoder, - T: Decodable + Eq + TotalOrd + T: Decodable + PartialEq + TotalOrd > Decodable for TreeSet { fn decode(d: &mut D) -> Result, E> { d.read_seq(|d, len| { diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs index 09ba46bf0c746..5e23c9c345112 100644 --- a/src/libserialize/json.rs +++ b/src/libserialize/json.rs @@ -249,7 +249,7 @@ use Encodable; use collections::{HashMap, TreeMap}; /// Represents a json value -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] pub enum Json { Number(f64), String(String), @@ -263,7 +263,7 @@ pub type List = Vec; pub type Object = TreeMap; /// The errors that can arise while parsing a JSON stream. -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] pub enum ErrorCode { InvalidSyntax, InvalidNumber, @@ -283,7 +283,7 @@ pub enum ErrorCode { NotUtf8, } -#[deriving(Clone, Eq, Show)] +#[deriving(Clone, PartialEq, Show)] pub enum ParserError { /// msg, line, col SyntaxError(ErrorCode, uint, uint), @@ -293,7 +293,7 @@ pub enum ParserError { // Builder and Parser have the same errors. pub type BuilderError = ParserError; -#[deriving(Clone, Eq, Show)] +#[deriving(Clone, PartialEq, Show)] pub enum DecoderError { ParseError(ParserError), ExpectedError(String, String), @@ -975,7 +975,7 @@ impl Json { } /// The output of the streaming parser. -#[deriving(Eq, Clone, Show)] +#[deriving(PartialEq, Clone, Show)] pub enum JsonEvent { ObjectStart, ObjectEnd, @@ -988,7 +988,7 @@ pub enum JsonEvent { Error(ParserError), } -#[deriving(Eq, Show)] +#[deriving(PartialEq, Show)] enum ParserState { // Parse a value in a list, true means first element. ParseList(bool), @@ -1017,7 +1017,7 @@ pub struct Stack { /// StackElements compose a Stack. /// For example, Key("foo"), Key("bar"), Index(3) and Key("x") are the /// StackElements compositing the stack that represents foo.bar[3].x -#[deriving(Eq, Clone, Show)] +#[deriving(PartialEq, Clone, Show)] pub enum StackElement<'l> { Index(u32), Key(&'l str), @@ -1025,7 +1025,7 @@ pub enum StackElement<'l> { // Internally, Key elements are stored as indices in a buffer to avoid // allocating a string for every member of an object. -#[deriving(Eq, Clone, Show)] +#[deriving(PartialEq, Clone, Show)] enum InternalStackElement { InternalIndex(u32), InternalKey(u16, u16), // start, size @@ -2082,7 +2082,7 @@ impl ::Decoder for Decoder { } /// Test if two json values are less than one another -impl Ord for Json { +impl PartialOrd for Json { fn lt(&self, other: &Json) -> bool { match *self { Number(f0) => { @@ -2288,20 +2288,20 @@ mod tests { use std::io; use collections::TreeMap; - #[deriving(Eq, Encodable, Decodable, Show)] + #[deriving(PartialEq, Encodable, Decodable, Show)] enum Animal { Dog, Frog(String, int) } - #[deriving(Eq, Encodable, Decodable, Show)] + #[deriving(PartialEq, Encodable, Decodable, Show)] struct Inner { a: (), b: uint, c: Vec, } - #[deriving(Eq, Encodable, Decodable, Show)] + #[deriving(PartialEq, Encodable, Decodable, Show)] struct Outer { inner: Vec, } diff --git a/src/libstd/ascii.rs b/src/libstd/ascii.rs index 75b31f9c35430..222297aaf0ef2 100644 --- a/src/libstd/ascii.rs +++ b/src/libstd/ascii.rs @@ -23,7 +23,7 @@ use to_str::{IntoStr}; use vec::Vec; /// Datatype to hold one ascii character. It wraps a `u8`, with the highest bit always zero. -#[deriving(Clone, Eq, Ord, TotalOrd, TotalEq, Hash)] +#[deriving(Clone, PartialEq, PartialOrd, TotalOrd, TotalEq, Hash)] pub struct Ascii { chr: u8 } impl Ascii { diff --git a/src/libstd/bitflags.rs b/src/libstd/bitflags.rs index 6b3939872811d..eb8c7e7d28324 100644 --- a/src/libstd/bitflags.rs +++ b/src/libstd/bitflags.rs @@ -78,7 +78,7 @@ //! //! # Derived traits //! -//! The `Eq` and `Clone` traits are automatically derived for the `struct` using +//! The `PartialEq` and `Clone` traits are automatically derived for the `struct` using //! the `deriving` attribute. Additional traits can be derived by providing an //! explicit `deriving` attribute on `flags`. //! @@ -112,7 +112,7 @@ macro_rules! bitflags( ($(#[$attr:meta])* flags $BitFlags:ident: $T:ty { $($(#[$Flag_attr:meta])* static $Flag:ident = $value:expr),+ }) => ( - #[deriving(Eq, TotalEq, Clone)] + #[deriving(PartialEq, TotalEq, Clone)] $(#[$attr])* pub struct $BitFlags { bits: $T, diff --git a/src/libstd/c_str.rs b/src/libstd/c_str.rs index 983d76a08442b..4e39518deb48c 100644 --- a/src/libstd/c_str.rs +++ b/src/libstd/c_str.rs @@ -66,7 +66,7 @@ fn main() { */ use clone::Clone; -use cmp::Eq; +use cmp::PartialEq; use container::Container; use iter::{Iterator, range}; use kinds::marker; @@ -109,7 +109,7 @@ impl Clone for CString { } } -impl Eq for CString { +impl PartialEq for CString { fn eq(&self, other: &CString) -> bool { if self.buf as uint == other.buf as uint { true diff --git a/src/libstd/comm/mod.rs b/src/libstd/comm/mod.rs index 18857e221fa15..170618e276b2c 100644 --- a/src/libstd/comm/mod.rs +++ b/src/libstd/comm/mod.rs @@ -360,7 +360,7 @@ pub struct SyncSender { /// This enumeration is the list of the possible reasons that try_recv could not /// return data when called. -#[deriving(Eq, Clone, Show)] +#[deriving(PartialEq, Clone, Show)] pub enum TryRecvError { /// This channel is currently empty, but the sender(s) have not yet /// disconnected, so data may yet become available. @@ -372,7 +372,7 @@ pub enum TryRecvError { /// This enumeration is the list of the possible error outcomes for the /// `SyncSender::try_send` method. -#[deriving(Eq, Clone, Show)] +#[deriving(PartialEq, Clone, Show)] pub enum TrySendError { /// The data could not be sent on the channel because it would require that /// the callee block to send the data. diff --git a/src/libstd/io/buffered.rs b/src/libstd/io/buffered.rs index 643bc166c2762..0d4217601624f 100644 --- a/src/libstd/io/buffered.rs +++ b/src/libstd/io/buffered.rs @@ -378,7 +378,7 @@ mod test { /// A type, free to create, primarily intended for benchmarking creation of /// wrappers that, just for construction, don't need a Reader/Writer that /// does anything useful. Is equivalent to `/dev/null` in semantics. - #[deriving(Clone,Eq,Ord)] + #[deriving(Clone,PartialEq,PartialOrd)] pub struct NullStream; impl Reader for NullStream { diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index 4d02a470f308c..78700d353afd8 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -285,7 +285,7 @@ pub type IoResult = Result; /// # FIXME /// /// Is something like this sufficient? It's kind of archaic -#[deriving(Eq, Clone)] +#[deriving(PartialEq, Clone)] pub struct IoError { /// An enumeration which can be matched against for determining the flavor /// of error. @@ -395,7 +395,7 @@ impl fmt::Show for IoError { } /// A list specifying general categories of I/O error. -#[deriving(Eq, Clone, Show)] +#[deriving(PartialEq, Clone, Show)] pub enum IoErrorKind { /// Any I/O error not part of this list. OtherIoError, @@ -1582,7 +1582,7 @@ pub enum FileAccess { } /// Different kinds of files which can be identified by a call to stat -#[deriving(Eq, Show, Hash)] +#[deriving(PartialEq, Show, Hash)] pub enum FileType { /// This is a normal file, corresponding to `S_IFREG` TypeFile, @@ -1726,7 +1726,7 @@ mod tests { use prelude::*; use uint; - #[deriving(Clone, Eq, Show)] + #[deriving(Clone, PartialEq, Show)] enum BadReaderBehavior { GoodBehavior(uint), BadBehavior(uint) diff --git a/src/libstd/io/net/ip.rs b/src/libstd/io/net/ip.rs index 5004e8a5a0707..4d0e5e7f72d6d 100644 --- a/src/libstd/io/net/ip.rs +++ b/src/libstd/io/net/ip.rs @@ -25,7 +25,7 @@ use slice::{MutableCloneableVector, ImmutableVector, MutableVector}; pub type Port = u16; -#[deriving(Eq, TotalEq, Clone, Hash)] +#[deriving(PartialEq, TotalEq, Clone, Hash)] pub enum IpAddr { Ipv4Addr(u8, u8, u8, u8), Ipv6Addr(u16, u16, u16, u16, u16, u16, u16, u16) @@ -56,7 +56,7 @@ impl fmt::Show for IpAddr { } } -#[deriving(Eq, TotalEq, Clone, Hash)] +#[deriving(PartialEq, TotalEq, Clone, Hash)] pub struct SocketAddr { pub ip: IpAddr, pub port: Port, diff --git a/src/libstd/io/process.rs b/src/libstd/io/process.rs index 20d20a14f9a18..8325ee4ccd908 100644 --- a/src/libstd/io/process.rs +++ b/src/libstd/io/process.rs @@ -317,7 +317,7 @@ impl fmt::Show for Command { } /// The output of a finished process. -#[deriving(Eq, TotalEq, Clone)] +#[deriving(PartialEq, TotalEq, Clone)] pub struct ProcessOutput { /// The status (exit code) of the process. pub status: ProcessExit, @@ -348,7 +348,7 @@ pub enum StdioContainer { /// Describes the result of a process after it has terminated. /// Note that Windows have no signals, so the result is usually ExitStatus. -#[deriving(Eq, TotalEq, Clone)] +#[deriving(PartialEq, TotalEq, Clone)] pub enum ProcessExit { /// Normal termination with an exit status. ExitStatus(int), diff --git a/src/libstd/io/signal.rs b/src/libstd/io/signal.rs index 4d294e84070fc..05392baff04c3 100644 --- a/src/libstd/io/signal.rs +++ b/src/libstd/io/signal.rs @@ -34,7 +34,7 @@ use vec::Vec; /// Signals that can be sent and received #[repr(int)] -#[deriving(Eq, Hash, Show)] +#[deriving(PartialEq, Hash, Show)] pub enum Signum { /// Equivalent to SIGBREAK, delivered when the user presses Ctrl-Break. Break = 21i, diff --git a/src/libstd/num/mod.rs b/src/libstd/num/mod.rs index 9700f8c9970c4..602a2240f3908 100644 --- a/src/libstd/num/mod.rs +++ b/src/libstd/num/mod.rs @@ -702,7 +702,7 @@ mod tests { test_checked_next_power_of_two!(test_checked_next_power_of_two_u64, u64) test_checked_next_power_of_two!(test_checked_next_power_of_two_uint, uint) - #[deriving(Eq, Show)] + #[deriving(PartialEq, Show)] struct Value { x: int } impl ToPrimitive for Value { diff --git a/src/libstd/num/strconv.rs b/src/libstd/num/strconv.rs index 20f5927c9bd50..54ca579780490 100644 --- a/src/libstd/num/strconv.rs +++ b/src/libstd/num/strconv.rs @@ -20,7 +20,7 @@ use num; use ops::{Add, Sub, Mul, Div, Rem, Neg}; use option::{None, Option, Some}; use slice::{ImmutableVector, MutableVector}; -use std::cmp::{Ord, Eq}; +use std::cmp::{PartialOrd, PartialEq}; use str::StrSlice; use string::String; use vec::Vec; @@ -259,7 +259,7 @@ pub fn int_to_str_bytes_common(num: T, radix: uint, sign: SignFormat, f: * between digit and exponent sign `'p'`. */ #[allow(deprecated)] -pub fn float_to_str_bytes_common+Neg+Rem+Mul>( num: T, radix: uint, negative_zero: bool, sign: SignFormat, digits: SignificantDigits, exp_format: ExponentFormat, exp_upper: bool @@ -492,7 +492,7 @@ pub fn float_to_str_bytes_common+Neg+Rem+Mul>( num: T, radix: uint, negative_zero: bool, sign: SignFormat, digits: SignificantDigits, exp_format: ExponentFormat, exp_capital: bool @@ -547,7 +547,7 @@ static DIGIT_E_RADIX: uint = ('e' as uint) - ('a' as uint) + 11u; * - Fails if `radix` > 18 and `special == true` due to conflict * between digit and lowest first character in `inf` and `NaN`, the `'i'`. */ -pub fn from_str_bytes_common+ +pub fn from_str_bytes_common+ Mul+Sub+Neg+Add+ NumStrConv+Clone>( buf: &[u8], radix: uint, negative: bool, fractional: bool, @@ -754,7 +754,7 @@ pub fn from_str_bytes_common+ * `from_str_bytes_common()`, for details see there. */ #[inline] -pub fn from_str_common+Mul+ +pub fn from_str_common+Mul+ Sub+Neg+Add+NumStrConv+Clone>( buf: &str, radix: uint, negative: bool, fractional: bool, special: bool, exponent: ExponentFormat, empty_zero: bool, diff --git a/src/libstd/path/posix.rs b/src/libstd/path/posix.rs index c0c7a042f11c9..fbecbd7665b50 100644 --- a/src/libstd/path/posix.rs +++ b/src/libstd/path/posix.rs @@ -13,7 +13,7 @@ use container::Container; use c_str::{CString, ToCStr}; use clone::Clone; -use cmp::{Eq, TotalEq}; +use cmp::{PartialEq, TotalEq}; use from_str::FromStr; use io::Writer; use iter::{DoubleEndedIterator, AdditiveIterator, Extendable, Iterator, Map}; @@ -58,7 +58,7 @@ pub fn is_sep(c: char) -> bool { c == SEP } -impl Eq for Path { +impl PartialEq for Path { #[inline] fn eq(&self, other: &Path) -> bool { self.repr == other.repr diff --git a/src/libstd/path/windows.rs b/src/libstd/path/windows.rs index 88c3e9def8cf4..d46a373de4d61 100644 --- a/src/libstd/path/windows.rs +++ b/src/libstd/path/windows.rs @@ -13,7 +13,7 @@ use ascii::AsciiCast; use c_str::{CString, ToCStr}; use clone::Clone; -use cmp::{Eq, TotalEq}; +use cmp::{PartialEq, TotalEq}; use container::Container; use from_str::FromStr; use io::Writer; @@ -79,7 +79,7 @@ pub struct Path { sepidx: Option // index of the final separator in the non-prefix portion of repr } -impl Eq for Path { +impl PartialEq for Path { #[inline] fn eq(&self, other: &Path) -> bool { self.repr == other.repr @@ -956,7 +956,7 @@ pub fn is_sep_byte_verbatim(u: &u8) -> bool { } /// Prefix types for Path -#[deriving(Eq, Clone)] +#[deriving(PartialEq, Clone)] pub enum PathPrefix { /// Prefix `\\?\`, uint is the length of the following component VerbatimPrefix(uint), diff --git a/src/libstd/prelude.rs b/src/libstd/prelude.rs index 07aaeac64be1c..ac1aaa2c6ca9e 100644 --- a/src/libstd/prelude.rs +++ b/src/libstd/prelude.rs @@ -58,7 +58,7 @@ #[doc(no_inline)] pub use c_str::ToCStr; #[doc(no_inline)] pub use char::Char; #[doc(no_inline)] pub use clone::Clone; -#[doc(no_inline)] pub use cmp::{Eq, Ord, TotalEq, TotalOrd}; +#[doc(no_inline)] pub use cmp::{PartialEq, PartialOrd, TotalEq, TotalOrd}; #[doc(no_inline)] pub use cmp::{Ordering, Less, Equal, Greater, Equiv}; #[doc(no_inline)] pub use container::{Container, Mutable, Map, MutableMap}; #[doc(no_inline)] pub use container::{Set, MutableSet}; diff --git a/src/libstd/slice.rs b/src/libstd/slice.rs index 55bea068641e1..1433270346e76 100644 --- a/src/libstd/slice.rs +++ b/src/libstd/slice.rs @@ -1916,7 +1916,7 @@ mod tests { assert!(values == [2, 3, 5, 6, 7]); } - #[deriving(Clone, Eq)] + #[deriving(Clone, PartialEq)] struct Foo; #[test] diff --git a/src/libstd/str.rs b/src/libstd/str.rs index 6538809c8f12d..a35b4e7a151a0 100644 --- a/src/libstd/str.rs +++ b/src/libstd/str.rs @@ -68,7 +68,7 @@ is the same as `&[u8]`. use char::Char; use char; use clone::Clone; -use cmp::{Eq, TotalEq, Ord, TotalOrd, Equiv, Ordering}; +use cmp::{PartialEq, TotalEq, PartialOrd, TotalOrd, Equiv, Ordering}; use container::Container; use default::Default; use fmt; @@ -566,7 +566,7 @@ impl<'a> IntoMaybeOwned<'a> for MaybeOwned<'a> { fn into_maybe_owned(self) -> MaybeOwned<'a> { self } } -impl<'a> Eq for MaybeOwned<'a> { +impl<'a> PartialEq for MaybeOwned<'a> { #[inline] fn eq(&self, other: &MaybeOwned) -> bool { self.as_slice() == other.as_slice() @@ -575,7 +575,7 @@ impl<'a> Eq for MaybeOwned<'a> { impl<'a> TotalEq for MaybeOwned<'a> {} -impl<'a> Ord for MaybeOwned<'a> { +impl<'a> PartialOrd for MaybeOwned<'a> { #[inline] fn lt(&self, other: &MaybeOwned) -> bool { self.as_slice().lt(&other.as_slice()) diff --git a/src/libstd/string.rs b/src/libstd/string.rs index 0edbaf9921003..29d3c7186823e 100644 --- a/src/libstd/string.rs +++ b/src/libstd/string.rs @@ -30,7 +30,7 @@ use str; use vec::Vec; /// A growable string stored as a UTF-8 encoded buffer. -#[deriving(Clone, Eq, Ord, TotalEq, TotalOrd)] +#[deriving(Clone, PartialEq, PartialOrd, TotalEq, TotalOrd)] pub struct String { vec: Vec, } diff --git a/src/libstd/sync/deque.rs b/src/libstd/sync/deque.rs index 46d6129ded8b8..ea4c12f440198 100644 --- a/src/libstd/sync/deque.rs +++ b/src/libstd/sync/deque.rs @@ -102,7 +102,7 @@ pub struct Stealer { } /// When stealing some data, this is an enumeration of the possible outcomes. -#[deriving(Eq, Show)] +#[deriving(PartialEq, Show)] pub enum Stolen { /// The deque was empty at the time of stealing Empty, diff --git a/src/libstd/vec.rs b/src/libstd/vec.rs index 81f6c7c7c9b7d..3cac6fadb9433 100644 --- a/src/libstd/vec.rs +++ b/src/libstd/vec.rs @@ -12,7 +12,7 @@ use RawVec = raw::Vec; use clone::Clone; -use cmp::{Ord, Eq, Ordering, TotalEq, TotalOrd, max}; +use cmp::{PartialOrd, PartialEq, Ordering, TotalEq, TotalOrd, max}; use container::{Container, Mutable}; use default::Default; use fmt; @@ -374,14 +374,14 @@ impl Extendable for Vec { } } -impl Eq for Vec { +impl PartialEq for Vec { #[inline] fn eq(&self, other: &Vec) -> bool { self.as_slice() == other.as_slice() } } -impl Ord for Vec { +impl PartialOrd for Vec { #[inline] fn lt(&self, other: &Vec) -> bool { self.as_slice() < other.as_slice() @@ -1288,7 +1288,7 @@ impl Mutable for Vec { } } -impl Vec { +impl Vec { /// Return true if a vector contains an element with the given value /// /// # Example @@ -1315,7 +1315,7 @@ impl Vec { pub fn dedup(&mut self) { unsafe { // Although we have a mutable reference to `self`, we cannot make - // *arbitrary* changes. The `Eq` comparisons could fail, so we + // *arbitrary* changes. The `PartialEq` comparisons could fail, so we // must ensure that the vector is in a valid state at all time. // // The way that we handle this is by using swaps; we iterate diff --git a/src/libsync/mutex.rs b/src/libsync/mutex.rs index 54c3a9c77f816..ee7fa525e79f5 100644 --- a/src/libsync/mutex.rs +++ b/src/libsync/mutex.rs @@ -97,7 +97,7 @@ pub struct Mutex { lock: StaticMutex, } -#[deriving(Eq, Show)] +#[deriving(PartialEq, Show)] enum Flavor { Unlocked, TryLockAcquisition, diff --git a/src/libsyntax/abi.rs b/src/libsyntax/abi.rs index 089cd772bb48d..e61c1c24c2f89 100644 --- a/src/libsyntax/abi.rs +++ b/src/libsyntax/abi.rs @@ -10,10 +10,10 @@ use std::fmt; -#[deriving(Eq)] +#[deriving(PartialEq)] pub enum Os { OsWin32, OsMacos, OsLinux, OsAndroid, OsFreebsd, } -#[deriving(Eq, TotalEq, Hash, Encodable, Decodable, Clone)] +#[deriving(PartialEq, TotalEq, Hash, Encodable, Decodable, Clone)] pub enum Abi { // NB: This ordering MUST match the AbiDatas array below. // (This is ensured by the test indices_are_correct().) @@ -33,7 +33,7 @@ pub enum Abi { } #[allow(non_camel_case_types)] -#[deriving(Eq)] +#[deriving(PartialEq)] pub enum Architecture { // NB. You cannot change the ordering of these // constants without adjusting IntelBits below. diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 656ae80e12d64..5eb9308e44338 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -39,7 +39,7 @@ pub fn P(value: T) -> P { // table) and a SyntaxContext to track renaming and // macro expansion per Flatt et al., "Macros // That Work Together" -#[deriving(Clone, Hash, Ord, TotalEq, TotalOrd, Show)] +#[deriving(Clone, Hash, PartialOrd, TotalEq, TotalOrd, Show)] pub struct Ident { pub name: Name, pub ctxt: SyntaxContext @@ -50,7 +50,7 @@ impl Ident { pub fn new(name: Name) -> Ident { Ident {name: name, ctxt: EMPTY_CTXT}} } -impl Eq for Ident { +impl PartialEq for Ident { fn eq(&self, other: &Ident) -> bool { if self.ctxt == other.ctxt { self.name == other.name @@ -114,7 +114,7 @@ impl, E> Decodable for Ident { /// Function name (not all functions have names) pub type FnIdent = Option; -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct Lifetime { pub id: NodeId, pub span: Span, @@ -122,10 +122,10 @@ pub struct Lifetime { } // a "Path" is essentially Rust's notion of a name; -// for instance: std::cmp::Eq . It's represented +// for instance: std::cmp::PartialEq . It's represented // as a sequence of identifiers, along with a bunch // of supporting information. -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct Path { pub span: Span, /// A `::foo` path, is relative to the crate root rather than current @@ -137,7 +137,7 @@ pub struct Path { /// A segment of a path: an identifier, an optional lifetime, and a set of /// types. -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct PathSegment { /// The identifier portion of this path segment. pub identifier: Ident, @@ -151,7 +151,7 @@ pub type CrateNum = u32; pub type NodeId = u32; -#[deriving(Clone, TotalEq, TotalOrd, Ord, Eq, Encodable, Decodable, Hash, Show)] +#[deriving(Clone, TotalEq, TotalOrd, PartialOrd, PartialEq, Encodable, Decodable, Hash, Show)] pub struct DefId { pub krate: CrateNum, pub node: NodeId, @@ -171,14 +171,14 @@ pub static DUMMY_NODE_ID: NodeId = -1; // typeck::collect::compute_bounds matches these against // the "special" built-in traits (see middle::lang_items) and // detects Copy, Send and Share. -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum TyParamBound { TraitTyParamBound(TraitRef), StaticRegionTyParamBound, OtherRegionTyParamBound(Span) // FIXME -- just here until work for #5723 lands } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct TyParam { pub ident: Ident, pub id: NodeId, @@ -188,7 +188,7 @@ pub struct TyParam { pub span: Span } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct Generics { pub lifetimes: Vec, pub ty_params: OwnedSlice, @@ -206,13 +206,13 @@ impl Generics { } } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum MethodProvenance { FromTrait(DefId), FromImpl(DefId), } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum Def { DefFn(DefId, FnStyle), DefStaticMethod(/* method */ DefId, MethodProvenance, FnStyle), @@ -249,7 +249,7 @@ pub enum Def { DefMethod(DefId /* method */, Option /* trait */), } -#[deriving(Clone, Eq, TotalEq, Hash, Encodable, Decodable, Show)] +#[deriving(Clone, PartialEq, TotalEq, Hash, Encodable, Decodable, Show)] pub enum DefRegion { DefStaticRegion, DefEarlyBoundRegion(/* index */ uint, /* lifetime decl */ NodeId), @@ -261,7 +261,7 @@ pub enum DefRegion { // used to drive conditional compilation pub type CrateConfig = Vec<@MetaItem> ; -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct Crate { pub module: Mod, pub attrs: Vec, @@ -279,7 +279,7 @@ pub enum MetaItem_ { } // can't be derived because the MetaList requires an unordered comparison -impl Eq for MetaItem_ { +impl PartialEq for MetaItem_ { fn eq(&self, other: &MetaItem_) -> bool { match *self { MetaWord(ref ns) => match *other { @@ -303,7 +303,7 @@ impl Eq for MetaItem_ { } } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct Block { pub view_items: Vec, pub stmts: Vec<@Stmt>, @@ -313,26 +313,26 @@ pub struct Block { pub span: Span, } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct Pat { pub id: NodeId, pub node: Pat_, pub span: Span, } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct FieldPat { pub ident: Ident, pub pat: @Pat, } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum BindingMode { BindByRef(Mutability), BindByValue(Mutability), } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum Pat_ { PatWild, PatWildMulti, @@ -358,20 +358,20 @@ pub enum Pat_ { PatMac(Mac), } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash, Show)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash, Show)] pub enum Mutability { MutMutable, MutImmutable, } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum ExprVstore { ExprVstoreUniq, // ~[1,2,3,4] ExprVstoreSlice, // &[1,2,3,4] ExprVstoreMutSlice, // &mut [1,2,3,4] } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum BinOp { BiAdd, BiSub, @@ -393,7 +393,7 @@ pub enum BinOp { BiGt, } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum UnOp { UnBox, UnUniq, @@ -404,7 +404,7 @@ pub enum UnOp { pub type Stmt = Spanned; -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum Stmt_ { // could be an item or a local (let) binding: StmtDecl(@Decl, NodeId), @@ -421,7 +421,7 @@ pub enum Stmt_ { /// Where a local declaration came from: either a true `let ... = /// ...;`, or one desugared from the pattern of a for loop. -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum LocalSource { LocalLet, LocalFor, @@ -430,7 +430,7 @@ pub enum LocalSource { // FIXME (pending discussion of #1697, #2178...): local should really be // a refinement on pat. /// Local represents a `let` statement, e.g., `let : = ;` -#[deriving(Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct Local { pub ty: P, pub pat: @Pat, @@ -442,7 +442,7 @@ pub struct Local { pub type Decl = Spanned; -#[deriving(Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum Decl_ { // a local (let) binding: DeclLocal(@Local), @@ -450,7 +450,7 @@ pub enum Decl_ { DeclItem(@Item), } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct Arm { pub attrs: Vec, pub pats: Vec<@Pat>, @@ -458,7 +458,7 @@ pub struct Arm { pub body: @Expr, } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct Field { pub ident: SpannedIdent, pub expr: @Expr, @@ -467,26 +467,26 @@ pub struct Field { pub type SpannedIdent = Spanned; -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum BlockCheckMode { DefaultBlock, UnsafeBlock(UnsafeSource), } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum UnsafeSource { CompilerGenerated, UserProvided, } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct Expr { pub id: NodeId, pub node: Expr_, pub span: Span, } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum Expr_ { ExprVstore(@Expr, ExprVstore), // First expr is the place; second expr is the value. @@ -555,7 +555,7 @@ pub enum Expr_ { // else knows what to do with them, so you'll probably get a syntax // error. // -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] #[doc="For macro invocations; parsing is delegated to the macro"] pub enum TokenTree { // a single token @@ -631,7 +631,7 @@ pub enum TokenTree { // pub type Matcher = Spanned; -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum Matcher_ { // match one token MatchTok(::parse::token::Token), @@ -648,12 +648,12 @@ pub type Mac = Spanned; // is being invoked, and the vector of token-trees contains the source // of the macro invocation. // There's only one flavor, now, so this could presumably be simplified. -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum Mac_ { MacInvocTT(Path, Vec , SyntaxContext), // new macro-invocation } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum StrStyle { CookedStr, RawStr(uint) @@ -661,7 +661,7 @@ pub enum StrStyle { pub type Lit = Spanned; -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum Lit_ { LitStr(InternedString, StrStyle), LitBinary(Rc >), @@ -677,20 +677,20 @@ pub enum Lit_ { // NB: If you change this, you'll probably want to change the corresponding // type structure in middle/ty.rs as well. -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct MutTy { pub ty: P, pub mutbl: Mutability, } -#[deriving(Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct TypeField { pub ident: Ident, pub mt: MutTy, pub span: Span, } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct TypeMethod { pub ident: Ident, pub attrs: Vec, @@ -706,13 +706,13 @@ pub struct TypeMethod { // A trait method is either required (meaning it doesn't have an // implementation, just a signature) or provided (meaning it has a default // implementation). -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum TraitMethod { Required(TypeMethod), Provided(@Method), } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum IntTy { TyI, TyI8, @@ -728,7 +728,7 @@ impl fmt::Show for IntTy { } } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum UintTy { TyU, TyU8, @@ -744,7 +744,7 @@ impl fmt::Show for UintTy { } } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum FloatTy { TyF32, TyF64, @@ -757,8 +757,8 @@ impl fmt::Show for FloatTy { } } -// NB Eq method appears below. -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +// NB PartialEq method appears below. +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct Ty { pub id: NodeId, pub node: Ty_, @@ -766,7 +766,7 @@ pub struct Ty { } // Not represented directly in the AST, referred to by name through a ty_path. -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum PrimTy { TyInt(IntTy), TyUint(UintTy), @@ -776,7 +776,7 @@ pub enum PrimTy { TyChar } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum Onceness { Once, Many @@ -791,7 +791,7 @@ impl fmt::Show for Onceness { } } -#[deriving(Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct ClosureTy { pub lifetimes: Vec, pub fn_style: FnStyle, @@ -804,7 +804,7 @@ pub struct ClosureTy { pub bounds: Option>, } -#[deriving(Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct BareFnTy { pub fn_style: FnStyle, pub abi: Abi, @@ -812,7 +812,7 @@ pub struct BareFnTy { pub decl: P } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum Ty_ { TyNil, TyBot, /* bottom type */ @@ -833,13 +833,13 @@ pub enum Ty_ { TyInfer, } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum AsmDialect { AsmAtt, AsmIntel } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct InlineAsm { pub asm: InternedString, pub asm_str_style: StrStyle, @@ -851,7 +851,7 @@ pub struct InlineAsm { pub dialect: AsmDialect } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct Arg { pub ty: P, pub pat: @Pat, @@ -878,7 +878,7 @@ impl Arg { } } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct FnDecl { pub inputs: Vec, pub output: P, @@ -886,7 +886,7 @@ pub struct FnDecl { pub variadic: bool } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum FnStyle { UnsafeFn, // declared with "unsafe fn" NormalFn, // declared with "fn" @@ -901,14 +901,14 @@ impl fmt::Show for FnStyle { } } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum RetStyle { NoReturn, // functions with return type _|_ that always // raise an error or exit (i.e. never return to the caller) Return, // everything else } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum ExplicitSelf_ { SelfStatic, // no self SelfValue, // `self` @@ -918,7 +918,7 @@ pub enum ExplicitSelf_ { pub type ExplicitSelf = Spanned; -#[deriving(Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct Method { pub ident: Ident, pub attrs: Vec, @@ -932,7 +932,7 @@ pub struct Method { pub vis: Visibility, } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct Mod { /// A span from the first token past `{` to the last token until `}`. /// For `mod foo;`, the inner span ranges from the first token @@ -942,31 +942,31 @@ pub struct Mod { pub items: Vec<@Item>, } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct ForeignMod { pub abi: Abi, pub view_items: Vec, pub items: Vec<@ForeignItem>, } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct VariantArg { pub ty: P, pub id: NodeId, } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum VariantKind { TupleVariantKind(Vec), StructVariantKind(@StructDef), } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct EnumDef { pub variants: Vec>, } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct Variant_ { pub name: Ident, pub attrs: Vec, @@ -978,7 +978,7 @@ pub struct Variant_ { pub type Variant = Spanned; -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct PathListIdent_ { pub name: Ident, pub id: NodeId, @@ -988,7 +988,7 @@ pub type PathListIdent = Spanned; pub type ViewPath = Spanned; -#[deriving(Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum ViewPath_ { // quux = foo::bar::baz @@ -1005,7 +1005,7 @@ pub enum ViewPath_ { ViewPathList(Path, Vec , NodeId) } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct ViewItem { pub node: ViewItem_, pub attrs: Vec, @@ -1013,7 +1013,7 @@ pub struct ViewItem { pub span: Span, } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum ViewItem_ { // ident: name used to refer to this crate in the code // optional (InternedString,StrStyle): if present, this is a location @@ -1029,17 +1029,17 @@ pub type Attribute = Spanned; // Distinguishes between Attributes that decorate items and Attributes that // are contained as statements within items. These two cases need to be // distinguished for pretty-printing. -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum AttrStyle { AttrOuter, AttrInner, } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct AttrId(pub uint); // doc-comments are promoted to attributes that have is_sugared_doc = true -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct Attribute_ { pub id: AttrId, pub style: AttrStyle, @@ -1054,13 +1054,13 @@ pub struct Attribute_ { If this impl is an ItemImpl, the impl_id is redundant (it could be the same as the impl's node id). */ -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct TraitRef { pub path: Path, pub ref_id: NodeId, } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum Visibility { Public, Inherited, @@ -1075,13 +1075,13 @@ impl Visibility { } } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum Sized { DynSize, StaticSize, } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct StructField_ { pub kind: StructFieldKind, pub id: NodeId, @@ -1091,7 +1091,7 @@ pub struct StructField_ { pub type StructField = Spanned; -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum StructFieldKind { NamedField(Ident, Visibility), UnnamedField(Visibility), // element of a tuple-like struct @@ -1106,7 +1106,7 @@ impl StructFieldKind { } } -#[deriving(Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct StructDef { pub fields: Vec, /* fields, not including ctor */ /* ID of the constructor. This is only used for tuple- or enum-like @@ -1120,7 +1120,7 @@ pub struct StructDef { FIXME (#3300): Should allow items to be anonymous. Right now we just use dummy names for anon items. */ -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct Item { pub ident: Ident, pub attrs: Vec, @@ -1130,7 +1130,7 @@ pub struct Item { pub span: Span, } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum Item_ { ItemStatic(P, Mutability, @Expr), ItemFn(P, FnStyle, Abi, Generics, P), @@ -1148,7 +1148,7 @@ pub enum Item_ { ItemMac(Mac), } -#[deriving(Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct ForeignItem { pub ident: Ident, pub attrs: Vec, @@ -1158,7 +1158,7 @@ pub struct ForeignItem { pub vis: Visibility, } -#[deriving(Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum ForeignItem_ { ForeignItemFn(P, Generics), ForeignItemStatic(P, /* is_mutbl */ bool), @@ -1167,7 +1167,7 @@ pub enum ForeignItem_ { // The data we save and restore about an inlined item or method. This is not // part of the AST that we parse from a file, but it becomes part of the tree // that we trans. -#[deriving(Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum InlinedItem { IIItem(@Item), IIMethod(DefId /* impl id */, bool /* is provided */, @Method), diff --git a/src/libsyntax/ast_map.rs b/src/libsyntax/ast_map.rs index 6b81f8ee2e108..9a7b4f7d9497a 100644 --- a/src/libsyntax/ast_map.rs +++ b/src/libsyntax/ast_map.rs @@ -24,7 +24,7 @@ use std::iter; use std::slice; use std::string::String; -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] pub enum PathElem { PathMod(Name), PathName(Name) diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs index 527e851ae35ac..4a38835f86bec 100644 --- a/src/libsyntax/attr.rs +++ b/src/libsyntax/attr.rs @@ -307,7 +307,7 @@ pub fn find_crateid(attrs: &[Attribute]) -> Option { } } -#[deriving(Eq)] +#[deriving(PartialEq)] pub enum InlineAttr { InlineNone, InlineHint, @@ -396,7 +396,7 @@ pub struct Stability { } /// The available stability levels. -#[deriving(Eq,Ord,Clone,Show)] +#[deriving(PartialEq,PartialOrd,Clone,Show)] pub enum StabilityLevel { Deprecated, Experimental, @@ -522,7 +522,7 @@ fn int_type_of_word(s: &str) -> Option { } } -#[deriving(Eq, Show)] +#[deriving(PartialEq, Show)] pub enum ReprAttr { ReprAny, ReprInt(Span, IntType), @@ -539,7 +539,7 @@ impl ReprAttr { } } -#[deriving(Eq, Show)] +#[deriving(PartialEq, Show)] pub enum IntType { SignedInt(ast::IntTy), UnsignedInt(ast::UintTy) diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs index 1ef7576335ba5..59bf9608a097d 100644 --- a/src/libsyntax/codemap.rs +++ b/src/libsyntax/codemap.rs @@ -33,13 +33,13 @@ pub trait Pos { /// A byte offset. Keep this small (currently 32-bits), as AST contains /// a lot of them. -#[deriving(Clone, Eq, TotalEq, Hash, Ord, Show)] +#[deriving(Clone, PartialEq, TotalEq, Hash, PartialOrd, Show)] pub struct BytePos(pub u32); /// A character offset. Because of multibyte utf8 characters, a byte offset /// is not equivalent to a character offset. The CodeMap will convert BytePos /// values to CharPos values as necessary. -#[deriving(Eq, Hash, Ord, Show)] +#[deriving(PartialEq, Hash, PartialOrd, Show)] pub struct CharPos(pub uint); // FIXME: Lots of boilerplate in these impls, but so far my attempts to fix @@ -96,13 +96,13 @@ pub struct Span { pub static DUMMY_SP: Span = Span { lo: BytePos(0), hi: BytePos(0), expn_info: None }; -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct Spanned { pub node: T, pub span: Span, } -impl Eq for Span { +impl PartialEq for Span { fn eq(&self, other: &Span) -> bool { return (*self).lo == (*other).lo && (*self).hi == (*other).hi; } diff --git a/src/libsyntax/crateid.rs b/src/libsyntax/crateid.rs index 329ddcad461e2..3f74598d2e577 100644 --- a/src/libsyntax/crateid.rs +++ b/src/libsyntax/crateid.rs @@ -20,7 +20,7 @@ use std::fmt; use std::from_str::FromStr; -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] pub struct CrateId { /// A path which represents the codes origin. By convention this is the /// URL, without `http://` or `https://` prefix, to the crate's repository diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs index 49da91e10533d..ee06efbec1343 100644 --- a/src/libsyntax/diagnostic.rs +++ b/src/libsyntax/diagnostic.rs @@ -194,7 +194,7 @@ pub fn mk_handler(e: Box) -> Handler { } } -#[deriving(Eq)] +#[deriving(PartialEq)] pub enum Level { Bug, Fatal, diff --git a/src/libsyntax/ext/deriving/generic/mod.rs b/src/libsyntax/ext/deriving/generic/mod.rs index 0f4af144eadea..e2290129dc8b4 100644 --- a/src/libsyntax/ext/deriving/generic/mod.rs +++ b/src/libsyntax/ext/deriving/generic/mod.rs @@ -24,7 +24,7 @@ Supported features (fairly exhaustive): current trait as a bound. (This includes separate type parameters and lifetimes for methods.) - Additional bounds on the type parameters, e.g. the `Ord` instance - requires an explicit `Eq` bound at the + requires an explicit `PartialEq` bound at the moment. (`TraitDef.additional_bounds`) Unsupported: FIXME #6257: calling methods on reference fields, @@ -82,13 +82,13 @@ variants, it is represented as a count of 0. # Examples -The following simplified `Eq` is used for in-code examples: +The following simplified `PartialEq` is used for in-code examples: ```rust -trait Eq { +trait PartialEq { fn eq(&self, other: &Self); } -impl Eq for int { +impl PartialEq for int { fn eq(&self, other: &int) -> bool { *self == *other } @@ -96,7 +96,7 @@ impl Eq for int { ``` Some examples of the values of `SubstructureFields` follow, using the -above `Eq`, `A`, `B` and `C`. +above `PartialEq`, `A`, `B` and `C`. ## Structs @@ -645,11 +645,11 @@ impl<'a> MethodDef<'a> { /** ~~~ - #[deriving(Eq)] + #[deriving(PartialEq)] struct A { x: int, y: int } // equivalent to: - impl Eq for A { + impl PartialEq for A { fn eq(&self, __arg_1: &A) -> bool { match *self { A {x: ref __self_0_0, y: ref __self_0_1} => { @@ -750,7 +750,7 @@ impl<'a> MethodDef<'a> { /** ~~~ - #[deriving(Eq)] + #[deriving(PartialEq)] enum A { A1 A2(int) @@ -758,7 +758,7 @@ impl<'a> MethodDef<'a> { // is equivalent to (with const_nonmatching == false) - impl Eq for A { + impl PartialEq for A { fn eq(&self, __arg_1: &A) { match *self { A1 => match *__arg_1 { @@ -994,7 +994,7 @@ impl<'a> MethodDef<'a> { } } -#[deriving(Eq)] // dogfooding! +#[deriving(PartialEq)] // dogfooding! enum StructType { Unknown, Record, Tuple } diff --git a/src/libsyntax/ext/deriving/mod.rs b/src/libsyntax/ext/deriving/mod.rs index e5da7330a6cda..3735248e9e29c 100644 --- a/src/libsyntax/ext/deriving/mod.rs +++ b/src/libsyntax/ext/deriving/mod.rs @@ -77,10 +77,9 @@ pub fn expand_meta_deriving(cx: &mut ExtCtxt, "Encodable" => expand!(encodable::expand_deriving_encodable), "Decodable" => expand!(decodable::expand_deriving_decodable), - // NOTE this needs treatment after a stage0 snap - "PartialEq" | "Eq" => expand!(eq::expand_deriving_eq), + "PartialEq" => expand!(eq::expand_deriving_eq), "TotalEq" => expand!(totaleq::expand_deriving_totaleq), - "PartialOrd" | "Ord" => expand!(ord::expand_deriving_ord), + "PartialOrd" => expand!(ord::expand_deriving_ord), "TotalOrd" => expand!(totalord::expand_deriving_totalord), "Rand" => expand!(rand::expand_deriving_rand), diff --git a/src/libsyntax/ext/format.rs b/src/libsyntax/ext/format.rs index c05fc8ce6d9e6..0d228a1146d32 100644 --- a/src/libsyntax/ext/format.rs +++ b/src/libsyntax/ext/format.rs @@ -21,7 +21,7 @@ use rsparse = parse; use parse = fmt_macros; use collections::{HashMap, HashSet}; -#[deriving(Eq)] +#[deriving(PartialEq)] enum ArgumentType { Known(String), Unsigned, diff --git a/src/libsyntax/ext/mtwt.rs b/src/libsyntax/ext/mtwt.rs index fdaa3b5630ab1..12e314781aeb5 100644 --- a/src/libsyntax/ext/mtwt.rs +++ b/src/libsyntax/ext/mtwt.rs @@ -37,7 +37,7 @@ pub struct SCTable { rename_memo: RefCell>, } -#[deriving(Eq, Encodable, Decodable, Hash)] +#[deriving(PartialEq, Encodable, Decodable, Hash)] pub enum SyntaxContext_ { EmptyCtxt, Mark (Mrk,SyntaxContext), @@ -294,7 +294,7 @@ mod tests { // because of the SCTable, I now need a tidy way of // creating syntax objects. Sigh. - #[deriving(Clone, Eq, Show)] + #[deriving(Clone, PartialEq, Show)] enum TestSC { M(Mrk), R(Ident,Name) diff --git a/src/libsyntax/owned_slice.rs b/src/libsyntax/owned_slice.rs index f93c3576943ef..c04c10e0d7217 100644 --- a/src/libsyntax/owned_slice.rs +++ b/src/libsyntax/owned_slice.rs @@ -113,7 +113,7 @@ impl> Hash for OwnedSlice { } } -impl Eq for OwnedSlice { +impl PartialEq for OwnedSlice { fn eq(&self, other: &OwnedSlice) -> bool { self.as_slice() == other.as_slice() } diff --git a/src/libsyntax/parse/comments.rs b/src/libsyntax/parse/comments.rs index cc08cb429f55f..622ed6b9801d1 100644 --- a/src/libsyntax/parse/comments.rs +++ b/src/libsyntax/parse/comments.rs @@ -22,7 +22,7 @@ use std::str; use std::string::String; use std::uint; -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] pub enum CommentStyle { Isolated, // No code on either side of each line of the comment Trailing, // Code exists to the left of the comment diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs index fb67a76b85b4c..f5386b43d5127 100644 --- a/src/libsyntax/parse/lexer.rs +++ b/src/libsyntax/parse/lexer.rs @@ -34,7 +34,7 @@ pub trait Reader { fn peek(&self) -> TokenAndSpan; } -#[deriving(Clone, Eq, Show)] +#[deriving(Clone, PartialEq, Show)] pub struct TokenAndSpan { pub tok: token::Token, pub sp: Span, diff --git a/src/libsyntax/parse/obsolete.rs b/src/libsyntax/parse/obsolete.rs index f045a7fe12093..b7121c6b32c56 100644 --- a/src/libsyntax/parse/obsolete.rs +++ b/src/libsyntax/parse/obsolete.rs @@ -23,7 +23,7 @@ use parse::parser; use parse::token; /// The specific types of unsupported syntax -#[deriving(Eq, TotalEq, Hash)] +#[deriving(PartialEq, TotalEq, Hash)] pub enum ObsoleteSyntax { ObsoleteOwnedType, ObsoleteOwnedExpr, diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 00c07ce59f989..6c09fa20510e5 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -82,7 +82,7 @@ use std::rc::Rc; use std::string::String; #[allow(non_camel_case_types)] -#[deriving(Eq)] +#[deriving(PartialEq)] pub enum restriction { UNRESTRICTED, RESTRICT_STMT_EXPR, @@ -94,7 +94,7 @@ type ItemInfo = (Ident, Item_, Option >); /// How to parse a path. There are four different kinds of paths, all of which /// are parsed somewhat differently. -#[deriving(Eq)] +#[deriving(PartialEq)] pub enum PathParsingMode { /// A path with no type parameters; e.g. `foo::bar::Baz` NoTypesAllowed, diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index 2c090d053a3d2..192adfe782918 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -24,7 +24,7 @@ use std::rc::Rc; use std::string::String; #[allow(non_camel_case_types)] -#[deriving(Clone, Encodable, Decodable, Eq, TotalEq, Hash, Show)] +#[deriving(Clone, Encodable, Decodable, PartialEq, TotalEq, Hash, Show)] pub enum BinOp { PLUS, MINUS, @@ -39,7 +39,7 @@ pub enum BinOp { } #[allow(non_camel_case_types)] -#[deriving(Clone, Encodable, Decodable, Eq, TotalEq, Hash, Show)] +#[deriving(Clone, Encodable, Decodable, PartialEq, TotalEq, Hash, Show)] pub enum Token { /* Expression-operator symbols. */ EQ, @@ -102,7 +102,7 @@ pub enum Token { EOF, } -#[deriving(Clone, Encodable, Decodable, Eq, TotalEq, Hash)] +#[deriving(Clone, Encodable, Decodable, PartialEq, TotalEq, Hash)] /// For interpolation during macro expansion. pub enum Nonterminal { NtItem(@ast::Item), @@ -552,7 +552,7 @@ pub fn get_ident_interner() -> Rc { /// destroyed. In particular, they must not access string contents. This can /// be fixed in the future by just leaking all strings until task death /// somehow. -#[deriving(Clone, Eq, Hash, Ord, TotalEq, TotalOrd)] +#[deriving(Clone, PartialEq, Hash, PartialOrd, TotalEq, TotalOrd)] pub struct InternedString { string: RcStr, } diff --git a/src/libsyntax/print/pp.rs b/src/libsyntax/print/pp.rs index 669378b313ad1..ec9ca65506458 100644 --- a/src/libsyntax/print/pp.rs +++ b/src/libsyntax/print/pp.rs @@ -64,7 +64,7 @@ use std::io; use std::string::String; -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] pub enum Breaks { Consistent, Inconsistent, diff --git a/src/libsyntax/util/interner.rs b/src/libsyntax/util/interner.rs index 72600921ba9c7..d2361810a2421 100644 --- a/src/libsyntax/util/interner.rs +++ b/src/libsyntax/util/interner.rs @@ -90,7 +90,7 @@ impl Interner { } } -#[deriving(Clone, Eq, Hash, Ord)] +#[deriving(Clone, PartialEq, Hash, PartialOrd)] pub struct RcStr { string: Rc, } diff --git a/src/libterm/terminfo/parm.rs b/src/libterm/terminfo/parm.rs index 3da8d7672f563..6795b10f4c7a1 100644 --- a/src/libterm/terminfo/parm.rs +++ b/src/libterm/terminfo/parm.rs @@ -13,7 +13,7 @@ use std::char; use std::mem::replace; -#[deriving(Eq)] +#[deriving(PartialEq)] enum States { Nothing, Percent, @@ -30,7 +30,7 @@ enum States { SeekIfEndPercent(int) } -#[deriving(Eq)] +#[deriving(PartialEq)] enum FormatState { FormatStateFlags, FormatStateWidth, @@ -434,7 +434,7 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables) Ok(output) } -#[deriving(Eq)] +#[deriving(PartialEq)] struct Flags { width: uint, precision: uint, diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index 1de7f90c8069d..bc69dc442dc65 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -83,7 +83,7 @@ pub mod stats; // colons. This way if some test runner wants to arrange the tests // hierarchically it may. -#[deriving(Clone, Eq, TotalEq, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Hash)] pub enum TestName { StaticTestName(&'static str), DynTestName(String) @@ -183,7 +183,7 @@ pub struct Bencher { // The definition of a single test. A test runner will run a list of // these. -#[deriving(Clone, Show, Eq, TotalEq, Hash)] +#[deriving(Clone, Show, PartialEq, TotalEq, Hash)] pub struct TestDesc { pub name: TestName, pub ignore: bool, @@ -196,7 +196,7 @@ pub struct TestDescAndFn { pub testfn: TestFn, } -#[deriving(Clone, Encodable, Decodable, Eq, Show)] +#[deriving(Clone, Encodable, Decodable, PartialEq, Show)] pub struct Metric { value: f64, noise: f64 @@ -208,7 +208,7 @@ impl Metric { } } -#[deriving(Eq)] +#[deriving(PartialEq)] pub struct MetricMap(TreeMap); impl Clone for MetricMap { @@ -219,7 +219,7 @@ impl Clone for MetricMap { } /// Analysis of a single change in metric -#[deriving(Eq, Show)] +#[deriving(PartialEq, Show)] pub enum MetricChange { LikelyNoise, MetricAdded, @@ -444,13 +444,13 @@ pub fn opt_shard(maybestr: Option) -> Option<(uint,uint)> { } -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] pub struct BenchSamples { ns_iter_summ: stats::Summary, mb_s: uint, } -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] pub enum TestResult { TrOk, TrFailed, diff --git a/src/libtest/stats.rs b/src/libtest/stats.rs index 77b1eae0a56c6..16a96d9f606c4 100644 --- a/src/libtest/stats.rs +++ b/src/libtest/stats.rs @@ -126,7 +126,7 @@ pub trait Stats { } /// Extracted collection of all the summary statistics of a sample set. -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] #[allow(missing_doc)] pub struct Summary { pub sum: T, diff --git a/src/libtime/lib.rs b/src/libtime/lib.rs index e9b20c0117d98..91e608360bc4a 100644 --- a/src/libtime/lib.rs +++ b/src/libtime/lib.rs @@ -74,7 +74,7 @@ mod imp { } /// A record specifying a time value in seconds and nanoseconds. -#[deriving(Clone, Eq, TotalEq, Ord, TotalOrd, Encodable, Decodable, Show)] +#[deriving(Clone, PartialEq, TotalEq, PartialOrd, TotalOrd, Encodable, Decodable, Show)] pub struct Timespec { pub sec: i64, pub nsec: i32 } /* * Timespec assumes that pre-epoch Timespecs have negative sec and positive @@ -202,7 +202,7 @@ pub fn tzset() { /// Holds a calendar date and time broken down into its components (year, month, day, and so on), /// also called a broken-down time value. -#[deriving(Clone, Eq, Show)] +#[deriving(Clone, PartialEq, Show)] pub struct Tm { /// Seconds after the minute – [0, 60] pub tm_sec: i32, diff --git a/src/liburl/lib.rs b/src/liburl/lib.rs index b049246ca1883..2120bc10dab84 100644 --- a/src/liburl/lib.rs +++ b/src/liburl/lib.rs @@ -22,7 +22,7 @@ extern crate collections; use collections::HashMap; -use std::cmp::Eq; +use std::cmp::PartialEq; use std::fmt; use std::from_str::FromStr; use std::hash::Hash; @@ -48,7 +48,7 @@ use std::uint; /// fragment: Some("quz".to_string()) }; /// // https://username@example.com:8080/foo/bar?baz=qux#quz /// ``` -#[deriving(Clone, Eq, TotalEq)] +#[deriving(Clone, PartialEq, TotalEq)] pub struct Url { /// The scheme part of a URL, such as `https` in the above example. pub scheme: String, @@ -68,7 +68,7 @@ pub struct Url { pub fragment: Option } -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] pub struct Path { /// The path component of a URL, for example `/foo/bar`. pub path: String, @@ -81,7 +81,7 @@ pub struct Path { } /// An optional subcomponent of a URI authority component. -#[deriving(Clone, Eq, TotalEq)] +#[deriving(Clone, PartialEq, TotalEq)] pub struct UserInfo { /// The user name. pub user: String, @@ -515,7 +515,7 @@ pub fn get_scheme(rawurl: &str) -> Result<(String, String), String> { return Err("url: Scheme must be terminated with a colon.".to_string()); } -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] enum Input { Digit, // all digits Hex, // digits and letters a-f diff --git a/src/libuuid/lib.rs b/src/libuuid/lib.rs index c157d83ced13d..a5b28b73023bc 100644 --- a/src/libuuid/lib.rs +++ b/src/libuuid/lib.rs @@ -87,7 +87,7 @@ use serialize::{Encoder, Encodable, Decoder, Decodable}; pub type UuidBytes = [u8, ..16]; /// The version of the UUID, denoting the generating algorithm -#[deriving(Eq)] +#[deriving(PartialEq)] pub enum UuidVersion { /// Version 1: MAC address Version1Mac = 1, @@ -102,7 +102,7 @@ pub enum UuidVersion { } /// The reserved variants of UUIDs -#[deriving(Eq)] +#[deriving(PartialEq)] pub enum UuidVariant { /// Reserved by the NCS for backward compatibility VariantNCS, @@ -481,7 +481,7 @@ impl fmt::Show for Uuid { /// Test two UUIDs for equality /// /// UUIDs are equal only when they are byte-for-byte identical -impl Eq for Uuid { +impl PartialEq for Uuid { fn eq(&self, other: &Uuid) -> bool { self.bytes == other.bytes } diff --git a/src/libworkcache/lib.rs b/src/libworkcache/lib.rs index 064979fa2771c..7c3fc18dd0412 100644 --- a/src/libworkcache/lib.rs +++ b/src/libworkcache/lib.rs @@ -99,7 +99,7 @@ use std::str; use std::io; use std::io::{File, MemWriter}; -#[deriving(Clone, Eq, Encodable, Decodable, Ord, TotalOrd, TotalEq)] +#[deriving(Clone, PartialEq, Encodable, Decodable, PartialOrd, TotalOrd, TotalEq)] struct WorkKey { kind: String, name: String @@ -116,10 +116,10 @@ impl WorkKey { // FIXME #8883: The key should be a WorkKey and not a String. // This is working around some JSON weirdness. -#[deriving(Clone, Eq, Encodable, Decodable)] +#[deriving(Clone, PartialEq, Encodable, Decodable)] struct WorkMap(TreeMap); -#[deriving(Clone, Eq, Encodable, Decodable)] +#[deriving(Clone, PartialEq, Encodable, Decodable)] struct KindMap(TreeMap); impl WorkMap { diff --git a/src/test/auxiliary/crateresolve5-1.rs b/src/test/auxiliary/crateresolve5-1.rs index 7cfb1dda4b9af..de48981ed3ede 100644 --- a/src/test/auxiliary/crateresolve5-1.rs +++ b/src/test/auxiliary/crateresolve5-1.rs @@ -26,7 +26,7 @@ pub fn nominal() -> e { e_val } pub fn nominal_eq(_e1: e, _e2: e) -> bool { true } -impl Eq for e { +impl PartialEq for e { fn eq(&self, other: &e) -> bool { nominal_eq(*self, *other) } fn ne(&self, other: &e) -> bool { !nominal_eq(*self, *other) } } diff --git a/src/test/auxiliary/crateresolve5-2.rs b/src/test/auxiliary/crateresolve5-2.rs index 566c4385f3c2a..f8727605c3db9 100644 --- a/src/test/auxiliary/crateresolve5-2.rs +++ b/src/test/auxiliary/crateresolve5-2.rs @@ -21,7 +21,7 @@ pub enum e { e_val } -impl Eq for e { +impl PartialEq for e { fn eq(&self, other: &e) -> bool { !nominal_neq(*self, *other) } fn ne(&self, other: &e) -> bool { nominal_neq(*self, *other) } } diff --git a/src/test/auxiliary/impl_privacy_xc_2.rs b/src/test/auxiliary/impl_privacy_xc_2.rs index 9b9379e19e588..4d4b1bcc4cbf0 100644 --- a/src/test/auxiliary/impl_privacy_xc_2.rs +++ b/src/test/auxiliary/impl_privacy_xc_2.rs @@ -16,7 +16,7 @@ pub struct Fish { mod unexported { use super::Fish; - impl Eq for Fish { + impl PartialEq for Fish { fn eq(&self, _: &Fish) -> bool { true } fn ne(&self, _: &Fish) -> bool { false } } diff --git a/src/test/auxiliary/overloaded_autoderef_xc.rs b/src/test/auxiliary/overloaded_autoderef_xc.rs index 850050fe3a5a2..dbb978a0b4ed9 100644 --- a/src/test/auxiliary/overloaded_autoderef_xc.rs +++ b/src/test/auxiliary/overloaded_autoderef_xc.rs @@ -31,7 +31,7 @@ impl> Deref for DerefWithHelper { } // Test cross-crate autoderef + vtable. -pub fn check(x: T, y: T) -> bool { +pub fn check(x: T, y: T) -> bool { let d: DerefWithHelper, T> = DerefWithHelper { helper: Some(x) }; d.eq(&y) } diff --git a/src/test/auxiliary/trait_inheritance_overloading_xc.rs b/src/test/auxiliary/trait_inheritance_overloading_xc.rs index 4b7a72f50430c..95bdecd77605f 100644 --- a/src/test/auxiliary/trait_inheritance_overloading_xc.rs +++ b/src/test/auxiliary/trait_inheritance_overloading_xc.rs @@ -8,9 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::cmp::Eq; +use std::cmp::PartialEq; -pub trait MyNum : Add + Sub + Mul + Eq { +pub trait MyNum : Add + Sub + Mul + PartialEq { } #[deriving(Show)] @@ -30,7 +30,7 @@ impl Mul for MyInt { fn mul(&self, other: &MyInt) -> MyInt { mi(self.val * other.val) } } -impl Eq for MyInt { +impl PartialEq for MyInt { fn eq(&self, other: &MyInt) -> bool { self.val == other.val } fn ne(&self, other: &MyInt) -> bool { !self.eq(other) } diff --git a/src/test/bench/shootout-k-nucleotide.rs b/src/test/bench/shootout-k-nucleotide.rs index 4b561def720c1..45cd93188b2ac 100644 --- a/src/test/bench/shootout-k-nucleotide.rs +++ b/src/test/bench/shootout-k-nucleotide.rs @@ -30,7 +30,7 @@ static OCCURRENCES: [&'static str, ..5] = [ // Code implementation -#[deriving(Eq, Ord, TotalOrd, TotalEq)] +#[deriving(PartialEq, PartialOrd, TotalOrd, TotalEq)] struct Code(u64); impl Code { diff --git a/src/test/compile-fail/deriving-no-inner-impl-error-message.rs b/src/test/compile-fail/deriving-no-inner-impl-error-message.rs index 604aa0dd06a34..58593869d747b 100644 --- a/src/test/compile-fail/deriving-no-inner-impl-error-message.rs +++ b/src/test/compile-fail/deriving-no-inner-impl-error-message.rs @@ -10,7 +10,7 @@ struct NoCloneOrEq; -#[deriving(Eq)] +#[deriving(PartialEq)] struct E { x: NoCloneOrEq //~ ERROR does not implement any method in scope named `eq` //~^ ERROR does not implement any method in scope named `ne` diff --git a/src/test/compile-fail/deriving-span-Clone-enum-struct-variant.rs b/src/test/compile-fail/deriving-span-Clone-enum-struct-variant.rs index 7babb8ea1b9e8..58a9c72b8b166 100644 --- a/src/test/compile-fail/deriving-span-Clone-enum-struct-variant.rs +++ b/src/test/compile-fail/deriving-span-Clone-enum-struct-variant.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' +// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #![feature(struct_variant)] extern crate rand; diff --git a/src/test/compile-fail/deriving-span-Clone-enum.rs b/src/test/compile-fail/deriving-span-Clone-enum.rs index 65404f155f10f..cf8345dbe7b46 100644 --- a/src/test/compile-fail/deriving-span-Clone-enum.rs +++ b/src/test/compile-fail/deriving-span-Clone-enum.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' +// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #![feature(struct_variant)] extern crate rand; diff --git a/src/test/compile-fail/deriving-span-Clone-struct.rs b/src/test/compile-fail/deriving-span-Clone-struct.rs index 0ca429e07e9f6..cd53f5a1e8f3c 100644 --- a/src/test/compile-fail/deriving-span-Clone-struct.rs +++ b/src/test/compile-fail/deriving-span-Clone-struct.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' +// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #![feature(struct_variant)] extern crate rand; diff --git a/src/test/compile-fail/deriving-span-Clone-tuple-struct.rs b/src/test/compile-fail/deriving-span-Clone-tuple-struct.rs index e78e59baf1b1f..95798af49b2e0 100644 --- a/src/test/compile-fail/deriving-span-Clone-tuple-struct.rs +++ b/src/test/compile-fail/deriving-span-Clone-tuple-struct.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' +// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #![feature(struct_variant)] extern crate rand; diff --git a/src/test/compile-fail/deriving-span-Default-struct.rs b/src/test/compile-fail/deriving-span-Default-struct.rs index 95132d9a5c718..90d567bfd5da9 100644 --- a/src/test/compile-fail/deriving-span-Default-struct.rs +++ b/src/test/compile-fail/deriving-span-Default-struct.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' +// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #![feature(struct_variant)] extern crate rand; diff --git a/src/test/compile-fail/deriving-span-Default-tuple-struct.rs b/src/test/compile-fail/deriving-span-Default-tuple-struct.rs index 670f6e8ea5252..cf0d9fb744337 100644 --- a/src/test/compile-fail/deriving-span-Default-tuple-struct.rs +++ b/src/test/compile-fail/deriving-span-Default-tuple-struct.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' +// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #![feature(struct_variant)] extern crate rand; diff --git a/src/test/compile-fail/deriving-span-Hash-enum-struct-variant.rs b/src/test/compile-fail/deriving-span-Hash-enum-struct-variant.rs index 745ef50102171..49b4840ff8ea1 100644 --- a/src/test/compile-fail/deriving-span-Hash-enum-struct-variant.rs +++ b/src/test/compile-fail/deriving-span-Hash-enum-struct-variant.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' +// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #![feature(struct_variant)] extern crate rand; diff --git a/src/test/compile-fail/deriving-span-Hash-enum.rs b/src/test/compile-fail/deriving-span-Hash-enum.rs index 3cd867d118622..653dabfbc133f 100644 --- a/src/test/compile-fail/deriving-span-Hash-enum.rs +++ b/src/test/compile-fail/deriving-span-Hash-enum.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' +// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #![feature(struct_variant)] extern crate rand; diff --git a/src/test/compile-fail/deriving-span-Hash-struct.rs b/src/test/compile-fail/deriving-span-Hash-struct.rs index e26bdd8d0899d..46234f6e72408 100644 --- a/src/test/compile-fail/deriving-span-Hash-struct.rs +++ b/src/test/compile-fail/deriving-span-Hash-struct.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' +// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #![feature(struct_variant)] extern crate rand; diff --git a/src/test/compile-fail/deriving-span-Hash-tuple-struct.rs b/src/test/compile-fail/deriving-span-Hash-tuple-struct.rs index 7554db6dae356..5dbf4a0376a12 100644 --- a/src/test/compile-fail/deriving-span-Hash-tuple-struct.rs +++ b/src/test/compile-fail/deriving-span-Hash-tuple-struct.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' +// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #![feature(struct_variant)] extern crate rand; diff --git a/src/test/compile-fail/deriving-span-Eq-enum-struct-variant.rs b/src/test/compile-fail/deriving-span-PartialEq-enum-struct-variant.rs similarity index 85% rename from src/test/compile-fail/deriving-span-Eq-enum-struct-variant.rs rename to src/test/compile-fail/deriving-span-PartialEq-enum-struct-variant.rs index 9e23493e37fdd..566585aa06567 100644 --- a/src/test/compile-fail/deriving-span-Eq-enum-struct-variant.rs +++ b/src/test/compile-fail/deriving-span-PartialEq-enum-struct-variant.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' +// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #![feature(struct_variant)] extern crate rand; @@ -16,7 +16,7 @@ extern crate rand; struct Error; -#[deriving(Eq)] +#[deriving(PartialEq)] enum Enum { A { x: Error //~ ERROR diff --git a/src/test/compile-fail/deriving-span-Eq-enum.rs b/src/test/compile-fail/deriving-span-PartialEq-enum.rs similarity index 85% rename from src/test/compile-fail/deriving-span-Eq-enum.rs rename to src/test/compile-fail/deriving-span-PartialEq-enum.rs index d4962c8a76b35..8a9771a050939 100644 --- a/src/test/compile-fail/deriving-span-Eq-enum.rs +++ b/src/test/compile-fail/deriving-span-PartialEq-enum.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' +// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #![feature(struct_variant)] extern crate rand; @@ -16,7 +16,7 @@ extern crate rand; struct Error; -#[deriving(Eq)] +#[deriving(PartialEq)] enum Enum { A( Error //~ ERROR diff --git a/src/test/compile-fail/deriving-span-Eq-struct.rs b/src/test/compile-fail/deriving-span-PartialEq-struct.rs similarity index 85% rename from src/test/compile-fail/deriving-span-Eq-struct.rs rename to src/test/compile-fail/deriving-span-PartialEq-struct.rs index 39c9c23e8f5b1..de39e9bacd529 100644 --- a/src/test/compile-fail/deriving-span-Eq-struct.rs +++ b/src/test/compile-fail/deriving-span-PartialEq-struct.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' +// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #![feature(struct_variant)] extern crate rand; @@ -16,7 +16,7 @@ extern crate rand; struct Error; -#[deriving(Eq)] +#[deriving(PartialEq)] struct Struct { x: Error //~ ERROR //~^ ERROR diff --git a/src/test/compile-fail/deriving-span-Eq-tuple-struct.rs b/src/test/compile-fail/deriving-span-PartialEq-tuple-struct.rs similarity index 85% rename from src/test/compile-fail/deriving-span-Eq-tuple-struct.rs rename to src/test/compile-fail/deriving-span-PartialEq-tuple-struct.rs index a9a9a1b30713a..101461e39b718 100644 --- a/src/test/compile-fail/deriving-span-Eq-tuple-struct.rs +++ b/src/test/compile-fail/deriving-span-PartialEq-tuple-struct.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' +// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #![feature(struct_variant)] extern crate rand; @@ -16,7 +16,7 @@ extern crate rand; struct Error; -#[deriving(Eq)] +#[deriving(PartialEq)] struct Struct( Error //~ ERROR //~^ ERROR diff --git a/src/test/compile-fail/deriving-span-Ord-enum-struct-variant.rs b/src/test/compile-fail/deriving-span-PartialOrd-enum-struct-variant.rs similarity index 83% rename from src/test/compile-fail/deriving-span-Ord-enum-struct-variant.rs rename to src/test/compile-fail/deriving-span-PartialOrd-enum-struct-variant.rs index 900fa0dcb6cd3..077286eef499b 100644 --- a/src/test/compile-fail/deriving-span-Ord-enum-struct-variant.rs +++ b/src/test/compile-fail/deriving-span-PartialOrd-enum-struct-variant.rs @@ -8,15 +8,15 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' +// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #![feature(struct_variant)] extern crate rand; -#[deriving(Eq)] +#[deriving(PartialEq)] struct Error; -#[deriving(Eq, Ord)] +#[deriving(PartialOrd,PartialEq)] enum Enum { A { x: Error //~ ERROR diff --git a/src/test/compile-fail/deriving-span-Ord-enum.rs b/src/test/compile-fail/deriving-span-PartialOrd-enum.rs similarity index 83% rename from src/test/compile-fail/deriving-span-Ord-enum.rs rename to src/test/compile-fail/deriving-span-PartialOrd-enum.rs index feb97dee79bec..8fd4ba6053e22 100644 --- a/src/test/compile-fail/deriving-span-Ord-enum.rs +++ b/src/test/compile-fail/deriving-span-PartialOrd-enum.rs @@ -8,15 +8,15 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' +// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #![feature(struct_variant)] extern crate rand; -#[deriving(Eq)] +#[deriving(PartialEq)] struct Error; -#[deriving(Eq, Ord)] +#[deriving(PartialOrd,PartialEq)] enum Enum { A( Error //~ ERROR diff --git a/src/test/compile-fail/deriving-span-Ord-struct.rs b/src/test/compile-fail/deriving-span-PartialOrd-struct.rs similarity index 83% rename from src/test/compile-fail/deriving-span-Ord-struct.rs rename to src/test/compile-fail/deriving-span-PartialOrd-struct.rs index c0396b0822e88..3a198a542e4ad 100644 --- a/src/test/compile-fail/deriving-span-Ord-struct.rs +++ b/src/test/compile-fail/deriving-span-PartialOrd-struct.rs @@ -8,15 +8,15 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' +// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #![feature(struct_variant)] extern crate rand; -#[deriving(Eq)] +#[deriving(PartialEq)] struct Error; -#[deriving(Eq, Ord)] +#[deriving(PartialOrd,PartialEq)] struct Struct { x: Error //~ ERROR //~^ ERROR diff --git a/src/test/compile-fail/deriving-span-Ord-tuple-struct.rs b/src/test/compile-fail/deriving-span-PartialOrd-tuple-struct.rs similarity index 83% rename from src/test/compile-fail/deriving-span-Ord-tuple-struct.rs rename to src/test/compile-fail/deriving-span-PartialOrd-tuple-struct.rs index 26610d7e1fac4..2de3c18425b57 100644 --- a/src/test/compile-fail/deriving-span-Ord-tuple-struct.rs +++ b/src/test/compile-fail/deriving-span-PartialOrd-tuple-struct.rs @@ -8,15 +8,15 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' +// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #![feature(struct_variant)] extern crate rand; -#[deriving(Eq)] +#[deriving(PartialEq)] struct Error; -#[deriving(Eq, Ord)] +#[deriving(PartialOrd,PartialEq)] struct Struct( Error //~ ERROR //~^ ERROR diff --git a/src/test/compile-fail/deriving-span-Rand-enum-struct-variant.rs b/src/test/compile-fail/deriving-span-Rand-enum-struct-variant.rs index e1b112bb023c5..79c38dcb4ccac 100644 --- a/src/test/compile-fail/deriving-span-Rand-enum-struct-variant.rs +++ b/src/test/compile-fail/deriving-span-Rand-enum-struct-variant.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' +// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #![feature(struct_variant)] extern crate rand; diff --git a/src/test/compile-fail/deriving-span-Rand-enum.rs b/src/test/compile-fail/deriving-span-Rand-enum.rs index 746a2aac88e8c..1e153a772c7e1 100644 --- a/src/test/compile-fail/deriving-span-Rand-enum.rs +++ b/src/test/compile-fail/deriving-span-Rand-enum.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' +// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #![feature(struct_variant)] extern crate rand; diff --git a/src/test/compile-fail/deriving-span-Rand-struct.rs b/src/test/compile-fail/deriving-span-Rand-struct.rs index 397b2adfcc846..2c223918773d8 100644 --- a/src/test/compile-fail/deriving-span-Rand-struct.rs +++ b/src/test/compile-fail/deriving-span-Rand-struct.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' +// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #![feature(struct_variant)] extern crate rand; diff --git a/src/test/compile-fail/deriving-span-Rand-tuple-struct.rs b/src/test/compile-fail/deriving-span-Rand-tuple-struct.rs index be6b7dcbb8f81..5d5a1372c13a2 100644 --- a/src/test/compile-fail/deriving-span-Rand-tuple-struct.rs +++ b/src/test/compile-fail/deriving-span-Rand-tuple-struct.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' +// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #![feature(struct_variant)] extern crate rand; diff --git a/src/test/compile-fail/deriving-span-Show-enum-struct-variant.rs b/src/test/compile-fail/deriving-span-Show-enum-struct-variant.rs index d50f1c692782c..93f53dc73f76b 100644 --- a/src/test/compile-fail/deriving-span-Show-enum-struct-variant.rs +++ b/src/test/compile-fail/deriving-span-Show-enum-struct-variant.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' +// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #![feature(struct_variant)] extern crate rand; diff --git a/src/test/compile-fail/deriving-span-Show-enum.rs b/src/test/compile-fail/deriving-span-Show-enum.rs index ada1abe8fbb60..e61a62c2f6da3 100644 --- a/src/test/compile-fail/deriving-span-Show-enum.rs +++ b/src/test/compile-fail/deriving-span-Show-enum.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' +// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #![feature(struct_variant)] extern crate rand; diff --git a/src/test/compile-fail/deriving-span-Show-struct.rs b/src/test/compile-fail/deriving-span-Show-struct.rs index 8d74af6ad0b8f..3a48b3334b7ab 100644 --- a/src/test/compile-fail/deriving-span-Show-struct.rs +++ b/src/test/compile-fail/deriving-span-Show-struct.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' +// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #![feature(struct_variant)] extern crate rand; diff --git a/src/test/compile-fail/deriving-span-Show-tuple-struct.rs b/src/test/compile-fail/deriving-span-Show-tuple-struct.rs index 6e421ca58f514..54806f322b383 100644 --- a/src/test/compile-fail/deriving-span-Show-tuple-struct.rs +++ b/src/test/compile-fail/deriving-span-Show-tuple-struct.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' +// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #![feature(struct_variant)] extern crate rand; diff --git a/src/test/compile-fail/deriving-span-TotalEq-enum-struct-variant.rs b/src/test/compile-fail/deriving-span-TotalEq-enum-struct-variant.rs index 8880d04ce41bf..07fc3d5c5d971 100644 --- a/src/test/compile-fail/deriving-span-TotalEq-enum-struct-variant.rs +++ b/src/test/compile-fail/deriving-span-TotalEq-enum-struct-variant.rs @@ -8,15 +8,15 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' +// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #![feature(struct_variant)] extern crate rand; -#[deriving(Eq)] +#[deriving(PartialEq)] struct Error; -#[deriving(Eq, TotalEq)] +#[deriving(TotalEq,PartialEq)] enum Enum { A { x: Error //~ ERROR diff --git a/src/test/compile-fail/deriving-span-TotalEq-enum.rs b/src/test/compile-fail/deriving-span-TotalEq-enum.rs index d0d8ef62f1e16..e25ebaf7f1b80 100644 --- a/src/test/compile-fail/deriving-span-TotalEq-enum.rs +++ b/src/test/compile-fail/deriving-span-TotalEq-enum.rs @@ -8,15 +8,15 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' +// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #![feature(struct_variant)] extern crate rand; -#[deriving(Eq)] +#[deriving(PartialEq)] struct Error; -#[deriving(Eq, TotalEq)] +#[deriving(TotalEq,PartialEq)] enum Enum { A( Error //~ ERROR diff --git a/src/test/compile-fail/deriving-span-TotalEq-struct.rs b/src/test/compile-fail/deriving-span-TotalEq-struct.rs index 53d7e0cbe3a11..b9b50e5d60b65 100644 --- a/src/test/compile-fail/deriving-span-TotalEq-struct.rs +++ b/src/test/compile-fail/deriving-span-TotalEq-struct.rs @@ -8,15 +8,15 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' +// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #![feature(struct_variant)] extern crate rand; -#[deriving(Eq)] +#[deriving(PartialEq)] struct Error; -#[deriving(Eq, TotalEq)] +#[deriving(TotalEq,PartialEq)] struct Struct { x: Error //~ ERROR } diff --git a/src/test/compile-fail/deriving-span-TotalEq-tuple-struct.rs b/src/test/compile-fail/deriving-span-TotalEq-tuple-struct.rs index 538ffdcd770ba..b6123df4506f5 100644 --- a/src/test/compile-fail/deriving-span-TotalEq-tuple-struct.rs +++ b/src/test/compile-fail/deriving-span-TotalEq-tuple-struct.rs @@ -8,15 +8,15 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' +// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #![feature(struct_variant)] extern crate rand; -#[deriving(Eq)] +#[deriving(PartialEq)] struct Error; -#[deriving(Eq, TotalEq)] +#[deriving(TotalEq,PartialEq)] struct Struct( Error //~ ERROR ); diff --git a/src/test/compile-fail/deriving-span-TotalOrd-enum-struct-variant.rs b/src/test/compile-fail/deriving-span-TotalOrd-enum-struct-variant.rs index d0adb542fc58c..a8116a817a87f 100644 --- a/src/test/compile-fail/deriving-span-TotalOrd-enum-struct-variant.rs +++ b/src/test/compile-fail/deriving-span-TotalOrd-enum-struct-variant.rs @@ -8,15 +8,15 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' +// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #![feature(struct_variant)] extern crate rand; -#[deriving(Eq, Ord, TotalEq)] +#[deriving(TotalEq,PartialOrd,PartialEq)] struct Error; -#[deriving(Eq, Ord, TotalOrd,TotalEq)] +#[deriving(TotalOrd,TotalEq,PartialOrd,PartialEq)] enum Enum { A { x: Error //~ ERROR diff --git a/src/test/compile-fail/deriving-span-TotalOrd-enum.rs b/src/test/compile-fail/deriving-span-TotalOrd-enum.rs index 0fc204f610147..0e1dc003fbb08 100644 --- a/src/test/compile-fail/deriving-span-TotalOrd-enum.rs +++ b/src/test/compile-fail/deriving-span-TotalOrd-enum.rs @@ -8,15 +8,15 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' +// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #![feature(struct_variant)] extern crate rand; -#[deriving(Eq, Ord, TotalEq)] +#[deriving(TotalEq,PartialOrd,PartialEq)] struct Error; -#[deriving(Eq, Ord, TotalOrd,TotalEq)] +#[deriving(TotalOrd,TotalEq,PartialOrd,PartialEq)] enum Enum { A( Error //~ ERROR diff --git a/src/test/compile-fail/deriving-span-TotalOrd-struct.rs b/src/test/compile-fail/deriving-span-TotalOrd-struct.rs index 69cf5d2d8efb7..af6f09c4a2cf2 100644 --- a/src/test/compile-fail/deriving-span-TotalOrd-struct.rs +++ b/src/test/compile-fail/deriving-span-TotalOrd-struct.rs @@ -8,15 +8,15 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' +// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #![feature(struct_variant)] extern crate rand; -#[deriving(Eq, Ord, TotalEq)] +#[deriving(TotalEq,PartialOrd,PartialEq)] struct Error; -#[deriving(Eq, Ord, TotalOrd,TotalEq)] +#[deriving(TotalOrd,TotalEq,PartialOrd,PartialEq)] struct Struct { x: Error //~ ERROR } diff --git a/src/test/compile-fail/deriving-span-TotalOrd-tuple-struct.rs b/src/test/compile-fail/deriving-span-TotalOrd-tuple-struct.rs index 230e5b7ed9989..b58dc56a261d7 100644 --- a/src/test/compile-fail/deriving-span-TotalOrd-tuple-struct.rs +++ b/src/test/compile-fail/deriving-span-TotalOrd-tuple-struct.rs @@ -8,15 +8,15 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' +// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #![feature(struct_variant)] extern crate rand; -#[deriving(Eq, Ord, TotalEq)] +#[deriving(TotalEq,PartialOrd,PartialEq)] struct Error; -#[deriving(Eq, Ord, TotalOrd,TotalEq)] +#[deriving(TotalOrd,TotalEq,PartialOrd,PartialEq)] struct Struct( Error //~ ERROR ); diff --git a/src/test/compile-fail/deriving-span-Zero-struct.rs b/src/test/compile-fail/deriving-span-Zero-struct.rs index f32db20ef3fe7..ee3a82f7f6d68 100644 --- a/src/test/compile-fail/deriving-span-Zero-struct.rs +++ b/src/test/compile-fail/deriving-span-Zero-struct.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' +// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #![feature(struct_variant)] extern crate rand; diff --git a/src/test/compile-fail/deriving-span-Zero-tuple-struct.rs b/src/test/compile-fail/deriving-span-Zero-tuple-struct.rs index 66488b0ac6673..21dc0cabdc809 100644 --- a/src/test/compile-fail/deriving-span-Zero-tuple-struct.rs +++ b/src/test/compile-fail/deriving-span-Zero-tuple-struct.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py' +// This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #![feature(struct_variant)] extern crate rand; diff --git a/src/test/compile-fail/issue-3344.rs b/src/test/compile-fail/issue-3344.rs index e79a5871e70c6..d6fe83a77032b 100644 --- a/src/test/compile-fail/issue-3344.rs +++ b/src/test/compile-fail/issue-3344.rs @@ -8,9 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[deriving(Eq)] +#[deriving(PartialEq)] struct thing(uint); -impl Ord for thing { //~ ERROR not all trait methods implemented, missing: `lt` +impl PartialOrd for thing { //~ ERROR not all trait methods implemented, missing: `lt` fn le(&self, other: &thing) -> bool { true } fn ge(&self, other: &thing) -> bool { true } } diff --git a/src/test/compile-fail/issue-3953.rs b/src/test/compile-fail/issue-3953.rs index cfb10d39201ab..4484a00425140 100644 --- a/src/test/compile-fail/issue-3953.rs +++ b/src/test/compile-fail/issue-3953.rs @@ -8,23 +8,25 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::cmp::Eq; +// ignore-tidy-linelength -trait Hahaha: Eq + Eq + Eq + Eq + Eq + //~ ERROR duplicate supertrait - Eq + Eq + Eq + Eq + Eq + Eq + Eq + Eq + Eq + Eq + Eq + Eq + Eq + - Eq + Eq + Eq + Eq + Eq + Eq + Eq + Eq + Eq + Eq + Eq + Eq + Eq + - Eq + Eq + Eq + Eq + Eq + Eq + Eq + Eq + Eq + Eq + Eq + Eq + Eq + - Eq + Eq + Eq + Eq + Eq + Eq + Eq + Eq + Eq + Eq + Eq + Eq + Eq + - Eq + Eq + Eq + Eq + Eq + Eq + Eq + Eq + Eq + Eq + Eq + Eq + Eq + - Eq + Eq + Eq + Eq + Eq + Eq + Eq + Eq + Eq + Eq + Eq + Eq + Eq + - Eq + Eq + Eq + Eq + Eq + Eq + Eq + Eq + Eq + Eq + Eq + Eq + - Eq {} +use std::cmp::PartialEq; + +trait Hahaha: PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + //~ ERROR duplicate supertrait + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + PartialEq + + PartialEq {} struct Lol(int); impl Hahaha for Lol { } -impl Eq for Lol { +impl PartialEq for Lol { fn eq(&self, other: &Lol) -> bool { **self != **other } fn ne(&self, other: &Lol) -> bool { **self == **other } } diff --git a/src/test/compile-fail/lint-unused-imports.rs b/src/test/compile-fail/lint-unused-imports.rs index 3a4844301d62e..cb05c2833345c 100644 --- a/src/test/compile-fail/lint-unused-imports.rs +++ b/src/test/compile-fail/lint-unused-imports.rs @@ -51,7 +51,7 @@ mod foo { mod bar { // Don't ignore on 'pub use' because we're not sure if it's used or not - pub use std::cmp::Eq; + pub use std::cmp::PartialEq; pub mod c { use foo::Point; @@ -61,7 +61,7 @@ mod bar { #[allow(unused_imports)] mod foo { - use std::cmp::Eq; + use std::cmp::PartialEq; } } diff --git a/src/test/run-make/rustdoc-hidden-line/foo.rs b/src/test/run-make/rustdoc-hidden-line/foo.rs index 8128ba05885bd..26546cef0f061 100644 --- a/src/test/run-make/rustdoc-hidden-line/foo.rs +++ b/src/test/run-make/rustdoc-hidden-line/foo.rs @@ -16,10 +16,10 @@ /// ```rust /// mod to_make_deriving_work { // FIXME #4913 /// -/// # #[deriving(Eq)] // invisible +/// # #[deriving(PartialEq)] // invisible /// # struct Foo; // invisible /// -/// #[deriving(Eq)] // Bar +/// #[deriving(PartialEq)] // Bar /// struct Bar(Foo); /// /// fn test() { diff --git a/src/test/run-pass-fulldeps/macro-crate.rs b/src/test/run-pass-fulldeps/macro-crate.rs index 0c086ae99f74e..3c620c5e57209 100644 --- a/src/test/run-pass-fulldeps/macro-crate.rs +++ b/src/test/run-pass-fulldeps/macro-crate.rs @@ -17,7 +17,7 @@ extern crate macro_crate_test; #[into_foo] -#[deriving(Eq, Clone, Show)] +#[deriving(PartialEq, Clone, Show)] fn foo() -> AFakeTypeThatHadBetterGoAway {} pub fn main() { @@ -28,4 +28,4 @@ pub fn main() { test(None::); } -fn test(_: Option) {} +fn test(_: Option) {} diff --git a/src/test/run-pass/assert-eq-macro-success.rs b/src/test/run-pass/assert-eq-macro-success.rs index 4adf10636e6a7..34f7bf6f0e780 100644 --- a/src/test/run-pass/assert-eq-macro-success.rs +++ b/src/test/run-pass/assert-eq-macro-success.rs @@ -10,7 +10,7 @@ #![feature(managed_boxes)] -#[deriving(Eq, Show)] +#[deriving(PartialEq, Show)] struct Point { x : int } pub fn main() { diff --git a/src/test/run-pass/binops.rs b/src/test/run-pass/binops.rs index 69705996fadda..3ac3ac2b4f1b4 100644 --- a/src/test/run-pass/binops.rs +++ b/src/test/run-pass/binops.rs @@ -65,7 +65,7 @@ fn test_ptr() { } } -#[deriving(Eq, Show)] +#[deriving(PartialEq, Show)] struct p { x: int, y: int, diff --git a/src/test/run-pass/builtin-superkinds-capabilities-xc.rs b/src/test/run-pass/builtin-superkinds-capabilities-xc.rs index f52993f8559fd..d52da21240064 100644 --- a/src/test/run-pass/builtin-superkinds-capabilities-xc.rs +++ b/src/test/run-pass/builtin-superkinds-capabilities-xc.rs @@ -17,7 +17,7 @@ extern crate trait_superkinds_in_metadata; use trait_superkinds_in_metadata::{RequiresRequiresShareAndSend, RequiresShare}; -#[deriving(Eq)] +#[deriving(PartialEq)] struct X(T); impl RequiresShare for X { } diff --git a/src/test/run-pass/class-impl-very-parameterized-trait.rs b/src/test/run-pass/class-impl-very-parameterized-trait.rs index 285566570b185..865984844c0b5 100644 --- a/src/test/run-pass/class-impl-very-parameterized-trait.rs +++ b/src/test/run-pass/class-impl-very-parameterized-trait.rs @@ -14,7 +14,7 @@ use std::cmp; #[deriving(Show)] enum cat_type { tuxedo, tabby, tortoiseshell } -impl cmp::Eq for cat_type { +impl cmp::PartialEq for cat_type { fn eq(&self, other: &cat_type) -> bool { ((*self) as uint) == ((*other) as uint) } diff --git a/src/test/run-pass/cmp-default.rs b/src/test/run-pass/cmp-default.rs index 2ab6a70839f0e..7805a2bb49e80 100644 --- a/src/test/run-pass/cmp-default.rs +++ b/src/test/run-pass/cmp-default.rs @@ -8,11 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// Test default methods in Ord and Eq +// Test default methods in PartialOrd and PartialEq // struct Fool(bool); -impl Eq for Fool { +impl PartialEq for Fool { fn eq(&self, other: &Fool) -> bool { let Fool(this) = *self; let Fool(other) = *other; @@ -22,7 +22,7 @@ impl Eq for Fool { struct Int(int); -impl Eq for Int { +impl PartialEq for Int { fn eq(&self, other: &Int) -> bool { let Int(this) = *self; let Int(other) = *other; @@ -30,7 +30,7 @@ impl Eq for Int { } } -impl Ord for Int { +impl PartialOrd for Int { fn lt(&self, other: &Int) -> bool { let Int(this) = *self; let Int(other) = *other; @@ -40,7 +40,7 @@ impl Ord for Int { struct RevInt(int); -impl Eq for RevInt { +impl PartialEq for RevInt { fn eq(&self, other: &RevInt) -> bool { let RevInt(this) = *self; let RevInt(other) = *other; @@ -48,7 +48,7 @@ impl Eq for RevInt { } } -impl Ord for RevInt { +impl PartialOrd for RevInt { fn lt(&self, other: &RevInt) -> bool { let RevInt(this) = *self; let RevInt(other) = *other; diff --git a/src/test/run-pass/coerce-to-closure-and-proc.rs b/src/test/run-pass/coerce-to-closure-and-proc.rs index 075709b1c36a7..15870b627b209 100644 --- a/src/test/run-pass/coerce-to-closure-and-proc.rs +++ b/src/test/run-pass/coerce-to-closure-and-proc.rs @@ -12,10 +12,10 @@ fn id(x: T) -> T { x } -#[deriving(Eq, Show)] +#[deriving(PartialEq, Show)] struct Foo(T); -#[deriving(Eq, Show)] +#[deriving(PartialEq, Show)] enum Bar { Bar(T) } diff --git a/src/test/run-pass/coherence-impl-in-fn.rs b/src/test/run-pass/coherence-impl-in-fn.rs index 707a7bf407659..51cd62677ca1c 100644 --- a/src/test/run-pass/coherence-impl-in-fn.rs +++ b/src/test/run-pass/coherence-impl-in-fn.rs @@ -10,7 +10,7 @@ pub fn main() { enum x { foo } - impl ::std::cmp::Eq for x { + impl ::std::cmp::PartialEq for x { fn eq(&self, other: &x) -> bool { (*self) as int == (*other) as int } diff --git a/src/test/run-pass/const-struct.rs b/src/test/run-pass/const-struct.rs index 4508295b1ccef..0a83d007a06a1 100644 --- a/src/test/run-pass/const-struct.rs +++ b/src/test/run-pass/const-struct.rs @@ -13,7 +13,7 @@ use std::cmp; #[deriving(Show)] struct foo { a: int, b: int, c: int } -impl cmp::Eq for foo { +impl cmp::PartialEq for foo { fn eq(&self, other: &foo) -> bool { (*self).a == (*other).a && (*self).b == (*other).b && diff --git a/src/test/run-pass/deriving-cmp-generic-enum.rs b/src/test/run-pass/deriving-cmp-generic-enum.rs index 5d41e275cd3f6..e280da10990cb 100644 --- a/src/test/run-pass/deriving-cmp-generic-enum.rs +++ b/src/test/run-pass/deriving-cmp-generic-enum.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[deriving(Eq, TotalEq, Ord, TotalOrd)] +#[deriving(PartialEq, TotalEq, PartialOrd, TotalOrd)] enum E { E0, E1(T), @@ -22,7 +22,7 @@ pub fn main() { let e21 = E2(1, 1); let e22 = E2(1, 2); - // in order for both Ord and TotalOrd + // in order for both PartialOrd and TotalOrd let es = [e0, e11, e12, e21, e22]; for (i, e1) in es.iter().enumerate() { @@ -35,11 +35,11 @@ pub fn main() { let gt = i > j; let ge = i >= j; - // Eq + // PartialEq assert_eq!(*e1 == *e2, eq); assert_eq!(*e1 != *e2, !eq); - // Ord + // PartialOrd assert_eq!(*e1 < *e2, lt); assert_eq!(*e1 > *e2, gt); diff --git a/src/test/run-pass/deriving-cmp-generic-struct-enum.rs b/src/test/run-pass/deriving-cmp-generic-struct-enum.rs index 9dc5bcc0f0296..a6040049a2f7d 100644 --- a/src/test/run-pass/deriving-cmp-generic-struct-enum.rs +++ b/src/test/run-pass/deriving-cmp-generic-struct-enum.rs @@ -10,7 +10,7 @@ #![feature(struct_variant)] -#[deriving(Eq, TotalEq, Ord, TotalOrd)] +#[deriving(PartialEq, TotalEq, PartialOrd, TotalOrd)] enum ES { ES1 { x: T }, ES2 { x: T, y: T } @@ -20,7 +20,7 @@ enum ES { pub fn main() { let (es11, es12, es21, es22) = (ES1 {x: 1}, ES1 {x: 2}, ES2 {x: 1, y: 1}, ES2 {x: 1, y: 2}); - // in order for both Ord and TotalOrd + // in order for both PartialOrd and TotalOrd let ess = [es11, es12, es21, es22]; for (i, es1) in ess.iter().enumerate() { @@ -31,11 +31,11 @@ pub fn main() { let (lt, le) = (i < j, i <= j); let (gt, ge) = (i > j, i >= j); - // Eq + // PartialEq assert_eq!(*es1 == *es2, eq); assert_eq!(*es1 != *es2, !eq); - // Ord + // PartialOrd assert_eq!(*es1 < *es2, lt); assert_eq!(*es1 > *es2, gt); diff --git a/src/test/run-pass/deriving-cmp-generic-struct.rs b/src/test/run-pass/deriving-cmp-generic-struct.rs index 4f62d1fa6313a..36ec0e834baa3 100644 --- a/src/test/run-pass/deriving-cmp-generic-struct.rs +++ b/src/test/run-pass/deriving-cmp-generic-struct.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[deriving(Eq, TotalEq, Ord, TotalOrd)] +#[deriving(PartialEq, TotalEq, PartialOrd, TotalOrd)] struct S { x: T, y: T @@ -18,7 +18,7 @@ pub fn main() { let s1 = S {x: 1, y: 1}; let s2 = S {x: 1, y: 2}; - // in order for both Ord and TotalOrd + // in order for both PartialOrd and TotalOrd let ss = [s1, s2]; for (i, s1) in ss.iter().enumerate() { @@ -31,11 +31,11 @@ pub fn main() { let gt = i > j; let ge = i >= j; - // Eq + // PartialEq assert_eq!(*s1 == *s2, eq); assert_eq!(*s1 != *s2, !eq); - // Ord + // PartialOrd assert_eq!(*s1 < *s2, lt); assert_eq!(*s1 > *s2, gt); diff --git a/src/test/run-pass/deriving-cmp-generic-tuple-struct.rs b/src/test/run-pass/deriving-cmp-generic-tuple-struct.rs index b8ba4c64616ce..b67da8940ff7d 100644 --- a/src/test/run-pass/deriving-cmp-generic-tuple-struct.rs +++ b/src/test/run-pass/deriving-cmp-generic-tuple-struct.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[deriving(Eq, TotalEq, Ord, TotalOrd)] +#[deriving(PartialEq, TotalEq, PartialOrd, TotalOrd)] struct TS(T,T); @@ -16,7 +16,7 @@ pub fn main() { let ts1 = TS(1, 1); let ts2 = TS(1, 2); - // in order for both Ord and TotalOrd + // in order for both PartialOrd and TotalOrd let tss = [ts1, ts2]; for (i, ts1) in tss.iter().enumerate() { @@ -29,11 +29,11 @@ pub fn main() { let gt = i > j; let ge = i >= j; - // Eq + // PartialEq assert_eq!(*ts1 == *ts2, eq); assert_eq!(*ts1 != *ts2, !eq); - // Ord + // PartialOrd assert_eq!(*ts1 < *ts2, lt); assert_eq!(*ts1 > *ts2, gt); diff --git a/src/test/run-pass/deriving-cmp-shortcircuit.rs b/src/test/run-pass/deriving-cmp-shortcircuit.rs index 03e6d04d87ff0..45beda9684ddd 100644 --- a/src/test/run-pass/deriving-cmp-shortcircuit.rs +++ b/src/test/run-pass/deriving-cmp-shortcircuit.rs @@ -13,11 +13,11 @@ // second element, so this passes iff the instances shortcircuit. pub struct FailCmp; -impl Eq for FailCmp { +impl PartialEq for FailCmp { fn eq(&self, _: &FailCmp) -> bool { fail!("eq") } } -impl Ord for FailCmp { +impl PartialOrd for FailCmp { fn lt(&self, _: &FailCmp) -> bool { fail!("lt") } } @@ -27,7 +27,7 @@ impl TotalOrd for FailCmp { fn cmp(&self, _: &FailCmp) -> Ordering { fail!("cmp") } } -#[deriving(Eq,Ord,TotalEq,TotalOrd)] +#[deriving(PartialEq,PartialOrd,TotalEq,TotalOrd)] struct ShortCircuit { x: int, y: FailCmp diff --git a/src/test/run-pass/deriving-enum-single-variant.rs b/src/test/run-pass/deriving-enum-single-variant.rs index 075a9431b195e..fc03763a3b7a8 100644 --- a/src/test/run-pass/deriving-enum-single-variant.rs +++ b/src/test/run-pass/deriving-enum-single-variant.rs @@ -10,7 +10,7 @@ type task_id = int; -#[deriving(Eq)] +#[deriving(PartialEq)] pub enum Task { TaskHandle(task_id) } diff --git a/src/test/run-pass/deriving-global.rs b/src/test/run-pass/deriving-global.rs index cbf6a1c50df1d..1f9a5cab3b7da 100644 --- a/src/test/run-pass/deriving-global.rs +++ b/src/test/run-pass/deriving-global.rs @@ -15,21 +15,21 @@ mod submod { // if any of these are implemented without global calls for any // function calls, then being in a submodule will (correctly) // cause errors about unrecognised module `std` (or `extra`) - #[deriving(Eq, Ord, TotalEq, TotalOrd, + #[deriving(PartialEq, PartialOrd, TotalEq, TotalOrd, Hash, Clone, Show, Rand, Encodable, Decodable)] enum A { A1(uint), A2(int) } - #[deriving(Eq, Ord, TotalEq, TotalOrd, + #[deriving(PartialEq, PartialOrd, TotalEq, TotalOrd, Hash, Clone, Show, Rand, Encodable, Decodable)] struct B { x: uint, y: int } - #[deriving(Eq, Ord, TotalEq, TotalOrd, + #[deriving(PartialEq, PartialOrd, TotalEq, TotalOrd, Hash, Clone, Show, Rand, diff --git a/src/test/run-pass/deriving-in-macro.rs b/src/test/run-pass/deriving-in-macro.rs index b4ff97912a169..218216e3a34ea 100644 --- a/src/test/run-pass/deriving-in-macro.rs +++ b/src/test/run-pass/deriving-in-macro.rs @@ -13,7 +13,7 @@ macro_rules! define_vec ( () => ( mod foo { - #[deriving(Eq)] + #[deriving(PartialEq)] pub struct bar; } ) diff --git a/src/test/run-pass/deriving-meta-multiple.rs b/src/test/run-pass/deriving-meta-multiple.rs index 1eb7631da0491..61df7bf508860 100644 --- a/src/test/run-pass/deriving-meta-multiple.rs +++ b/src/test/run-pass/deriving-meta-multiple.rs @@ -11,7 +11,7 @@ use std::hash::hash; -#[deriving(Eq, Clone, Hash)] +#[deriving(PartialEq, Clone, Hash)] struct Foo { bar: uint, baz: int @@ -20,7 +20,7 @@ struct Foo { pub fn main() { let a = Foo {bar: 4, baz: -3}; - a == a; // check for Eq impl w/o testing its correctness + a == a; // check for PartialEq impl w/o testing its correctness a.clone(); // check for Clone impl w/o testing its correctness hash(&a); // check for Hash impl w/o testing its correctness } diff --git a/src/test/run-pass/deriving-meta.rs b/src/test/run-pass/deriving-meta.rs index 1eb7631da0491..61df7bf508860 100644 --- a/src/test/run-pass/deriving-meta.rs +++ b/src/test/run-pass/deriving-meta.rs @@ -11,7 +11,7 @@ use std::hash::hash; -#[deriving(Eq, Clone, Hash)] +#[deriving(PartialEq, Clone, Hash)] struct Foo { bar: uint, baz: int @@ -20,7 +20,7 @@ struct Foo { pub fn main() { let a = Foo {bar: 4, baz: -3}; - a == a; // check for Eq impl w/o testing its correctness + a == a; // check for PartialEq impl w/o testing its correctness a.clone(); // check for Clone impl w/o testing its correctness hash(&a); // check for Hash impl w/o testing its correctness } diff --git a/src/test/run-pass/deriving-primitive.rs b/src/test/run-pass/deriving-primitive.rs index e90d7c803aa3b..22d40f30dc8fc 100644 --- a/src/test/run-pass/deriving-primitive.rs +++ b/src/test/run-pass/deriving-primitive.rs @@ -11,7 +11,7 @@ use std::num::FromPrimitive; use std::int; -#[deriving(Eq, FromPrimitive, Show)] +#[deriving(PartialEq, FromPrimitive, Show)] enum A { Foo = int::MAX, Bar = 1, diff --git a/src/test/run-pass/deriving-via-extension-c-enum.rs b/src/test/run-pass/deriving-via-extension-c-enum.rs index 8fbff8f8f31bc..3665a0a79fa06 100644 --- a/src/test/run-pass/deriving-via-extension-c-enum.rs +++ b/src/test/run-pass/deriving-via-extension-c-enum.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[deriving(Eq, Show)] +#[deriving(PartialEq, Show)] enum Foo { Bar, Baz, diff --git a/src/test/run-pass/deriving-via-extension-enum.rs b/src/test/run-pass/deriving-via-extension-enum.rs index 74d530b93ffd7..d34b17923c587 100644 --- a/src/test/run-pass/deriving-via-extension-enum.rs +++ b/src/test/run-pass/deriving-via-extension-enum.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[deriving(Eq, Show)] +#[deriving(PartialEq, Show)] enum Foo { Bar(int, int), Baz(f64, f64) diff --git a/src/test/run-pass/deriving-via-extension-struct-empty.rs b/src/test/run-pass/deriving-via-extension-struct-empty.rs index f7c711e27d0a3..ab1a67f7e1234 100644 --- a/src/test/run-pass/deriving-via-extension-struct-empty.rs +++ b/src/test/run-pass/deriving-via-extension-struct-empty.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[deriving(Eq, Show)] +#[deriving(PartialEq, Show)] struct Foo; pub fn main() { diff --git a/src/test/run-pass/deriving-via-extension-struct-like-enum-variant.rs b/src/test/run-pass/deriving-via-extension-struct-like-enum-variant.rs index 3e22db301d35e..b8cc6ccb69c24 100644 --- a/src/test/run-pass/deriving-via-extension-struct-like-enum-variant.rs +++ b/src/test/run-pass/deriving-via-extension-struct-like-enum-variant.rs @@ -10,7 +10,7 @@ #![feature(struct_variant)] -#[deriving(Eq, Show)] +#[deriving(PartialEq, Show)] enum S { X { x: int, y: int }, Y diff --git a/src/test/run-pass/deriving-via-extension-struct-tuple.rs b/src/test/run-pass/deriving-via-extension-struct-tuple.rs index edb0272dfeeb2..8a6aa0fad9342 100644 --- a/src/test/run-pass/deriving-via-extension-struct-tuple.rs +++ b/src/test/run-pass/deriving-via-extension-struct-tuple.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[deriving(Eq, Show)] +#[deriving(PartialEq, Show)] struct Foo(int, int, String); pub fn main() { diff --git a/src/test/run-pass/deriving-via-extension-struct.rs b/src/test/run-pass/deriving-via-extension-struct.rs index db36623186064..18d207d75d471 100644 --- a/src/test/run-pass/deriving-via-extension-struct.rs +++ b/src/test/run-pass/deriving-via-extension-struct.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[deriving(Eq, Show)] +#[deriving(PartialEq, Show)] struct Foo { x: int, y: int, diff --git a/src/test/run-pass/deriving-via-extension-type-params.rs b/src/test/run-pass/deriving-via-extension-type-params.rs index 42915d8119d8f..1af39da5202c0 100644 --- a/src/test/run-pass/deriving-via-extension-type-params.rs +++ b/src/test/run-pass/deriving-via-extension-type-params.rs @@ -9,7 +9,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[deriving(Eq, Hash, Show)] +#[deriving(PartialEq, Hash, Show)] struct Foo { x: int, y: T, diff --git a/src/test/run-pass/empty-tag.rs b/src/test/run-pass/empty-tag.rs index b79de737ce02b..64571be341802 100644 --- a/src/test/run-pass/empty-tag.rs +++ b/src/test/run-pass/empty-tag.rs @@ -11,7 +11,7 @@ #[deriving(Show)] enum chan { chan_t, } -impl Eq for chan { +impl PartialEq for chan { fn eq(&self, other: &chan) -> bool { ((*self) as uint) == ((*other) as uint) } diff --git a/src/test/run-pass/export-unexported-dep.rs b/src/test/run-pass/export-unexported-dep.rs index 004761479f379..49709fa72c669 100644 --- a/src/test/run-pass/export-unexported-dep.rs +++ b/src/test/run-pass/export-unexported-dep.rs @@ -15,7 +15,7 @@ mod foo { // not exported enum t { t1, t2, } - impl Eq for t { + impl PartialEq for t { fn eq(&self, other: &t) -> bool { ((*self) as uint) == ((*other) as uint) } diff --git a/src/test/run-pass/expr-if-struct.rs b/src/test/run-pass/expr-if-struct.rs index 58e8a35fbfcd6..b0cc991f667e6 100644 --- a/src/test/run-pass/expr-if-struct.rs +++ b/src/test/run-pass/expr-if-struct.rs @@ -24,7 +24,7 @@ fn test_rec() { #[deriving(Show)] enum mood { happy, sad, } -impl Eq for mood { +impl PartialEq for mood { fn eq(&self, other: &mood) -> bool { ((*self) as uint) == ((*other) as uint) } diff --git a/src/test/run-pass/expr-match-struct.rs b/src/test/run-pass/expr-match-struct.rs index 93f0575b5a089..3d01c6653a7a0 100644 --- a/src/test/run-pass/expr-match-struct.rs +++ b/src/test/run-pass/expr-match-struct.rs @@ -23,7 +23,7 @@ fn test_rec() { #[deriving(Show)] enum mood { happy, sad, } -impl Eq for mood { +impl PartialEq for mood { fn eq(&self, other: &mood) -> bool { ((*self) as uint) == ((*other) as uint) } diff --git a/src/test/run-pass/extern-pass-TwoU16s.rs b/src/test/run-pass/extern-pass-TwoU16s.rs index 0eb7eabe74741..aace680bea0a6 100644 --- a/src/test/run-pass/extern-pass-TwoU16s.rs +++ b/src/test/run-pass/extern-pass-TwoU16s.rs @@ -11,7 +11,7 @@ // Test a foreign function that accepts and returns a struct // by value. -#[deriving(Eq, Show)] +#[deriving(PartialEq, Show)] struct TwoU16s { one: u16, two: u16 } diff --git a/src/test/run-pass/extern-pass-TwoU32s.rs b/src/test/run-pass/extern-pass-TwoU32s.rs index ea093f1daaae6..fb2188fb6df0b 100644 --- a/src/test/run-pass/extern-pass-TwoU32s.rs +++ b/src/test/run-pass/extern-pass-TwoU32s.rs @@ -11,7 +11,7 @@ // Test a foreign function that accepts and returns a struct // by value. -#[deriving(Eq, Show)] +#[deriving(PartialEq, Show)] struct TwoU32s { one: u32, two: u32 } diff --git a/src/test/run-pass/extern-pass-TwoU64s.rs b/src/test/run-pass/extern-pass-TwoU64s.rs index a716e03850772..a6cb44b9c103e 100644 --- a/src/test/run-pass/extern-pass-TwoU64s.rs +++ b/src/test/run-pass/extern-pass-TwoU64s.rs @@ -13,7 +13,7 @@ // ignore-win32 #9205 -#[deriving(Eq, Show)] +#[deriving(PartialEq, Show)] struct TwoU64s { one: u64, two: u64 } diff --git a/src/test/run-pass/extern-pass-TwoU8s.rs b/src/test/run-pass/extern-pass-TwoU8s.rs index b5c99d55a8e8d..0d5b1b789c608 100644 --- a/src/test/run-pass/extern-pass-TwoU8s.rs +++ b/src/test/run-pass/extern-pass-TwoU8s.rs @@ -11,7 +11,7 @@ // Test a foreign function that accepts and returns a struct // by value. -#[deriving(Eq, Show)] +#[deriving(PartialEq, Show)] struct TwoU8s { one: u8, two: u8 } diff --git a/src/test/run-pass/fixed_length_vec_glue.rs b/src/test/run-pass/fixed_length_vec_glue.rs index a40ab713c2d6c..62cfd10dbfb46 100644 --- a/src/test/run-pass/fixed_length_vec_glue.rs +++ b/src/test/run-pass/fixed_length_vec_glue.rs @@ -8,8 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +extern crate debug; -use std::repr; +use debug::repr; struct Struc { a: u8, b: [int, ..3], c: int } diff --git a/src/test/run-pass/generic-default-type-params.rs b/src/test/run-pass/generic-default-type-params.rs index 4cf9ea3ee5a21..b7706088b6202 100644 --- a/src/test/run-pass/generic-default-type-params.rs +++ b/src/test/run-pass/generic-default-type-params.rs @@ -49,10 +49,10 @@ fn default_foo(x: Foo) { assert_eq!(x.baz(), (1, 'a')); } -#[deriving(Eq, Show)] +#[deriving(PartialEq, Show)] struct BazHelper(T); -#[deriving(Eq, Show)] +#[deriving(PartialEq, Show)] // Ensure that we can use previous type parameters in defaults. struct Baz, V = Option>(T, U, V); diff --git a/src/test/run-pass/issue-12860.rs b/src/test/run-pass/issue-12860.rs index 187a45e65431b..863245d42f0d7 100644 --- a/src/test/run-pass/issue-12860.rs +++ b/src/test/run-pass/issue-12860.rs @@ -13,7 +13,7 @@ extern crate collections; use collections::HashSet; -#[deriving(Eq, TotalEq, Hash)] +#[deriving(PartialEq, TotalEq, Hash)] struct XYZ { x: int, y: int, diff --git a/src/test/run-pass/issue-2718.rs b/src/test/run-pass/issue-2718.rs index 9636a61269cae..5f180f13ffa2a 100644 --- a/src/test/run-pass/issue-2718.rs +++ b/src/test/run-pass/issue-2718.rs @@ -25,7 +25,7 @@ pub mod pipes { payload: Option } - #[deriving(Eq, Show)] + #[deriving(PartialEq, Show)] #[repr(int)] pub enum state { empty, diff --git a/src/test/run-pass/issue-3935.rs b/src/test/run-pass/issue-3935.rs index 0237a56fd17e1..e616c784f4d38 100644 --- a/src/test/run-pass/issue-3935.rs +++ b/src/test/run-pass/issue-3935.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[deriving(Eq)] +#[deriving(PartialEq)] struct Bike { name: String, } diff --git a/src/test/run-pass/issue-5554.rs b/src/test/run-pass/issue-5554.rs index 3ae4e9c6da45c..9151fb2b76473 100644 --- a/src/test/run-pass/issue-5554.rs +++ b/src/test/run-pass/issue-5554.rs @@ -17,7 +17,7 @@ pub struct X { } // reordering these bounds stops the ICE -impl Default for X { +impl Default for X { fn default() -> X { X { a: Default::default() } } diff --git a/src/test/run-pass/issue-5572.rs b/src/test/run-pass/issue-5572.rs index d71e30eb64a45..4e57ed94991cb 100644 --- a/src/test/run-pass/issue-5572.rs +++ b/src/test/run-pass/issue-5572.rs @@ -8,6 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn foo(_t: T) { } +fn foo(_t: T) { } pub fn main() { } diff --git a/src/test/run-pass/issue-6341.rs b/src/test/run-pass/issue-6341.rs index 3859d15585158..e82448a44200c 100644 --- a/src/test/run-pass/issue-6341.rs +++ b/src/test/run-pass/issue-6341.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[deriving(Eq)] +#[deriving(PartialEq)] struct A { x: uint } impl Drop for A { diff --git a/src/test/run-pass/monomorphize-abi-alignment.rs b/src/test/run-pass/monomorphize-abi-alignment.rs index 58d4d6a3dbac7..2233a5c3ea774 100644 --- a/src/test/run-pass/monomorphize-abi-alignment.rs +++ b/src/test/run-pass/monomorphize-abi-alignment.rs @@ -20,9 +20,9 @@ struct S { i:u8, t:T } impl S { fn unwrap(self) -> T { self.t } } -#[deriving(Eq, Show)] +#[deriving(PartialEq, Show)] struct A((u32, u32)); -#[deriving(Eq, Show)] +#[deriving(PartialEq, Show)] struct B(u64); pub fn main() { diff --git a/src/test/run-pass/multiple-trait-bounds.rs b/src/test/run-pass/multiple-trait-bounds.rs index fc052b6a38955..7ce1afb52a274 100644 --- a/src/test/run-pass/multiple-trait-bounds.rs +++ b/src/test/run-pass/multiple-trait-bounds.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn f(_: T) { +fn f(_: T) { } pub fn main() { diff --git a/src/test/run-pass/newtype-temporary.rs b/src/test/run-pass/newtype-temporary.rs index 1ed93dd278b68..b38bc9b6946a3 100644 --- a/src/test/run-pass/newtype-temporary.rs +++ b/src/test/run-pass/newtype-temporary.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[deriving(Eq, Show)] +#[deriving(PartialEq, Show)] struct Foo(uint); fn foo() -> Foo { diff --git a/src/test/run-pass/operator-overloading.rs b/src/test/run-pass/operator-overloading.rs index 66783ad78e530..00e19b8481f21 100644 --- a/src/test/run-pass/operator-overloading.rs +++ b/src/test/run-pass/operator-overloading.rs @@ -48,7 +48,7 @@ impl ops::Index for Point { } } -impl cmp::Eq for Point { +impl cmp::PartialEq for Point { fn eq(&self, other: &Point) -> bool { (*self).x == (*other).x && (*self).y == (*other).y } diff --git a/src/test/run-pass/overload-index-operator.rs b/src/test/run-pass/overload-index-operator.rs index 1727de79c7862..6ac079f461609 100644 --- a/src/test/run-pass/overload-index-operator.rs +++ b/src/test/run-pass/overload-index-operator.rs @@ -30,7 +30,7 @@ impl AssociationList { } } -impl Index for AssociationList { +impl Index for AssociationList { fn index(&self, index: &K) -> V { for pair in self.pairs.iter() { if pair.key == *index { diff --git a/src/test/run-pass/overloaded-autoderef-count.rs b/src/test/run-pass/overloaded-autoderef-count.rs index 00877e7c2c90b..6fdbd17c21b38 100644 --- a/src/test/run-pass/overloaded-autoderef-count.rs +++ b/src/test/run-pass/overloaded-autoderef-count.rs @@ -11,7 +11,7 @@ use std::cell::Cell; use std::ops::{Deref, DerefMut}; -#[deriving(Eq)] +#[deriving(PartialEq)] struct DerefCounter { count_imm: Cell, count_mut: uint, @@ -46,7 +46,7 @@ impl DerefMut for DerefCounter { } } -#[deriving(Eq, Show)] +#[deriving(PartialEq, Show)] struct Point { x: int, y: int diff --git a/src/test/run-pass/overloaded-autoderef.rs b/src/test/run-pass/overloaded-autoderef.rs index c9d5d02c2478f..782cea2979f27 100644 --- a/src/test/run-pass/overloaded-autoderef.rs +++ b/src/test/run-pass/overloaded-autoderef.rs @@ -12,7 +12,7 @@ use std::cell::RefCell; use std::rc::Rc; use std::string::String; -#[deriving(Eq, Show)] +#[deriving(PartialEq, Show)] struct Point { x: int, y: int diff --git a/src/test/run-pass/overloaded-deref.rs b/src/test/run-pass/overloaded-deref.rs index b28494109deb7..17cd9f8ef0535 100644 --- a/src/test/run-pass/overloaded-deref.rs +++ b/src/test/run-pass/overloaded-deref.rs @@ -12,7 +12,7 @@ use std::cell::RefCell; use std::rc::Rc; use std::string::String; -#[deriving(Eq, Show)] +#[deriving(PartialEq, Show)] struct Point { x: int, y: int diff --git a/src/test/run-pass/packed-struct-vec.rs b/src/test/run-pass/packed-struct-vec.rs index 94e4e3c6bef29..8309e95820cf1 100644 --- a/src/test/run-pass/packed-struct-vec.rs +++ b/src/test/run-pass/packed-struct-vec.rs @@ -13,7 +13,7 @@ use std::mem; #[packed] -#[deriving(Eq, Show)] +#[deriving(PartialEq, Show)] struct Foo { bar: u8, baz: u64 diff --git a/src/test/run-pass/regions-lifetime-static-items-enclosing-scopes.rs b/src/test/run-pass/regions-lifetime-static-items-enclosing-scopes.rs index 9e0ca20369831..d61d7089d89e6 100644 --- a/src/test/run-pass/regions-lifetime-static-items-enclosing-scopes.rs +++ b/src/test/run-pass/regions-lifetime-static-items-enclosing-scopes.rs @@ -11,9 +11,9 @@ // This test verifies that temporary lifetime is correctly computed // for static objects in enclosing scopes. -use std::cmp::Eq; +use std::cmp::PartialEq; -fn f(o: &mut Option) { +fn f(o: &mut Option) { assert!(*o == None); } diff --git a/src/test/run-pass/regions-mock-tcx.rs b/src/test/run-pass/regions-mock-tcx.rs index 7e071177ff9f1..1d7521b74506d 100644 --- a/src/test/run-pass/regions-mock-tcx.rs +++ b/src/test/run-pass/regions-mock-tcx.rs @@ -30,7 +30,7 @@ enum TypeStructure<'tcx> { TypeInt, TypeFunction(Type<'tcx>, Type<'tcx>), } -impl<'tcx> Eq for TypeStructure<'tcx> { +impl<'tcx> PartialEq for TypeStructure<'tcx> { fn eq(&self, other: &TypeStructure<'tcx>) -> bool { match (*self, *other) { (TypeInt, TypeInt) => true, @@ -86,7 +86,7 @@ impl<'tcx,'ast> TypeContext<'tcx, 'ast> { } } -#[deriving(Eq, TotalEq, Hash)] +#[deriving(PartialEq, TotalEq, Hash)] struct NodeId { id: uint } diff --git a/src/test/run-pass/small-enums-with-fields.rs b/src/test/run-pass/small-enums-with-fields.rs index e7d4e25c2bb99..7cc6725a509a6 100644 --- a/src/test/run-pass/small-enums-with-fields.rs +++ b/src/test/run-pass/small-enums-with-fields.rs @@ -14,7 +14,7 @@ extern crate debug; use std::mem::size_of; -#[deriving(Eq, Show)] +#[deriving(PartialEq, Show)] enum Either { Left(T), Right(U) } macro_rules! check { diff --git a/src/test/run-pass/struct-lit-functional-no-fields.rs b/src/test/run-pass/struct-lit-functional-no-fields.rs index e8c18607f95a0..9212a72e5d417 100644 --- a/src/test/run-pass/struct-lit-functional-no-fields.rs +++ b/src/test/run-pass/struct-lit-functional-no-fields.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[deriving(Show,Eq,Clone)] +#[deriving(Show,PartialEq,Clone)] struct Foo { bar: T, baz: T diff --git a/src/test/run-pass/structured-compare.rs b/src/test/run-pass/structured-compare.rs index b21c7684f691e..f6b5531770bed 100644 --- a/src/test/run-pass/structured-compare.rs +++ b/src/test/run-pass/structured-compare.rs @@ -13,7 +13,7 @@ #[deriving(Show)] enum foo { large, small, } -impl Eq for foo { +impl PartialEq for foo { fn eq(&self, other: &foo) -> bool { ((*self) as uint) == ((*other) as uint) } diff --git a/src/test/run-pass/tag-variant-disr-val.rs b/src/test/run-pass/tag-variant-disr-val.rs index 914904f2070e0..191a6a9c7e2ec 100644 --- a/src/test/run-pass/tag-variant-disr-val.rs +++ b/src/test/run-pass/tag-variant-disr-val.rs @@ -19,7 +19,7 @@ enum color { orange = 8 >> 1 } -impl Eq for color { +impl PartialEq for color { fn eq(&self, other: &color) -> bool { ((*self) as uint) == ((*other) as uint) } diff --git a/src/test/run-pass/tag.rs b/src/test/run-pass/tag.rs index 989f911134bb3..91c8b433b4e6b 100644 --- a/src/test/run-pass/tag.rs +++ b/src/test/run-pass/tag.rs @@ -11,7 +11,7 @@ enum colour { red(int, int), green, } -impl Eq for colour { +impl PartialEq for colour { fn eq(&self, other: &colour) -> bool { match *self { red(a0, b0) => { diff --git a/src/test/run-pass/task-comm-16.rs b/src/test/run-pass/task-comm-16.rs index 18336a603187d..9263cd1d48542 100644 --- a/src/test/run-pass/task-comm-16.rs +++ b/src/test/run-pass/task-comm-16.rs @@ -52,7 +52,7 @@ enum t { tag3(int, u8, char) } -impl cmp::Eq for t { +impl cmp::PartialEq for t { fn eq(&self, other: &t) -> bool { match *self { tag1 => { diff --git a/src/test/run-pass/trait-inheritance-num.rs b/src/test/run-pass/trait-inheritance-num.rs index a611a55896e4d..8cf83fdf2d0d7 100644 --- a/src/test/run-pass/trait-inheritance-num.rs +++ b/src/test/run-pass/trait-inheritance-num.rs @@ -9,10 +9,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::cmp::{Eq, Ord}; +use std::cmp::{PartialEq, PartialOrd}; use std::num::NumCast; -pub trait NumExt: Num + NumCast + Eq + Ord {} +pub trait NumExt: Num + NumCast + PartialEq + PartialOrd {} pub trait FloatExt: NumExt {} diff --git a/src/test/run-pass/trait-inheritance-num1.rs b/src/test/run-pass/trait-inheritance-num1.rs index 28abae175cdfb..379acf26c1955 100644 --- a/src/test/run-pass/trait-inheritance-num1.rs +++ b/src/test/run-pass/trait-inheritance-num1.rs @@ -8,10 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::cmp::Ord; +use std::cmp::PartialOrd; use std::num::NumCast; -pub trait NumExt: Num + NumCast + Ord { } +pub trait NumExt: Num + NumCast + PartialOrd { } fn greater_than_one(n: &T) -> bool { *n > NumCast::from(1).unwrap() diff --git a/src/test/run-pass/trait-inheritance-num2.rs b/src/test/run-pass/trait-inheritance-num2.rs index 3edf0c526192c..b3f769798b32a 100644 --- a/src/test/run-pass/trait-inheritance-num2.rs +++ b/src/test/run-pass/trait-inheritance-num2.rs @@ -11,7 +11,7 @@ // A more complex example of numeric extensions -use std::cmp::{Eq, Ord}; +use std::cmp::{PartialEq, PartialOrd}; pub trait TypeExt {} @@ -32,7 +32,7 @@ impl TypeExt for f32 {} impl TypeExt for f64 {} -pub trait NumExt: TypeExt + Eq + Ord + Num + NumCast {} +pub trait NumExt: TypeExt + PartialEq + PartialOrd + Num + NumCast {} impl NumExt for u8 {} impl NumExt for u16 {} diff --git a/src/test/run-pass/trait-inheritance-num3.rs b/src/test/run-pass/trait-inheritance-num3.rs index 7909f01591228..fc17aa113408e 100644 --- a/src/test/run-pass/trait-inheritance-num3.rs +++ b/src/test/run-pass/trait-inheritance-num3.rs @@ -8,10 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::cmp::{Eq, Ord}; +use std::cmp::{PartialEq, PartialOrd}; use std::num::NumCast; -pub trait NumExt: Eq + Ord + Num + NumCast {} +pub trait NumExt: PartialEq + PartialOrd + Num + NumCast {} impl NumExt for f32 {} diff --git a/src/test/run-pass/trait-inheritance-num5.rs b/src/test/run-pass/trait-inheritance-num5.rs index 0310dde2a6d3b..3a0605302a256 100644 --- a/src/test/run-pass/trait-inheritance-num5.rs +++ b/src/test/run-pass/trait-inheritance-num5.rs @@ -8,10 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::cmp::Eq; +use std::cmp::PartialEq; use std::num::NumCast; -pub trait NumExt: Eq + Num + NumCast {} +pub trait NumExt: PartialEq + Num + NumCast {} impl NumExt for f32 {} impl NumExt for int {} diff --git a/src/test/run-pass/trait-inheritance-overloading-simple.rs b/src/test/run-pass/trait-inheritance-overloading-simple.rs index 13cfb08e81be2..bd9bc9e9b8875 100644 --- a/src/test/run-pass/trait-inheritance-overloading-simple.rs +++ b/src/test/run-pass/trait-inheritance-overloading-simple.rs @@ -8,14 +8,14 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::cmp::Eq; +use std::cmp::PartialEq; -trait MyNum : Eq { } +trait MyNum : PartialEq { } #[deriving(Show)] struct MyInt { val: int } -impl Eq for MyInt { +impl PartialEq for MyInt { fn eq(&self, other: &MyInt) -> bool { self.val == other.val } fn ne(&self, other: &MyInt) -> bool { !self.eq(other) } } diff --git a/src/test/run-pass/trait-inheritance-overloading.rs b/src/test/run-pass/trait-inheritance-overloading.rs index f7c124b945a70..b13ea7ae0baef 100644 --- a/src/test/run-pass/trait-inheritance-overloading.rs +++ b/src/test/run-pass/trait-inheritance-overloading.rs @@ -8,9 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::cmp::Eq; +use std::cmp::PartialEq; -trait MyNum : Add + Sub + Mul + Eq { } +trait MyNum : Add + Sub + Mul + PartialEq { } #[deriving(Show)] struct MyInt { val: int } @@ -27,7 +27,7 @@ impl Mul for MyInt { fn mul(&self, other: &MyInt) -> MyInt { mi(self.val * other.val) } } -impl Eq for MyInt { +impl PartialEq for MyInt { fn eq(&self, other: &MyInt) -> bool { self.val == other.val } fn ne(&self, other: &MyInt) -> bool { !self.eq(other) } } diff --git a/src/test/run-pass/tuple-struct-constructor-pointer.rs b/src/test/run-pass/tuple-struct-constructor-pointer.rs index 77bfa4390630b..281ea39084f59 100644 --- a/src/test/run-pass/tuple-struct-constructor-pointer.rs +++ b/src/test/run-pass/tuple-struct-constructor-pointer.rs @@ -8,9 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[deriving(Eq, Show)] +#[deriving(PartialEq, Show)] struct Foo(int); -#[deriving(Eq, Show)] +#[deriving(PartialEq, Show)] struct Bar(int, int); pub fn main() { diff --git a/src/test/run-pass/unique-kinds.rs b/src/test/run-pass/unique-kinds.rs index 6d088a1f6d468..65a8314fe8eba 100644 --- a/src/test/run-pass/unique-kinds.rs +++ b/src/test/run-pass/unique-kinds.rs @@ -8,15 +8,15 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use std::cmp::Eq; +use std::cmp::PartialEq; fn sendable() { - fn f(i: T, j: T) { + fn f(i: T, j: T) { assert!(i == j); } - fn g(i: T, j: T) { + fn g(i: T, j: T) { assert!(i != j); } @@ -30,11 +30,11 @@ fn sendable() { fn copyable() { - fn f(i: T, j: T) { + fn f(i: T, j: T) { assert!(i == j); } - fn g(i: T, j: T) { + fn g(i: T, j: T) { assert!(i != j); } @@ -48,11 +48,11 @@ fn copyable() { fn noncopyable() { - fn f(i: T, j: T) { + fn f(i: T, j: T) { assert!(i == j); } - fn g(i: T, j: T) { + fn g(i: T, j: T) { assert!(i != j); } diff --git a/src/test/run-pass/vector-sort-failure-safe.rs b/src/test/run-pass/vector-sort-failure-safe.rs index e5f1c48464de3..e4e419e4988c1 100644 --- a/src/test/run-pass/vector-sort-failure-safe.rs +++ b/src/test/run-pass/vector-sort-failure-safe.rs @@ -15,7 +15,7 @@ static MAX_LEN: uint = 20; static mut drop_counts: [uint, .. MAX_LEN] = [0, .. MAX_LEN]; static mut clone_count: uint = 0; -#[deriving(Rand, Eq, Ord, TotalEq, TotalOrd)] +#[deriving(Rand, PartialEq, PartialOrd, TotalEq, TotalOrd)] struct DropCounter { x: uint, clone_num: uint } impl Clone for DropCounter { diff --git a/src/test/run-pass/while-prelude-drop.rs b/src/test/run-pass/while-prelude-drop.rs index b66a2f1d1de45..28fbab41d95e0 100644 --- a/src/test/run-pass/while-prelude-drop.rs +++ b/src/test/run-pass/while-prelude-drop.rs @@ -10,7 +10,7 @@ use std::string::String; -#[deriving(Eq)] +#[deriving(PartialEq)] enum t { a, b(String), } fn make(i: int) -> t {