mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-14 07:53:24 +00:00
auto merge of #18907 : alexcrichton/rust/snapshots, r=jakub-,jakub
This commit is contained in:
commit
7a86aa83ee
@ -65,50 +65,12 @@ impl<T: Clone> Clone for Box<T> {
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
impl<T:PartialEq> PartialEq for Box<T> {
|
||||
#[inline]
|
||||
fn eq(&self, other: &Box<T>) -> bool { *(*self) == *(*other) }
|
||||
#[inline]
|
||||
fn ne(&self, other: &Box<T>) -> bool { *(*self) != *(*other) }
|
||||
}
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
impl<T:PartialOrd> PartialOrd for Box<T> {
|
||||
#[inline]
|
||||
fn partial_cmp(&self, other: &Box<T>) -> Option<Ordering> {
|
||||
(**self).partial_cmp(&**other)
|
||||
}
|
||||
#[inline]
|
||||
fn lt(&self, other: &Box<T>) -> bool { *(*self) < *(*other) }
|
||||
#[inline]
|
||||
fn le(&self, other: &Box<T>) -> bool { *(*self) <= *(*other) }
|
||||
#[inline]
|
||||
fn ge(&self, other: &Box<T>) -> bool { *(*self) >= *(*other) }
|
||||
#[inline]
|
||||
fn gt(&self, other: &Box<T>) -> bool { *(*self) > *(*other) }
|
||||
}
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
impl<T: Ord> Ord for Box<T> {
|
||||
#[inline]
|
||||
fn cmp(&self, other: &Box<T>) -> Ordering {
|
||||
(**self).cmp(&**other)
|
||||
}
|
||||
}
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
impl<T: Eq> Eq for Box<T> {}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
impl<Sized? T: PartialEq> PartialEq for Box<T> {
|
||||
#[inline]
|
||||
fn eq(&self, other: &Box<T>) -> bool { PartialEq::eq(&**self, &**other) }
|
||||
#[inline]
|
||||
fn ne(&self, other: &Box<T>) -> bool { PartialEq::ne(&**self, &**other) }
|
||||
}
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
impl<Sized? T: PartialOrd> PartialOrd for Box<T> {
|
||||
#[inline]
|
||||
fn partial_cmp(&self, other: &Box<T>) -> Option<Ordering> {
|
||||
@ -123,14 +85,12 @@ impl<Sized? T: PartialOrd> PartialOrd for Box<T> {
|
||||
#[inline]
|
||||
fn gt(&self, other: &Box<T>) -> bool { PartialOrd::gt(&**self, &**other) }
|
||||
}
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
impl<Sized? T: Ord> Ord for Box<T> {
|
||||
#[inline]
|
||||
fn cmp(&self, other: &Box<T>) -> Ordering {
|
||||
Ord::cmp(&**self, &**other)
|
||||
}
|
||||
}
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
impl<Sized? T: Eq> Eq for Box<T> {}
|
||||
|
||||
/// Extension methods for an owning `Any` trait object.
|
||||
|
@ -534,13 +534,6 @@ impl<'a> PartialOrd for MaybeOwned<'a> {
|
||||
}
|
||||
|
||||
impl<'a> Ord for MaybeOwned<'a> {
|
||||
// NOTE(stage0): remove method after a snapshot
|
||||
#[cfg(stage0)]
|
||||
#[inline]
|
||||
fn cmp(&self, other: &MaybeOwned) -> Ordering {
|
||||
self.as_slice().cmp(&other.as_slice())
|
||||
}
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
#[inline]
|
||||
fn cmp(&self, other: &MaybeOwned) -> Ordering {
|
||||
self.as_slice().cmp(other.as_slice())
|
||||
|
@ -506,13 +506,6 @@ impl<T: PartialEq> PartialEq for Vec<T> {
|
||||
|
||||
#[unstable = "waiting on PartialOrd stability"]
|
||||
impl<T: PartialOrd> PartialOrd for Vec<T> {
|
||||
// NOTE(stage0): remove method after a snapshot
|
||||
#[cfg(stage0)]
|
||||
#[inline]
|
||||
fn partial_cmp(&self, other: &Vec<T>) -> Option<Ordering> {
|
||||
self.as_slice().partial_cmp(&other.as_slice())
|
||||
}
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
#[inline]
|
||||
fn partial_cmp(&self, other: &Vec<T>) -> Option<Ordering> {
|
||||
self.as_slice().partial_cmp(other.as_slice())
|
||||
@ -530,13 +523,6 @@ impl<T: PartialEq, V: AsSlice<T>> Equiv<V> for Vec<T> {
|
||||
|
||||
#[unstable = "waiting on Ord stability"]
|
||||
impl<T: Ord> Ord for Vec<T> {
|
||||
// NOTE(stage0): remove method after a snapshot
|
||||
#[cfg(stage0)]
|
||||
#[inline]
|
||||
fn cmp(&self, other: &Vec<T>) -> Ordering {
|
||||
self.as_slice().cmp(&other.as_slice())
|
||||
}
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
#[inline]
|
||||
fn cmp(&self, other: &Vec<T>) -> Ordering {
|
||||
self.as_slice().cmp(other.as_slice())
|
||||
|
@ -55,33 +55,6 @@ use option::{Option, Some, None};
|
||||
///
|
||||
/// Eventually, this will be implemented by default for types that implement
|
||||
/// `Eq`.
|
||||
// NOTE(stage0): remove trait after a snapshot
|
||||
#[cfg(stage0)]
|
||||
#[lang="eq"]
|
||||
#[unstable = "Definition may change slightly after trait reform"]
|
||||
pub trait PartialEq {
|
||||
/// This method tests for `self` and `other` values to be equal, and is used by `==`.
|
||||
fn eq(&self, other: &Self) -> bool;
|
||||
|
||||
/// This method tests for `!=`.
|
||||
#[inline]
|
||||
fn ne(&self, other: &Self) -> bool { !self.eq(other) }
|
||||
}
|
||||
|
||||
/// Trait for values that can be compared for equality and inequality.
|
||||
///
|
||||
/// This trait allows for partial equality, for types that do not have an
|
||||
/// equivalence relation. For example, in floating point numbers `NaN != NaN`,
|
||||
/// so floating point types implement `PartialEq` but not `Eq`.
|
||||
///
|
||||
/// PartialEq only requires the `eq` method to be implemented; `ne` is defined
|
||||
/// in terms of it by default. Any manual implementation of `ne` *must* respect
|
||||
/// the rule that `eq` is a strict inverse of `ne`; that is, `!(a == b)` if and
|
||||
/// only if `a != b`.
|
||||
///
|
||||
/// Eventually, this will be implemented by default for types that implement
|
||||
/// `Eq`.
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
#[lang="eq"]
|
||||
#[unstable = "Definition may change slightly after trait reform"]
|
||||
pub trait PartialEq for Sized? {
|
||||
@ -102,32 +75,6 @@ pub trait PartialEq for Sized? {
|
||||
/// - reflexive: `a == a`;
|
||||
/// - symmetric: `a == b` implies `b == a`; and
|
||||
/// - transitive: `a == b` and `b == c` implies `a == c`.
|
||||
// NOTE(stage0): remove trait after a snapshot
|
||||
#[cfg(stage0)]
|
||||
#[unstable = "Definition may change slightly after trait reform"]
|
||||
pub trait Eq: PartialEq {
|
||||
// FIXME #13101: this method is used solely by #[deriving] to
|
||||
// assert that every component of a type implements #[deriving]
|
||||
// itself, the current deriving infrastructure means doing this
|
||||
// assertion without using a method on this trait is nearly
|
||||
// impossible.
|
||||
//
|
||||
// This should never be implemented by hand.
|
||||
#[doc(hidden)]
|
||||
#[inline(always)]
|
||||
fn assert_receiver_is_total_eq(&self) {}
|
||||
}
|
||||
|
||||
/// Trait for equality comparisons which are [equivalence relations](
|
||||
/// https://en.wikipedia.org/wiki/Equivalence_relation).
|
||||
///
|
||||
/// This means, that in addition to `a == b` and `a != b` being strict
|
||||
/// inverses, the equality must be (for all `a`, `b` and `c`):
|
||||
///
|
||||
/// - reflexive: `a == a`;
|
||||
/// - symmetric: `a == b` implies `b == a`; and
|
||||
/// - transitive: `a == b` and `b == c` implies `a == c`.
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
#[unstable = "Definition may change slightly after trait reform"]
|
||||
pub trait Eq for Sized?: PartialEq {
|
||||
// FIXME #13101: this method is used solely by #[deriving] to
|
||||
@ -198,33 +145,6 @@ impl Ordering {
|
||||
/// true; and
|
||||
/// - transitive, `a < b` and `b < c` implies `a < c`. The same must hold for
|
||||
/// both `==` and `>`.
|
||||
// NOTE(stage0): remove trait after a snapshot
|
||||
#[cfg(stage0)]
|
||||
#[unstable = "Definition may change slightly after trait reform"]
|
||||
pub trait Ord: Eq + PartialOrd {
|
||||
/// This method returns an ordering between `self` and `other` values.
|
||||
///
|
||||
/// By convention, `self.cmp(&other)` returns the ordering matching
|
||||
/// the expression `self <operator> other` if true. For example:
|
||||
///
|
||||
/// ```
|
||||
/// assert_eq!( 5u.cmp(&10), Less); // because 5 < 10
|
||||
/// assert_eq!(10u.cmp(&5), Greater); // because 10 > 5
|
||||
/// assert_eq!( 5u.cmp(&5), Equal); // because 5 == 5
|
||||
/// ```
|
||||
fn cmp(&self, other: &Self) -> Ordering;
|
||||
}
|
||||
|
||||
/// Trait for types that form a [total order](
|
||||
/// https://en.wikipedia.org/wiki/Total_order).
|
||||
///
|
||||
/// An order is a total order if it is (for all `a`, `b` and `c`):
|
||||
///
|
||||
/// - total and antisymmetric: exactly one of `a < b`, `a == b` or `a > b` is
|
||||
/// true; and
|
||||
/// - transitive, `a < b` and `b < c` implies `a < c`. The same must hold for
|
||||
/// both `==` and `>`.
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
#[unstable = "Definition may change slightly after trait reform"]
|
||||
pub trait Ord for Sized?: Eq + PartialOrd {
|
||||
/// This method returns an ordering between `self` and `other` values.
|
||||
@ -268,62 +188,6 @@ impl PartialOrd for Ordering {
|
||||
/// which do not have a total order. For example, for floating point numbers,
|
||||
/// `NaN < 0 == false` and `NaN >= 0 == false` (cf. IEEE 754-2008 section
|
||||
/// 5.11).
|
||||
// NOTE(stage0): remove trait after a snapshot
|
||||
#[cfg(stage0)]
|
||||
#[lang="ord"]
|
||||
#[unstable = "Definition may change slightly after trait reform"]
|
||||
pub trait PartialOrd: PartialEq {
|
||||
/// This method returns an ordering between `self` and `other` values
|
||||
/// if one exists.
|
||||
fn partial_cmp(&self, other: &Self) -> Option<Ordering>;
|
||||
|
||||
/// This method tests less than (for `self` and `other`) and is used by the `<` operator.
|
||||
#[inline]
|
||||
fn lt(&self, other: &Self) -> bool {
|
||||
match self.partial_cmp(other) {
|
||||
Some(Less) => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
/// This method tests less than or equal to (`<=`).
|
||||
#[inline]
|
||||
fn le(&self, other: &Self) -> bool {
|
||||
match self.partial_cmp(other) {
|
||||
Some(Less) | Some(Equal) => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
/// This method tests greater than (`>`).
|
||||
#[inline]
|
||||
fn gt(&self, other: &Self) -> bool {
|
||||
match self.partial_cmp(other) {
|
||||
Some(Greater) => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
/// This method tests greater than or equal to (`>=`).
|
||||
#[inline]
|
||||
fn ge(&self, other: &Self) -> bool {
|
||||
match self.partial_cmp(other) {
|
||||
Some(Greater) | Some(Equal) => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Trait for values that can be compared for a sort-order.
|
||||
///
|
||||
/// PartialOrd only requires implementation of the `partial_cmp` method,
|
||||
/// with the others generated from default implementations.
|
||||
///
|
||||
/// However it remains possible to implement the others separately for types
|
||||
/// which do not have a total order. For example, for floating point numbers,
|
||||
/// `NaN < 0 == false` and `NaN >= 0 == false` (cf. IEEE 754-2008 section
|
||||
/// 5.11).
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
#[lang="ord"]
|
||||
#[unstable = "Definition may change slightly after trait reform"]
|
||||
pub trait PartialOrd for Sized?: PartialEq {
|
||||
@ -422,7 +286,6 @@ pub fn partial_max<T: PartialOrd>(v1: T, v2: T) -> Option<T> {
|
||||
mod impls {
|
||||
use cmp::{PartialOrd, Ord, PartialEq, Eq, Ordering,
|
||||
Less, Greater, Equal};
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
use kinds::Sized;
|
||||
use option::{Option, Some, None};
|
||||
|
||||
@ -531,45 +394,7 @@ mod impls {
|
||||
ord_impl!(char uint u8 u16 u32 u64 int i8 i16 i32 i64)
|
||||
|
||||
// & pointers
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
#[unstable = "Trait is unstable."]
|
||||
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) }
|
||||
}
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
#[unstable = "Trait is unstable."]
|
||||
impl<'a, T: PartialOrd> PartialOrd for &'a T {
|
||||
#[inline]
|
||||
fn partial_cmp(&self, other: &&'a T) -> Option<Ordering> {
|
||||
(**self).partial_cmp(*other)
|
||||
}
|
||||
#[inline]
|
||||
fn lt(&self, other: & &'a T) -> bool { *(*self) < *(*other) }
|
||||
#[inline]
|
||||
fn le(&self, other: & &'a T) -> bool { *(*self) <= *(*other) }
|
||||
#[inline]
|
||||
fn ge(&self, other: & &'a T) -> bool { *(*self) >= *(*other) }
|
||||
#[inline]
|
||||
fn gt(&self, other: & &'a T) -> bool { *(*self) > *(*other) }
|
||||
}
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
#[unstable = "Trait is unstable."]
|
||||
impl<'a, T: Ord> Ord for &'a T {
|
||||
#[inline]
|
||||
fn cmp(&self, other: & &'a T) -> Ordering { (**self).cmp(*other) }
|
||||
}
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
#[unstable = "Trait is unstable."]
|
||||
impl<'a, T: Eq> Eq for &'a T {}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
#[unstable = "Trait is unstable."]
|
||||
impl<'a, Sized? T: PartialEq> PartialEq for &'a T {
|
||||
#[inline]
|
||||
@ -577,7 +402,6 @@ mod impls {
|
||||
#[inline]
|
||||
fn ne(&self, other: & &'a T) -> bool { PartialEq::ne(*self, *other) }
|
||||
}
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
#[unstable = "Trait is unstable."]
|
||||
impl<'a, Sized? T: PartialOrd> PartialOrd for &'a T {
|
||||
#[inline]
|
||||
@ -593,56 +417,16 @@ mod impls {
|
||||
#[inline]
|
||||
fn gt(&self, other: & &'a T) -> bool { PartialOrd::gt(*self, *other) }
|
||||
}
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
#[unstable = "Trait is unstable."]
|
||||
impl<'a, Sized? T: Ord> Ord for &'a T {
|
||||
#[inline]
|
||||
fn cmp(&self, other: & &'a T) -> Ordering { Ord::cmp(*self, *other) }
|
||||
}
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
#[unstable = "Trait is unstable."]
|
||||
impl<'a, Sized? T: Eq> Eq for &'a T {}
|
||||
|
||||
// &mut pointers
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
#[unstable = "Trait is unstable."]
|
||||
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) }
|
||||
}
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
#[unstable = "Trait is unstable."]
|
||||
impl<'a, T: PartialOrd> PartialOrd for &'a mut T {
|
||||
#[inline]
|
||||
fn partial_cmp(&self, other: &&'a mut T) -> Option<Ordering> {
|
||||
(**self).partial_cmp(*other)
|
||||
}
|
||||
#[inline]
|
||||
fn lt(&self, other: &&'a mut T) -> bool { **self < **other }
|
||||
#[inline]
|
||||
fn le(&self, other: &&'a mut T) -> bool { **self <= **other }
|
||||
#[inline]
|
||||
fn ge(&self, other: &&'a mut T) -> bool { **self >= **other }
|
||||
#[inline]
|
||||
fn gt(&self, other: &&'a mut T) -> bool { **self > **other }
|
||||
}
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
#[unstable = "Trait is unstable."]
|
||||
impl<'a, T: Ord> Ord for &'a mut T {
|
||||
#[inline]
|
||||
fn cmp(&self, other: &&'a mut T) -> Ordering { (**self).cmp(*other) }
|
||||
}
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
#[unstable = "Trait is unstable."]
|
||||
impl<'a, T: Eq> Eq for &'a mut T {}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
#[unstable = "Trait is unstable."]
|
||||
impl<'a, Sized? T: PartialEq> PartialEq for &'a mut T {
|
||||
#[inline]
|
||||
@ -650,7 +434,6 @@ mod impls {
|
||||
#[inline]
|
||||
fn ne(&self, other: &&'a mut T) -> bool { PartialEq::ne(*self, *other) }
|
||||
}
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
#[unstable = "Trait is unstable."]
|
||||
impl<'a, Sized? T: PartialOrd> PartialOrd for &'a mut T {
|
||||
#[inline]
|
||||
@ -666,13 +449,11 @@ mod impls {
|
||||
#[inline]
|
||||
fn gt(&self, other: &&'a mut T) -> bool { PartialOrd::gt(*self, *other) }
|
||||
}
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
#[unstable = "Trait is unstable."]
|
||||
impl<'a, Sized? T: Ord> Ord for &'a mut T {
|
||||
#[inline]
|
||||
fn cmp(&self, other: &&'a mut T) -> Ordering { Ord::cmp(*self, *other) }
|
||||
}
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
#[unstable = "Trait is unstable."]
|
||||
impl<'a, Sized? T: Eq> Eq for &'a mut T {}
|
||||
}
|
||||
|
@ -127,7 +127,6 @@ pub mod unit;
|
||||
pub mod fmt;
|
||||
|
||||
// note: does not need to be public
|
||||
#[cfg(not(stage0))]
|
||||
mod array;
|
||||
|
||||
#[doc(hidden)]
|
||||
|
@ -805,12 +805,10 @@ pub trait Deref<Sized? Result> {
|
||||
fn deref<'a>(&'a self) -> &'a Result;
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))]
|
||||
impl<'a, Sized? T> Deref<T> for &'a T {
|
||||
fn deref(&self) -> &T { *self }
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))]
|
||||
impl<'a, Sized? T> Deref<T> for &'a mut T {
|
||||
fn deref(&self) -> &T { *self }
|
||||
}
|
||||
@ -855,7 +853,6 @@ pub trait DerefMut<Sized? Result>: Deref<Result> {
|
||||
fn deref_mut<'a>(&'a mut self) -> &'a mut Result;
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))]
|
||||
impl<'a, Sized? T> DerefMut<T> for &'a mut T {
|
||||
fn deref_mut(&mut self) -> &mut T { *self }
|
||||
}
|
||||
|
@ -1661,21 +1661,6 @@ pub mod bytes {
|
||||
// Boilerplate traits
|
||||
//
|
||||
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
#[unstable = "waiting for DST"]
|
||||
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())
|
||||
}
|
||||
fn ne(&self, other: & &'a [T]) -> bool {
|
||||
self.len() != other.len() ||
|
||||
order::ne(self.iter(), other.iter())
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
#[unstable = "waiting for DST"]
|
||||
impl<T: PartialEq> PartialEq for [T] {
|
||||
fn eq(&self, other: &[T]) -> bool {
|
||||
@ -1688,12 +1673,6 @@ impl<T: PartialEq> PartialEq for [T] {
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
#[unstable = "waiting for DST"]
|
||||
impl<'a,T:Eq> Eq for &'a [T] {}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
#[unstable = "waiting for DST"]
|
||||
impl<T: Eq> Eq for [T] {}
|
||||
|
||||
@ -1703,41 +1682,12 @@ impl<T: PartialEq, V: AsSlice<T>> Equiv<V> for [T] {
|
||||
fn equiv(&self, other: &V) -> bool { self.as_slice() == other.as_slice() }
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
#[unstable = "waiting for DST"]
|
||||
impl<'a,T:PartialEq> PartialEq for &'a mut [T] {
|
||||
fn eq(&self, other: & &'a mut [T]) -> bool {
|
||||
self.len() == other.len() &&
|
||||
order::eq(self.iter(), other.iter())
|
||||
}
|
||||
fn ne(&self, other: & &'a mut [T]) -> bool {
|
||||
self.len() != other.len() ||
|
||||
order::ne(self.iter(), other.iter())
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
#[unstable = "waiting for DST"]
|
||||
impl<'a,T:Eq> Eq for &'a mut [T] {}
|
||||
|
||||
#[unstable = "waiting for DST"]
|
||||
impl<'a,T:PartialEq, V: AsSlice<T>> Equiv<V> for &'a mut [T] {
|
||||
#[inline]
|
||||
fn equiv(&self, other: &V) -> bool { self.as_slice() == other.as_slice() }
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
#[unstable = "waiting for DST"]
|
||||
impl<'a,T:Ord> Ord for &'a [T] {
|
||||
fn cmp(&self, other: & &'a [T]) -> Ordering {
|
||||
order::cmp(self.iter(), other.iter())
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
#[unstable = "waiting for DST"]
|
||||
impl<T: Ord> Ord for [T] {
|
||||
fn cmp(&self, other: &[T]) -> Ordering {
|
||||
@ -1745,33 +1695,6 @@ impl<T: Ord> Ord for [T] {
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
#[unstable = "waiting for DST"]
|
||||
impl<'a, T: PartialOrd> PartialOrd for &'a [T] {
|
||||
#[inline]
|
||||
fn partial_cmp(&self, other: &&'a [T]) -> Option<Ordering> {
|
||||
order::partial_cmp(self.iter(), other.iter())
|
||||
}
|
||||
#[inline]
|
||||
fn lt(&self, other: & &'a [T]) -> bool {
|
||||
order::lt(self.iter(), other.iter())
|
||||
}
|
||||
#[inline]
|
||||
fn le(&self, other: & &'a [T]) -> bool {
|
||||
order::le(self.iter(), other.iter())
|
||||
}
|
||||
#[inline]
|
||||
fn ge(&self, other: & &'a [T]) -> bool {
|
||||
order::ge(self.iter(), other.iter())
|
||||
}
|
||||
#[inline]
|
||||
fn gt(&self, other: & &'a [T]) -> bool {
|
||||
order::gt(self.iter(), other.iter())
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
#[unstable = "waiting for DST"]
|
||||
impl<T: PartialOrd> PartialOrd for [T] {
|
||||
#[inline]
|
||||
|
@ -1121,24 +1121,6 @@ pub mod traits {
|
||||
use ops;
|
||||
use str::{Str, StrPrelude, eq_slice};
|
||||
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
impl<'a> Ord for &'a str {
|
||||
#[inline]
|
||||
fn cmp(&self, other: & &'a str) -> Ordering {
|
||||
for (s_b, o_b) in self.bytes().zip(other.bytes()) {
|
||||
match s_b.cmp(&o_b) {
|
||||
Greater => return Greater,
|
||||
Less => return Less,
|
||||
Equal => ()
|
||||
}
|
||||
}
|
||||
|
||||
self.len().cmp(&other.len())
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
impl Ord for str {
|
||||
#[inline]
|
||||
fn cmp(&self, other: &str) -> Ordering {
|
||||
@ -1154,18 +1136,6 @@ pub mod traits {
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
impl<'a> PartialEq for &'a str {
|
||||
#[inline]
|
||||
fn eq(&self, other: & &'a str) -> bool {
|
||||
eq_slice((*self), (*other))
|
||||
}
|
||||
#[inline]
|
||||
fn ne(&self, other: & &'a str) -> bool { !(*self).eq(other) }
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
impl PartialEq for str {
|
||||
#[inline]
|
||||
fn eq(&self, other: &str) -> bool {
|
||||
@ -1175,23 +1145,8 @@ pub mod traits {
|
||||
fn ne(&self, other: &str) -> bool { !(*self).eq(other) }
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
impl<'a> Eq for &'a str {}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
impl Eq for str {}
|
||||
|
||||
// NOTE(stage0): remove impl after a snapshot
|
||||
#[cfg(stage0)]
|
||||
impl<'a> PartialOrd for &'a str {
|
||||
#[inline]
|
||||
fn partial_cmp(&self, other: &&'a str) -> Option<Ordering> {
|
||||
Some(self.cmp(other))
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
impl PartialOrd for str {
|
||||
#[inline]
|
||||
fn partial_cmp(&self, other: &str) -> Option<Ordering> {
|
||||
|
@ -76,24 +76,12 @@ impl<'a, T: PartialEq> PartialEq for MaybeOwnedVector<'a, T> {
|
||||
impl<'a, T: Eq> Eq for MaybeOwnedVector<'a, T> {}
|
||||
|
||||
impl<'a, T: PartialOrd> PartialOrd for MaybeOwnedVector<'a, T> {
|
||||
// NOTE(stage0): remove method after a snapshot
|
||||
#[cfg(stage0)]
|
||||
fn partial_cmp(&self, other: &MaybeOwnedVector<T>) -> Option<Ordering> {
|
||||
self.as_slice().partial_cmp(&other.as_slice())
|
||||
}
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
fn partial_cmp(&self, other: &MaybeOwnedVector<T>) -> Option<Ordering> {
|
||||
self.as_slice().partial_cmp(other.as_slice())
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, T: Ord> Ord for MaybeOwnedVector<'a, T> {
|
||||
// NOTE(stage0): remove method after a snapshot
|
||||
#[cfg(stage0)]
|
||||
fn cmp(&self, other: &MaybeOwnedVector<T>) -> Ordering {
|
||||
self.as_slice().cmp(&other.as_slice())
|
||||
}
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
fn cmp(&self, other: &MaybeOwnedVector<T>) -> Ordering {
|
||||
self.as_slice().cmp(other.as_slice())
|
||||
}
|
||||
|
@ -1020,16 +1020,6 @@ fn is_valid_cap(c: char) -> bool {
|
||||
|| (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove function after a snapshot
|
||||
#[cfg(stage0)]
|
||||
fn find_class(classes: NamedClasses, name: &str) -> Option<Vec<(char, char)>> {
|
||||
match classes.binary_search(|&(s, _)| s.cmp(&name)) {
|
||||
slice::Found(i) => Some(classes[i].val1().to_vec()),
|
||||
slice::NotFound(_) => None,
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
fn find_class(classes: NamedClasses, name: &str) -> Option<Vec<(char, char)>> {
|
||||
match classes.binary_search(|&(s, _)| s.cmp(name)) {
|
||||
slice::Found(i) => Some(classes[i].val1().to_vec()),
|
||||
|
@ -182,21 +182,6 @@ Available lint options:
|
||||
|
||||
");
|
||||
|
||||
// NOTE(stage0): remove function after a snapshot
|
||||
#[cfg(stage0)]
|
||||
fn sort_lints(lints: Vec<(&'static Lint, bool)>) -> Vec<&'static Lint> {
|
||||
let mut lints: Vec<_> = lints.into_iter().map(|(x, _)| x).collect();
|
||||
lints.sort_by(|x: &&Lint, y: &&Lint| {
|
||||
match x.default_level.cmp(&y.default_level) {
|
||||
// The sort doesn't case-fold but it's doubtful we care.
|
||||
Equal => x.name.cmp(&y.name),
|
||||
r => r,
|
||||
}
|
||||
});
|
||||
lints
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
fn sort_lints(lints: Vec<(&'static Lint, bool)>) -> Vec<&'static Lint> {
|
||||
let mut lints: Vec<_> = lints.into_iter().map(|(x, _)| x).collect();
|
||||
lints.sort_by(|x: &&Lint, y: &&Lint| {
|
||||
@ -209,19 +194,6 @@ Available lint options:
|
||||
lints
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove function after a snapshot
|
||||
#[cfg(stage0)]
|
||||
fn sort_lint_groups(lints: Vec<(&'static str, Vec<lint::LintId>, bool)>)
|
||||
-> Vec<(&'static str, Vec<lint::LintId>)> {
|
||||
let mut lints: Vec<_> = lints.into_iter().map(|(x, y, _)| (x, y)).collect();
|
||||
lints.sort_by(|&(x, _): &(&'static str, Vec<lint::LintId>),
|
||||
&(y, _): &(&'static str, Vec<lint::LintId>)| {
|
||||
x.cmp(&y)
|
||||
});
|
||||
lints
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
fn sort_lint_groups(lints: Vec<(&'static str, Vec<lint::LintId>, bool)>)
|
||||
-> Vec<(&'static str, Vec<lint::LintId>)> {
|
||||
let mut lints: Vec<_> = lints.into_iter().map(|(x, y, _)| (x, y)).collect();
|
||||
|
@ -121,13 +121,6 @@ impl PartialEq for CString {
|
||||
}
|
||||
|
||||
impl PartialOrd for CString {
|
||||
// NOTE(stage0): remove method after a snapshot
|
||||
#[cfg(stage0)]
|
||||
#[inline]
|
||||
fn partial_cmp(&self, other: &CString) -> Option<Ordering> {
|
||||
self.as_bytes().partial_cmp(&other.as_bytes())
|
||||
}
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
#[inline]
|
||||
fn partial_cmp(&self, other: &CString) -> Option<Ordering> {
|
||||
self.as_bytes().partial_cmp(other.as_bytes())
|
||||
|
@ -890,18 +890,6 @@ impl Json {
|
||||
|
||||
/// If the Json value is an Object, returns the value associated with the provided key.
|
||||
/// Otherwise, returns None.
|
||||
// NOTE(stage0): remove function after a snapshot
|
||||
#[cfg(stage0)]
|
||||
pub fn find<'a>(&'a self, key: &str) -> Option<&'a Json>{
|
||||
match self {
|
||||
&Object(ref map) => map.find_with(|s| key.cmp(&s.as_slice())),
|
||||
_ => None
|
||||
}
|
||||
}
|
||||
|
||||
/// If the Json value is an Object, returns the value associated with the provided key.
|
||||
/// Otherwise, returns None.
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
pub fn find<'a>(&'a self, key: &str) -> Option<&'a Json>{
|
||||
match self {
|
||||
&Object(ref map) => map.find_with(|s| key.cmp(s.as_slice())),
|
||||
@ -926,32 +914,6 @@ impl Json {
|
||||
/// If the Json value is an Object, performs a depth-first search until
|
||||
/// a value associated with the provided key is found. If no value is found
|
||||
/// or the Json value is not an Object, returns None.
|
||||
// NOTE(stage0): remove function after a snapshot
|
||||
#[cfg(stage0)]
|
||||
pub fn search<'a>(&'a self, key: &str) -> Option<&'a Json> {
|
||||
match self {
|
||||
&Object(ref map) => {
|
||||
match map.find_with(|s| key.cmp(&s.as_slice())) {
|
||||
Some(json_value) => Some(json_value),
|
||||
None => {
|
||||
for (_, v) in map.iter() {
|
||||
match v.search(key) {
|
||||
x if x.is_some() => return x,
|
||||
_ => ()
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
}
|
||||
},
|
||||
_ => None
|
||||
}
|
||||
}
|
||||
|
||||
/// If the Json value is an Object, performs a depth-first search until
|
||||
/// a value associated with the provided key is found. If no value is found
|
||||
/// or the Json value is not an Object, returns None.
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
pub fn search<'a>(&'a self, key: &str) -> Option<&'a Json> {
|
||||
match self {
|
||||
&Object(ref map) => {
|
||||
|
@ -165,29 +165,6 @@ impl<K, V> RawBucket<K, V> {
|
||||
}
|
||||
}
|
||||
|
||||
// For parameterizing over mutability.
|
||||
|
||||
#[cfg(stage0)]
|
||||
impl<'t, K, V> Deref<RawTable<K, V>> for &'t RawTable<K, V> {
|
||||
fn deref(&self) -> &RawTable<K, V> {
|
||||
&**self
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(stage0)]
|
||||
impl<'t, K, V> Deref<RawTable<K, V>> for &'t mut RawTable<K, V> {
|
||||
fn deref(&self) -> &RawTable<K,V> {
|
||||
&**self
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(stage0)]
|
||||
impl<'t, K, V> DerefMut<RawTable<K, V>> for &'t mut RawTable<K, V> {
|
||||
fn deref_mut(&mut self) -> &mut RawTable<K,V> {
|
||||
&mut **self
|
||||
}
|
||||
}
|
||||
|
||||
// Buckets hold references to the table.
|
||||
impl<K, V, M> FullBucket<K, V, M> {
|
||||
/// Borrow a reference to the table.
|
||||
|
@ -97,12 +97,6 @@ pub struct RcStr {
|
||||
impl Eq for RcStr {}
|
||||
|
||||
impl Ord for RcStr {
|
||||
// NOTE(stage0): remove method after a snapshot
|
||||
#[cfg(stage0)]
|
||||
fn cmp(&self, other: &RcStr) -> Ordering {
|
||||
self.as_slice().cmp(&other.as_slice())
|
||||
}
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
fn cmp(&self, other: &RcStr) -> Ordering {
|
||||
self.as_slice().cmp(other.as_slice())
|
||||
}
|
||||
|
@ -973,56 +973,6 @@ fn get_concurrency() -> uint {
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE(stage0): remove function after a snapshot
|
||||
#[cfg(stage0)]
|
||||
pub fn filter_tests(opts: &TestOpts, tests: Vec<TestDescAndFn>) -> Vec<TestDescAndFn> {
|
||||
let mut filtered = tests;
|
||||
|
||||
// Remove tests that don't match the test filter
|
||||
filtered = match opts.filter {
|
||||
None => filtered,
|
||||
Some(ref re) => {
|
||||
filtered.into_iter()
|
||||
.filter(|test| re.is_match(test.desc.name.as_slice())).collect()
|
||||
}
|
||||
};
|
||||
|
||||
// Maybe pull out the ignored test and unignore them
|
||||
filtered = if !opts.run_ignored {
|
||||
filtered
|
||||
} else {
|
||||
fn filter(test: TestDescAndFn) -> Option<TestDescAndFn> {
|
||||
if test.desc.ignore {
|
||||
let TestDescAndFn {desc, testfn} = test;
|
||||
Some(TestDescAndFn {
|
||||
desc: TestDesc {ignore: false, ..desc},
|
||||
testfn: testfn
|
||||
})
|
||||
} else {
|
||||
None
|
||||
}
|
||||
};
|
||||
filtered.into_iter().filter_map(|x| filter(x)).collect()
|
||||
};
|
||||
|
||||
// Sort the tests alphabetically
|
||||
filtered.sort_by(|t1, t2| t1.desc.name.as_slice().cmp(&t2.desc.name.as_slice()));
|
||||
|
||||
// Shard the remaining tests, if sharding requested.
|
||||
match opts.test_shard {
|
||||
None => filtered,
|
||||
Some((a,b)) => {
|
||||
filtered.into_iter().enumerate()
|
||||
// note: using a - 1 so that the valid shards, for example, are
|
||||
// 1.2 and 2.2 instead of 0.2 and 1.2
|
||||
.filter(|&(i,_)| i % b == (a - 1))
|
||||
.map(|(_,t)| t)
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
|
||||
pub fn filter_tests(opts: &TestOpts, tests: Vec<TestDescAndFn>) -> Vec<TestDescAndFn> {
|
||||
let mut filtered = tests;
|
||||
|
||||
|
@ -1,3 +1,12 @@
|
||||
S 2014-11-10 f89e975
|
||||
freebsd-x86_64 52702569e3c3361d6fd96968443791e76bed18e3
|
||||
linux-i386 3f8bb33f86800affca3cb7245925c19b28a94498
|
||||
linux-x86_64 e0e13a4312bea0bcc7db35b46bcce957178b18a4
|
||||
macos-i386 22f084aaecb773e8348c64fb9ac6d5eba363eb56
|
||||
macos-x86_64 c8554badab19cee96fbf51c2b98ee1bba87caa5c
|
||||
winnt-i386 936bd7a60bce83208d34f2369a0178937e140fba
|
||||
winnt-x86_64 09ba12dc41b7305d3f15ca27ec8d0a5a2a64b204
|
||||
|
||||
S 2014-11-04 1b2ad78
|
||||
freebsd-x86_64 f8c41a522d6a3c9691a0865dab170dcb988e9141
|
||||
linux-i386 d827fbbd778b854923971873cf03bdb79c2e8575
|
||||
|
Loading…
Reference in New Issue
Block a user