rollup merge of #19972: alexcrichton/snapshots

Conflicts:
	src/libcollections/string.rs
	src/libcollections/vec.rs
	src/snapshots.txt
This commit is contained in:
Alex Crichton 2014-12-21 00:07:29 -08:00
commit dbeef0edb2
11 changed files with 0 additions and 833 deletions

View File

@ -448,30 +448,6 @@ impl<T: Ord> Default for BTreeSet<T> {
}
#[unstable = "matches collection reform specification, waiting for dust to settle"]
// NOTE(stage0): Remove impl after a snapshot
#[cfg(stage0)]
impl<T: Ord + Clone> Sub<BTreeSet<T>,BTreeSet<T>> for BTreeSet<T> {
/// Returns the difference of `self` and `rhs` as a new `BTreeSet<T>`.
///
/// # Examples
///
/// ```
/// use std::collections::BTreeSet;
///
/// let a: BTreeSet<int> = vec![1,2,3].into_iter().collect();
/// let b: BTreeSet<int> = vec![3,4,5].into_iter().collect();
///
/// let result: BTreeSet<int> = a - b;
/// let result_vec: Vec<int> = result.into_iter().collect();
/// assert_eq!(result_vec, vec![1,2]);
/// ```
fn sub(&self, rhs: &BTreeSet<T>) -> BTreeSet<T> {
self.difference(rhs).cloned().collect()
}
}
#[unstable = "matches collection reform specification, waiting for dust to settle"]
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
impl<'a, 'b, T: Ord + Clone> Sub<&'b BTreeSet<T>, BTreeSet<T>> for &'a BTreeSet<T> {
/// Returns the difference of `self` and `rhs` as a new `BTreeSet<T>`.
///
@ -493,30 +469,6 @@ impl<'a, 'b, T: Ord + Clone> Sub<&'b BTreeSet<T>, BTreeSet<T>> for &'a BTreeSet<
}
#[unstable = "matches collection reform specification, waiting for dust to settle"]
// NOTE(stage0): Remove impl after a snapshot
#[cfg(stage0)]
impl<T: Ord + Clone> BitXor<BTreeSet<T>,BTreeSet<T>> for BTreeSet<T> {
/// Returns the symmetric difference of `self` and `rhs` as a new `BTreeSet<T>`.
///
/// # Examples
///
/// ```
/// use std::collections::BTreeSet;
///
/// let a: BTreeSet<int> = vec![1,2,3].into_iter().collect();
/// let b: BTreeSet<int> = vec![2,3,4].into_iter().collect();
///
/// let result: BTreeSet<int> = a ^ b;
/// let result_vec: Vec<int> = result.into_iter().collect();
/// assert_eq!(result_vec, vec![1,4]);
/// ```
fn bitxor(&self, rhs: &BTreeSet<T>) -> BTreeSet<T> {
self.symmetric_difference(rhs).cloned().collect()
}
}
#[unstable = "matches collection reform specification, waiting for dust to settle"]
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
impl<'a, 'b, T: Ord + Clone> BitXor<&'b BTreeSet<T>, BTreeSet<T>> for &'a BTreeSet<T> {
/// Returns the symmetric difference of `self` and `rhs` as a new `BTreeSet<T>`.
///
@ -538,30 +490,6 @@ impl<'a, 'b, T: Ord + Clone> BitXor<&'b BTreeSet<T>, BTreeSet<T>> for &'a BTreeS
}
#[unstable = "matches collection reform specification, waiting for dust to settle"]
// NOTE(stage0): Remove impl after a snapshot
#[cfg(stage0)]
impl<T: Ord + Clone> BitAnd<BTreeSet<T>,BTreeSet<T>> for BTreeSet<T> {
/// Returns the intersection of `self` and `rhs` as a new `BTreeSet<T>`.
///
/// # Examples
///
/// ```
/// use std::collections::BTreeSet;
///
/// let a: BTreeSet<int> = vec![1,2,3].into_iter().collect();
/// let b: BTreeSet<int> = vec![2,3,4].into_iter().collect();
///
/// let result: BTreeSet<int> = a & b;
/// let result_vec: Vec<int> = result.into_iter().collect();
/// assert_eq!(result_vec, vec![2,3]);
/// ```
fn bitand(&self, rhs: &BTreeSet<T>) -> BTreeSet<T> {
self.intersection(rhs).cloned().collect()
}
}
#[unstable = "matches collection reform specification, waiting for dust to settle"]
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
impl<'a, 'b, T: Ord + Clone> BitAnd<&'b BTreeSet<T>, BTreeSet<T>> for &'a BTreeSet<T> {
/// Returns the intersection of `self` and `rhs` as a new `BTreeSet<T>`.
///
@ -583,30 +511,6 @@ impl<'a, 'b, T: Ord + Clone> BitAnd<&'b BTreeSet<T>, BTreeSet<T>> for &'a BTreeS
}
#[unstable = "matches collection reform specification, waiting for dust to settle"]
// NOTE(stage0): Remove impl after a snapshot
#[cfg(stage0)]
impl<T: Ord + Clone> BitOr<BTreeSet<T>,BTreeSet<T>> for BTreeSet<T> {
/// Returns the union of `self` and `rhs` as a new `BTreeSet<T>`.
///
/// # Examples
///
/// ```
/// use std::collections::BTreeSet;
///
/// let a: BTreeSet<int> = vec![1,2,3].into_iter().collect();
/// let b: BTreeSet<int> = vec![3,4,5].into_iter().collect();
///
/// let result: BTreeSet<int> = a | b;
/// let result_vec: Vec<int> = result.into_iter().collect();
/// assert_eq!(result_vec, vec![1,2,3,4,5]);
/// ```
fn bitor(&self, rhs: &BTreeSet<T>) -> BTreeSet<T> {
self.union(rhs).cloned().collect()
}
}
#[unstable = "matches collection reform specification, waiting for dust to settle"]
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
impl<'a, 'b, T: Ord + Clone> BitOr<&'b BTreeSet<T>, BTreeSet<T>> for &'a BTreeSet<T> {
/// Returns the union of `self` and `rhs` as a new `BTreeSet<T>`.
///

View File

@ -183,60 +183,24 @@ impl<E:CLike> EnumSet<E> {
}
}
// NOTE(stage0): Remove impl after a snapshot
#[cfg(stage0)]
impl<E:CLike> Sub<EnumSet<E>, EnumSet<E>> for EnumSet<E> {
fn sub(&self, e: &EnumSet<E>) -> EnumSet<E> {
EnumSet {bits: self.bits & !e.bits}
}
}
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
impl<E:CLike> Sub<EnumSet<E>, EnumSet<E>> for EnumSet<E> {
fn sub(self, e: EnumSet<E>) -> EnumSet<E> {
EnumSet {bits: self.bits & !e.bits}
}
}
// NOTE(stage0): Remove impl after a snapshot
#[cfg(stage0)]
impl<E:CLike> BitOr<EnumSet<E>, EnumSet<E>> for EnumSet<E> {
fn bitor(&self, e: &EnumSet<E>) -> EnumSet<E> {
EnumSet {bits: self.bits | e.bits}
}
}
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
impl<E:CLike> BitOr<EnumSet<E>, EnumSet<E>> for EnumSet<E> {
fn bitor(self, e: EnumSet<E>) -> EnumSet<E> {
EnumSet {bits: self.bits | e.bits}
}
}
// NOTE(stage0): Remove impl after a snapshot
#[cfg(stage0)]
impl<E:CLike> BitAnd<EnumSet<E>, EnumSet<E>> for EnumSet<E> {
fn bitand(&self, e: &EnumSet<E>) -> EnumSet<E> {
EnumSet {bits: self.bits & e.bits}
}
}
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
impl<E:CLike> BitAnd<EnumSet<E>, EnumSet<E>> for EnumSet<E> {
fn bitand(self, e: EnumSet<E>) -> EnumSet<E> {
EnumSet {bits: self.bits & e.bits}
}
}
// NOTE(stage0): Remove impl after a snapshot
#[cfg(stage0)]
impl<E:CLike> BitXor<EnumSet<E>, EnumSet<E>> for EnumSet<E> {
fn bitxor(&self, e: &EnumSet<E>) -> EnumSet<E> {
EnumSet {bits: self.bits ^ e.bits}
}
}
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
impl<E:CLike> BitXor<EnumSet<E>, EnumSet<E>> for EnumSet<E> {
fn bitxor(self, e: EnumSet<E>) -> EnumSet<E> {
EnumSet {bits: self.bits ^ e.bits}

View File

@ -862,28 +862,7 @@ impl<'a, S: Str> Equiv<S> for String {
}
}
// NOTE(stage0): Remove impl after a snapshot
#[cfg(stage0)]
#[experimental = "waiting on Add stabilization"]
impl<S: Str> Add<S, String> for String {
/// Concatenates `self` and `other` as a new mutable `String`.
///
/// # Examples
///
/// ```
/// let string1 = "foo".to_string();
/// let string2 = "bar".to_string();
/// let string3 = string1 + string2;
/// assert_eq!(string3, "foobar".to_string());
/// ```
fn add(&self, other: &S) -> String {
let mut s = String::from_str(self.as_slice());
s.push_str(other.as_slice());
return s;
}
}
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
impl<'a> Add<&'a str, String> for String {
fn add(mut self, other: &str) -> String {
self.push_str(other);

View File

@ -1361,20 +1361,6 @@ impl<T> AsSlice<T> for Vec<T> {
}
}
// NOTE(stage0): Remove impl after a snapshot
#[cfg(stage0)]
impl<T: Clone, Sized? V: AsSlice<T>> Add<V, Vec<T>> for Vec<T> {
#[inline]
fn add(&self, rhs: &V) -> Vec<T> {
let mut res = Vec::with_capacity(self.len() + rhs.as_slice().len());
res.push_all(self.as_slice());
res.push_all(rhs.as_slice());
res
}
}
#[cfg(not(stage0))] // NOTE(stage0): Remove impl after a snapshot
impl<'a, T: Clone> Add<&'a [T], Vec<T>> for Vec<T> {
#[inline]
fn add(mut self, rhs: &[T]) -> Vec<T> {

View File

@ -92,46 +92,6 @@ pub trait Drop {
/// struct Foo;
///
/// impl Add<Foo, Foo> for Foo {
/// fn add(&self, _rhs: &Foo) -> Foo {
/// println!("Adding!");
/// *self
/// }
/// }
///
/// fn main() {
/// Foo + Foo;
/// }
/// ```
// NOTE(stage0): Remove trait after a snapshot
#[cfg(stage0)]
#[lang="add"]
pub trait Add<Sized? RHS,Result> for Sized? {
/// The method for the `+` operator
fn add(&self, rhs: &RHS) -> Result;
}
// NOTE(stage0): Remove macro after a snapshot
#[cfg(stage0)]
macro_rules! add_impl {
($($t:ty)*) => ($(
impl Add<$t, $t> for $t {
#[inline]
fn add(&self, other: &$t) -> $t { (*self) + (*other) }
}
)*)
}
/// The `Add` trait is used to specify the functionality of `+`.
///
/// # Example
///
/// A trivial implementation of `Add`. When `Foo + Foo` happens, it ends up
/// calling `add`, and therefore, `main` prints `Adding!`.
///
/// ```rust
/// struct Foo;
///
/// impl Add<Foo, Foo> for Foo {
/// fn add(self, _rhs: Foo) -> Foo {
/// println!("Adding!");
/// self
@ -142,14 +102,12 @@ macro_rules! add_impl {
/// Foo + Foo;
/// }
/// ```
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
#[lang="add"]
pub trait Add<RHS, Result> {
/// The method for the `+` operator
fn add(self, rhs: RHS) -> Result;
}
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
macro_rules! add_impl {
($($t:ty)*) => ($(
impl Add<$t, $t> for $t {
@ -173,46 +131,6 @@ add_impl! { uint u8 u16 u32 u64 int i8 i16 i32 i64 f32 f64 }
/// struct Foo;
///
/// impl Sub<Foo, Foo> for Foo {
/// fn sub(&self, _rhs: &Foo) -> Foo {
/// println!("Subtracting!");
/// *self
/// }
/// }
///
/// fn main() {
/// Foo - Foo;
/// }
/// ```
// NOTE(stage0): Remove trait after a snapshot
#[cfg(stage0)]
#[lang="sub"]
pub trait Sub<Sized? RHS, Result> for Sized? {
/// The method for the `-` operator
fn sub(&self, rhs: &RHS) -> Result;
}
// NOTE(stage0): Remove macro after a snapshot
#[cfg(stage0)]
macro_rules! sub_impl {
($($t:ty)*) => ($(
impl Sub<$t, $t> for $t {
#[inline]
fn sub(&self, other: &$t) -> $t { (*self) - (*other) }
}
)*)
}
/// The `Sub` trait is used to specify the functionality of `-`.
///
/// # Example
///
/// A trivial implementation of `Sub`. When `Foo - Foo` happens, it ends up
/// calling `sub`, and therefore, `main` prints `Subtracting!`.
///
/// ```rust
/// struct Foo;
///
/// impl Sub<Foo, Foo> for Foo {
/// fn sub(self, _rhs: Foo) -> Foo {
/// println!("Subtracting!");
/// self
@ -223,14 +141,12 @@ macro_rules! sub_impl {
/// Foo - Foo;
/// }
/// ```
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
#[lang="sub"]
pub trait Sub<RHS, Result> {
/// The method for the `-` operator
fn sub(self, rhs: RHS) -> Result;
}
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
macro_rules! sub_impl {
($($t:ty)*) => ($(
impl Sub<$t, $t> for $t {
@ -254,46 +170,6 @@ sub_impl! { uint u8 u16 u32 u64 int i8 i16 i32 i64 f32 f64 }
/// struct Foo;
///
/// impl Mul<Foo, Foo> for Foo {
/// fn mul(&self, _rhs: &Foo) -> Foo {
/// println!("Multiplying!");
/// *self
/// }
/// }
///
/// fn main() {
/// Foo * Foo;
/// }
/// ```
// NOTE(stage0): Remove trait after a snapshot
#[cfg(stage0)]
#[lang="mul"]
pub trait Mul<Sized? RHS, Result> for Sized? {
/// The method for the `*` operator
fn mul(&self, rhs: &RHS) -> Result;
}
// NOTE(stage0): Remove macro after a snapshot
#[cfg(stage0)]
macro_rules! mul_impl {
($($t:ty)*) => ($(
impl Mul<$t, $t> for $t {
#[inline]
fn mul(&self, other: &$t) -> $t { (*self) * (*other) }
}
)*)
}
/// The `Mul` trait is used to specify the functionality of `*`.
///
/// # Example
///
/// A trivial implementation of `Mul`. When `Foo * Foo` happens, it ends up
/// calling `mul`, and therefore, `main` prints `Multiplying!`.
///
/// ```rust
/// struct Foo;
///
/// impl Mul<Foo, Foo> for Foo {
/// fn mul(self, _rhs: Foo) -> Foo {
/// println!("Multiplying!");
/// self
@ -304,14 +180,12 @@ macro_rules! mul_impl {
/// Foo * Foo;
/// }
/// ```
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
#[lang="mul"]
pub trait Mul<RHS, Result> {
/// The method for the `*` operator
fn mul(self, rhs: RHS) -> Result;
}
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
macro_rules! mul_impl {
($($t:ty)*) => ($(
impl Mul<$t, $t> for $t {
@ -335,46 +209,6 @@ mul_impl! { uint u8 u16 u32 u64 int i8 i16 i32 i64 f32 f64 }
/// struct Foo;
///
/// impl Div<Foo, Foo> for Foo {
/// fn div(&self, _rhs: &Foo) -> Foo {
/// println!("Dividing!");
/// *self
/// }
/// }
///
/// fn main() {
/// Foo / Foo;
/// }
/// ```
// NOTE(stage0): Remove trait after a snapshot
#[cfg(stage0)]
#[lang="div"]
pub trait Div<Sized? RHS, Result> for Sized? {
/// The method for the `/` operator
fn div(&self, rhs: &RHS) -> Result;
}
// NOTE(stage0): Remove macro after a snapshot
#[cfg(stage0)]
macro_rules! div_impl {
($($t:ty)*) => ($(
impl Div<$t, $t> for $t {
#[inline]
fn div(&self, other: &$t) -> $t { (*self) / (*other) }
}
)*)
}
/// The `Div` trait is used to specify the functionality of `/`.
///
/// # Example
///
/// A trivial implementation of `Div`. When `Foo / Foo` happens, it ends up
/// calling `div`, and therefore, `main` prints `Dividing!`.
///
/// ```
/// struct Foo;
///
/// impl Div<Foo, Foo> for Foo {
/// fn div(self, _rhs: Foo) -> Foo {
/// println!("Dividing!");
/// self
@ -385,14 +219,12 @@ macro_rules! div_impl {
/// Foo / Foo;
/// }
/// ```
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
#[lang="div"]
pub trait Div<RHS, Result> {
/// The method for the `/` operator
fn div(self, rhs: RHS) -> Result;
}
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
macro_rules! div_impl {
($($t:ty)*) => ($(
impl Div<$t, $t> for $t {
@ -416,60 +248,6 @@ div_impl! { uint u8 u16 u32 u64 int i8 i16 i32 i64 f32 f64 }
/// struct Foo;
///
/// impl Rem<Foo, Foo> for Foo {
/// fn rem(&self, _rhs: &Foo) -> Foo {
/// println!("Remainder-ing!");
/// *self
/// }
/// }
///
/// fn main() {
/// Foo % Foo;
/// }
/// ```
// NOTE(stage0): Remove trait after a snapshot
#[cfg(stage0)]
#[lang="rem"]
pub trait Rem<Sized? RHS, Result> for Sized? {
/// The method for the `%` operator
fn rem(&self, rhs: &RHS) -> Result;
}
// NOTE(stage0): Remove macro after a snapshot
#[cfg(stage0)]
macro_rules! rem_impl {
($($t:ty)*) => ($(
impl Rem<$t, $t> for $t {
#[inline]
fn rem(&self, other: &$t) -> $t { (*self) % (*other) }
}
)*)
}
// NOTE(stage0): Remove macro after a snapshot
#[cfg(stage0)]
macro_rules! rem_float_impl {
($t:ty, $fmod:ident) => {
impl Rem<$t, $t> for $t {
#[inline]
fn rem(&self, other: &$t) -> $t {
extern { fn $fmod(a: $t, b: $t) -> $t; }
unsafe { $fmod(*self, *other) }
}
}
}
}
/// The `Rem` trait is used to specify the functionality of `%`.
///
/// # Example
///
/// A trivial implementation of `Rem`. When `Foo % Foo` happens, it ends up
/// calling `rem`, and therefore, `main` prints `Remainder-ing!`.
///
/// ```
/// struct Foo;
///
/// impl Rem<Foo, Foo> for Foo {
/// fn rem(self, _rhs: Foo) -> Foo {
/// println!("Remainder-ing!");
/// self
@ -480,14 +258,12 @@ macro_rules! rem_float_impl {
/// Foo % Foo;
/// }
/// ```
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
#[lang="rem"]
pub trait Rem<RHS, Result> {
/// The method for the `%` operator
fn rem(self, rhs: RHS) -> Result;
}
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
macro_rules! rem_impl {
($($t:ty)*) => ($(
impl Rem<$t, $t> for $t {
@ -497,7 +273,6 @@ macro_rules! rem_impl {
)*)
}
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
macro_rules! rem_float_impl {
($t:ty, $fmod:ident) => {
impl Rem<$t, $t> for $t {
@ -721,46 +496,6 @@ not_impl! { bool uint u8 u16 u32 u64 int i8 i16 i32 i64 }
/// struct Foo;
///
/// impl BitAnd<Foo, Foo> for Foo {
/// fn bitand(&self, _rhs: &Foo) -> Foo {
/// println!("Bitwise And-ing!");
/// *self
/// }
/// }
///
/// fn main() {
/// Foo & Foo;
/// }
/// ```
// NOTE(stage0): Remove trait after a snapshot
#[cfg(stage0)]
#[lang="bitand"]
pub trait BitAnd<Sized? RHS, Result> for Sized? {
/// The method for the `&` operator
fn bitand(&self, rhs: &RHS) -> Result;
}
// NOTE(stage0): Remove macro after a snapshot
#[cfg(stage0)]
macro_rules! bitand_impl {
($($t:ty)*) => ($(
impl BitAnd<$t, $t> for $t {
#[inline]
fn bitand(&self, rhs: &$t) -> $t { (*self) & (*rhs) }
}
)*)
}
/// The `BitAnd` trait is used to specify the functionality of `&`.
///
/// # Example
///
/// A trivial implementation of `BitAnd`. When `Foo & Foo` happens, it ends up
/// calling `bitand`, and therefore, `main` prints `Bitwise And-ing!`.
///
/// ```
/// struct Foo;
///
/// impl BitAnd<Foo, Foo> for Foo {
/// fn bitand(self, _rhs: Foo) -> Foo {
/// println!("Bitwise And-ing!");
/// self
@ -771,14 +506,12 @@ macro_rules! bitand_impl {
/// Foo & Foo;
/// }
/// ```
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
#[lang="bitand"]
pub trait BitAnd<RHS, Result> {
/// The method for the `&` operator
fn bitand(self, rhs: RHS) -> Result;
}
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
macro_rules! bitand_impl {
($($t:ty)*) => ($(
impl BitAnd<$t, $t> for $t {
@ -802,46 +535,6 @@ bitand_impl! { bool uint u8 u16 u32 u64 int i8 i16 i32 i64 }
/// struct Foo;
///
/// impl BitOr<Foo, Foo> for Foo {
/// fn bitor(&self, _rhs: &Foo) -> Foo {
/// println!("Bitwise Or-ing!");
/// *self
/// }
/// }
///
/// fn main() {
/// Foo | Foo;
/// }
/// ```
// NOTE(stage0): Remove trait after a snapshot
#[cfg(stage0)]
#[lang="bitor"]
pub trait BitOr<Sized? RHS, Result> for Sized? {
/// The method for the `|` operator
fn bitor(&self, rhs: &RHS) -> Result;
}
// NOTE(stage0): Remove macro after a snapshot
#[cfg(stage0)]
macro_rules! bitor_impl {
($($t:ty)*) => ($(
impl BitOr<$t,$t> for $t {
#[inline]
fn bitor(&self, rhs: &$t) -> $t { (*self) | (*rhs) }
}
)*)
}
/// The `BitOr` trait is used to specify the functionality of `|`.
///
/// # Example
///
/// A trivial implementation of `BitOr`. When `Foo | Foo` happens, it ends up
/// calling `bitor`, and therefore, `main` prints `Bitwise Or-ing!`.
///
/// ```
/// struct Foo;
///
/// impl BitOr<Foo, Foo> for Foo {
/// fn bitor(self, _rhs: Foo) -> Foo {
/// println!("Bitwise Or-ing!");
/// self
@ -852,14 +545,12 @@ macro_rules! bitor_impl {
/// Foo | Foo;
/// }
/// ```
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
#[lang="bitor"]
pub trait BitOr<RHS, Result> {
/// The method for the `|` operator
fn bitor(self, rhs: RHS) -> Result;
}
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
macro_rules! bitor_impl {
($($t:ty)*) => ($(
impl BitOr<$t,$t> for $t {
@ -883,46 +574,6 @@ bitor_impl! { bool uint u8 u16 u32 u64 int i8 i16 i32 i64 }
/// struct Foo;
///
/// impl BitXor<Foo, Foo> for Foo {
/// fn bitxor(&self, _rhs: &Foo) -> Foo {
/// println!("Bitwise Xor-ing!");
/// *self
/// }
/// }
///
/// fn main() {
/// Foo ^ Foo;
/// }
/// ```
// NOTE(stage0): Remove trait after a snapshot
#[cfg(stage0)]
#[lang="bitxor"]
pub trait BitXor<Sized? RHS, Result> for Sized? {
/// The method for the `^` operator
fn bitxor(&self, rhs: &RHS) -> Result;
}
// NOTE(stage0): Remove macro after a snapshot
#[cfg(stage0)]
macro_rules! bitxor_impl {
($($t:ty)*) => ($(
impl BitXor<$t, $t> for $t {
#[inline]
fn bitxor(&self, other: &$t) -> $t { (*self) ^ (*other) }
}
)*)
}
/// The `BitXor` trait is used to specify the functionality of `^`.
///
/// # Example
///
/// A trivial implementation of `BitXor`. When `Foo ^ Foo` happens, it ends up
/// calling `bitxor`, and therefore, `main` prints `Bitwise Xor-ing!`.
///
/// ```
/// struct Foo;
///
/// impl BitXor<Foo, Foo> for Foo {
/// fn bitxor(self, _rhs: Foo) -> Foo {
/// println!("Bitwise Xor-ing!");
/// self
@ -933,14 +584,12 @@ macro_rules! bitxor_impl {
/// Foo ^ Foo;
/// }
/// ```
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
#[lang="bitxor"]
pub trait BitXor<RHS, Result> {
/// The method for the `^` operator
fn bitxor(self, rhs: RHS) -> Result;
}
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
macro_rules! bitxor_impl {
($($t:ty)*) => ($(
impl BitXor<$t, $t> for $t {
@ -964,48 +613,6 @@ bitxor_impl! { bool uint u8 u16 u32 u64 int i8 i16 i32 i64 }
/// struct Foo;
///
/// impl Shl<Foo, Foo> for Foo {
/// fn shl(&self, _rhs: &Foo) -> Foo {
/// println!("Shifting left!");
/// *self
/// }
/// }
///
/// fn main() {
/// Foo << Foo;
/// }
/// ```
// NOTE(stage0): Remove trait after a snapshot
#[cfg(stage0)]
#[lang="shl"]
pub trait Shl<Sized? RHS, Result> for Sized? {
/// The method for the `<<` operator
fn shl(&self, rhs: &RHS) -> Result;
}
// NOTE(stage0): Remove macro after a snapshot
#[cfg(stage0)]
macro_rules! shl_impl {
($($t:ty)*) => ($(
impl Shl<uint, $t> for $t {
#[inline]
fn shl(&self, other: &uint) -> $t {
(*self) << (*other)
}
}
)*)
}
/// The `Shl` trait is used to specify the functionality of `<<`.
///
/// # Example
///
/// A trivial implementation of `Shl`. When `Foo << Foo` happens, it ends up
/// calling `shl`, and therefore, `main` prints `Shifting left!`.
///
/// ```
/// struct Foo;
///
/// impl Shl<Foo, Foo> for Foo {
/// fn shl(self, _rhs: Foo) -> Foo {
/// println!("Shifting left!");
/// self
@ -1016,14 +623,12 @@ macro_rules! shl_impl {
/// Foo << Foo;
/// }
/// ```
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
#[lang="shl"]
pub trait Shl<RHS, Result> {
/// The method for the `<<` operator
fn shl(self, rhs: RHS) -> Result;
}
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
macro_rules! shl_impl {
($($t:ty)*) => ($(
impl Shl<uint, $t> for $t {
@ -1049,46 +654,6 @@ shl_impl! { uint u8 u16 u32 u64 int i8 i16 i32 i64 }
/// struct Foo;
///
/// impl Shr<Foo, Foo> for Foo {
/// fn shr(&self, _rhs: &Foo) -> Foo {
/// println!("Shifting right!");
/// *self
/// }
/// }
///
/// fn main() {
/// Foo >> Foo;
/// }
/// ```
// NOTE(stage0): Remove trait after a snapshot
#[cfg(stage0)]
#[lang="shr"]
pub trait Shr<Sized? RHS, Result> for Sized? {
/// The method for the `>>` operator
fn shr(&self, rhs: &RHS) -> Result;
}
// NOTE(stage0): Remove macro after a snapshot
#[cfg(stage0)]
macro_rules! shr_impl {
($($t:ty)*) => ($(
impl Shr<uint, $t> for $t {
#[inline]
fn shr(&self, other: &uint) -> $t { (*self) >> (*other) }
}
)*)
}
/// The `Shr` trait is used to specify the functionality of `>>`.
///
/// # Example
///
/// A trivial implementation of `Shr`. When `Foo >> Foo` happens, it ends up
/// calling `shr`, and therefore, `main` prints `Shifting right!`.
///
/// ```
/// struct Foo;
///
/// impl Shr<Foo, Foo> for Foo {
/// fn shr(self, _rhs: Foo) -> Foo {
/// println!("Shifting right!");
/// self
@ -1099,14 +664,12 @@ macro_rules! shr_impl {
/// Foo >> Foo;
/// }
/// ```
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
#[lang="shr"]
pub trait Shr<RHS, Result> {
/// The method for the `>>` operator
fn shr(self, rhs: RHS) -> Result;
}
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
macro_rules! shr_impl {
($($t:ty)*) => ($(
impl Shr<uint, $t> for $t {

View File

@ -2852,45 +2852,18 @@ impl TypeContents {
}
}
// NOTE(stage0): Remove impl after a snapshot
#[cfg(stage0)]
impl ops::BitOr<TypeContents,TypeContents> for TypeContents {
fn bitor(&self, other: &TypeContents) -> TypeContents {
TypeContents {bits: self.bits | other.bits}
}
}
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
impl ops::BitOr<TypeContents,TypeContents> for TypeContents {
fn bitor(self, other: TypeContents) -> TypeContents {
TypeContents {bits: self.bits | other.bits}
}
}
// NOTE(stage0): Remove impl after a snapshot
#[cfg(stage0)]
impl ops::BitAnd<TypeContents,TypeContents> for TypeContents {
fn bitand(&self, other: &TypeContents) -> TypeContents {
TypeContents {bits: self.bits & other.bits}
}
}
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
impl ops::BitAnd<TypeContents, TypeContents> for TypeContents {
fn bitand(self, other: TypeContents) -> TypeContents {
TypeContents {bits: self.bits & other.bits}
}
}
// NOTE(stage0): Remove impl after a snapshot
#[cfg(stage0)]
impl ops::Sub<TypeContents,TypeContents> for TypeContents {
fn sub(&self, other: &TypeContents) -> TypeContents {
TypeContents {bits: self.bits & !other.bits}
}
}
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
impl ops::Sub<TypeContents, TypeContents> for TypeContents {
fn sub(self, other: TypeContents) -> TypeContents {
TypeContents {bits: self.bits & !other.bits}

View File

@ -205,17 +205,6 @@ macro_rules! bitflags {
}
}
// NOTE(stage0): Remove impl after a snapshot
#[cfg(stage0)]
impl BitOr<$BitFlags, $BitFlags> for $BitFlags {
/// Returns the union of the two sets of flags.
#[inline]
fn bitor(&self, other: &$BitFlags) -> $BitFlags {
$BitFlags { bits: self.bits | other.bits }
}
}
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
impl BitOr<$BitFlags, $BitFlags> for $BitFlags {
/// Returns the union of the two sets of flags.
#[inline]
@ -224,17 +213,6 @@ macro_rules! bitflags {
}
}
// NOTE(stage0): Remove impl after a snapshot
#[cfg(stage0)]
impl BitXor<$BitFlags, $BitFlags> for $BitFlags {
/// Returns the left flags, but with all the right flags toggled.
#[inline]
fn bitxor(&self, other: &$BitFlags) -> $BitFlags {
$BitFlags { bits: self.bits ^ other.bits }
}
}
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
impl BitXor<$BitFlags, $BitFlags> for $BitFlags {
/// Returns the left flags, but with all the right flags toggled.
#[inline]
@ -243,17 +221,6 @@ macro_rules! bitflags {
}
}
// NOTE(stage0): Remove impl after a snapshot
#[cfg(stage0)]
impl BitAnd<$BitFlags, $BitFlags> for $BitFlags {
/// Returns the intersection between the two sets of flags.
#[inline]
fn bitand(&self, other: &$BitFlags) -> $BitFlags {
$BitFlags { bits: self.bits & other.bits }
}
}
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
impl BitAnd<$BitFlags, $BitFlags> for $BitFlags {
/// Returns the intersection between the two sets of flags.
#[inline]
@ -262,17 +229,6 @@ macro_rules! bitflags {
}
}
// NOTE(stage0): Remove impl after a snapshot
#[cfg(stage0)]
impl Sub<$BitFlags, $BitFlags> for $BitFlags {
/// Returns the set difference of the two sets of flags.
#[inline]
fn sub(&self, other: &$BitFlags) -> $BitFlags {
$BitFlags { bits: self.bits & !other.bits }
}
}
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
impl Sub<$BitFlags, $BitFlags> for $BitFlags {
/// Returns the set difference of the two sets of flags.
#[inline]

View File

@ -287,21 +287,6 @@ impl Neg<Duration> for Duration {
}
}
// NOTE(stage0): Remove impl after a snapshot
#[cfg(stage0)]
impl Add<Duration,Duration> for Duration {
fn add(&self, rhs: &Duration) -> Duration {
let mut secs = self.secs + rhs.secs;
let mut nanos = self.nanos + rhs.nanos;
if nanos >= NANOS_PER_SEC {
nanos -= NANOS_PER_SEC;
secs += 1;
}
Duration { secs: secs, nanos: nanos }
}
}
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
impl Add<Duration, Duration> for Duration {
fn add(self, rhs: Duration) -> Duration {
let mut secs = self.secs + rhs.secs;
@ -314,21 +299,6 @@ impl Add<Duration, Duration> for Duration {
}
}
// NOTE(stage0): Remove impl after a snapshot
#[cfg(stage0)]
impl Sub<Duration,Duration> for Duration {
fn sub(&self, rhs: &Duration) -> Duration {
let mut secs = self.secs - rhs.secs;
let mut nanos = self.nanos - rhs.nanos;
if nanos < 0 {
nanos += NANOS_PER_SEC;
secs -= 1;
}
Duration { secs: secs, nanos: nanos }
}
}
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
impl Sub<Duration, Duration> for Duration {
fn sub(self, rhs: Duration) -> Duration {
let mut secs = self.secs - rhs.secs;
@ -341,19 +311,6 @@ impl Sub<Duration, Duration> for Duration {
}
}
// NOTE(stage0): Remove impl after a snapshot
#[cfg(stage0)]
impl Mul<i32,Duration> for Duration {
fn mul(&self, rhs: &i32) -> Duration {
// Multiply nanoseconds as i64, because it cannot overflow that way.
let total_nanos = self.nanos as i64 * *rhs as i64;
let (extra_secs, nanos) = div_mod_floor_64(total_nanos, NANOS_PER_SEC as i64);
let secs = self.secs * *rhs as i64 + extra_secs;
Duration { secs: secs, nanos: nanos as i32 }
}
}
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
impl Mul<i32, Duration> for Duration {
fn mul(self, rhs: i32) -> Duration {
// Multiply nanoseconds as i64, because it cannot overflow that way.
@ -364,27 +321,6 @@ impl Mul<i32, Duration> for Duration {
}
}
// NOTE(stage0): Remove impl after a snapshot
#[cfg(stage0)]
impl Div<i32,Duration> for Duration {
fn div(&self, rhs: &i32) -> Duration {
let mut secs = self.secs / *rhs as i64;
let carry = self.secs - secs * *rhs as i64;
let extra_nanos = carry * NANOS_PER_SEC as i64 / *rhs as i64;
let mut nanos = self.nanos / *rhs + extra_nanos as i32;
if nanos >= NANOS_PER_SEC {
nanos -= NANOS_PER_SEC;
secs += 1;
}
if nanos < 0 {
nanos += NANOS_PER_SEC;
secs -= 1;
}
Duration { secs: secs, nanos: nanos }
}
}
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
impl Div<i32, Duration> for Duration {
fn div(self, rhs: i32) -> Duration {
let mut secs = self.secs / rhs as i64;

View File

@ -48,30 +48,12 @@ impl Pos for BytePos {
fn to_uint(&self) -> uint { let BytePos(n) = *self; n as uint }
}
// NOTE(stage0): Remove impl after a snapshot
#[cfg(stage0)]
impl Add<BytePos, BytePos> for BytePos {
fn add(&self, rhs: &BytePos) -> BytePos {
BytePos((self.to_uint() + rhs.to_uint()) as u32)
}
}
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
impl Add<BytePos, BytePos> for BytePos {
fn add(self, rhs: BytePos) -> BytePos {
BytePos((self.to_uint() + rhs.to_uint()) as u32)
}
}
// NOTE(stage0): Remove impl after a snapshot
#[cfg(stage0)]
impl Sub<BytePos, BytePos> for BytePos {
fn sub(&self, rhs: &BytePos) -> BytePos {
BytePos((self.to_uint() - rhs.to_uint()) as u32)
}
}
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
impl Sub<BytePos, BytePos> for BytePos {
fn sub(self, rhs: BytePos) -> BytePos {
BytePos((self.to_uint() - rhs.to_uint()) as u32)
@ -83,30 +65,12 @@ impl Pos for CharPos {
fn to_uint(&self) -> uint { let CharPos(n) = *self; n }
}
// NOTE(stage0): Remove impl after a snapshot
#[cfg(stage0)]
impl Add<CharPos,CharPos> for CharPos {
fn add(&self, rhs: &CharPos) -> CharPos {
CharPos(self.to_uint() + rhs.to_uint())
}
}
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
impl Add<CharPos, CharPos> for CharPos {
fn add(self, rhs: CharPos) -> CharPos {
CharPos(self.to_uint() + rhs.to_uint())
}
}
// NOTE(stage0): Remove impl after a snapshot
#[cfg(stage0)]
impl Sub<CharPos,CharPos> for CharPos {
fn sub(&self, rhs: &CharPos) -> CharPos {
CharPos(self.to_uint() - rhs.to_uint())
}
}
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
impl Sub<CharPos, CharPos> for CharPos {
fn sub(self, rhs: CharPos) -> CharPos {
CharPos(self.to_uint() - rhs.to_uint())

View File

@ -106,30 +106,6 @@ enum LockstepIterSize {
LisContradiction(String),
}
// NOTE(stage0): Remove impl after a snapshot
#[cfg(stage0)]
impl Add<LockstepIterSize, LockstepIterSize> for LockstepIterSize {
fn add(&self, other: &LockstepIterSize) -> LockstepIterSize {
match *self {
LisUnconstrained => other.clone(),
LisContradiction(_) => self.clone(),
LisConstraint(l_len, l_id) => match *other {
LisUnconstrained => self.clone(),
LisContradiction(_) => other.clone(),
LisConstraint(r_len, _) if l_len == r_len => self.clone(),
LisConstraint(r_len, r_id) => {
let l_n = token::get_ident(l_id);
let r_n = token::get_ident(r_id);
LisContradiction(format!("inconsistent lockstep iteration: \
'{}' has {} items, but '{}' has {}",
l_n, l_len, r_n, r_len).to_string())
}
},
}
}
}
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
impl Add<LockstepIterSize, LockstepIterSize> for LockstepIterSize {
fn add(self, other: LockstepIterSize) -> LockstepIterSize {
match self {

View File

@ -97,29 +97,6 @@ impl Timespec {
}
}
// NOTE(stage0): Remove impl after a snapshot
#[cfg(stage0)]
impl Add<Duration, Timespec> for Timespec {
fn add(&self, other: &Duration) -> Timespec {
let d_sec = other.num_seconds();
// It is safe to unwrap the nanoseconds, because there cannot be
// more than one second left, which fits in i64 and in i32.
let d_nsec = (*other - Duration::seconds(d_sec))
.num_nanoseconds().unwrap() as i32;
let mut sec = self.sec + d_sec;
let mut nsec = self.nsec + d_nsec;
if nsec >= NSEC_PER_SEC {
nsec -= NSEC_PER_SEC;
sec += 1;
} else if nsec < 0 {
nsec += NSEC_PER_SEC;
sec -= 1;
}
Timespec::new(sec, nsec)
}
}
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
impl Add<Duration, Timespec> for Timespec {
fn add(self, other: Duration) -> Timespec {
let d_sec = other.num_seconds();
@ -140,17 +117,6 @@ impl Add<Duration, Timespec> for Timespec {
}
}
// NOTE(stage0): Remove impl after a snapshot
#[cfg(stage0)]
impl Sub<Timespec, Duration> for Timespec {
fn sub(&self, other: &Timespec) -> Duration {
let sec = self.sec - other.sec;
let nsec = self.nsec - other.nsec;
Duration::seconds(sec) + Duration::nanoseconds(nsec as i64)
}
}
#[cfg(not(stage0))] // NOTE(stage0): Remove cfg after a snapshot
impl Sub<Timespec, Duration> for Timespec {
fn sub(self, other: Timespec) -> Duration {
let sec = self.sec - other.sec;