Skip to content

Commit

Permalink
desnapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
nikomatsakis committed Apr 30, 2013
1 parent 202b8dc commit b5a7e8b
Show file tree
Hide file tree
Showing 13 changed files with 8 additions and 125 deletions.
3 changes: 0 additions & 3 deletions src/libcore/core.rc
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,6 @@ they contained the following prologue:

pub use kinds::{Const, Copy, Owned, Durable};
pub use ops::{Drop};
#[cfg(stage0)]
pub use ops::{Add, Sub, Mul, Div, Modulo, Neg, Not};
#[cfg(not(stage0))]
pub use ops::{Add, Sub, Mul, Quot, Rem, Neg, Not};
pub use ops::{BitAnd, BitOr, BitXor};
pub use ops::{Shl, Shr, Index};
Expand Down
16 changes: 2 additions & 14 deletions src/libcore/num/f32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,24 +278,12 @@ impl Mul<f32,f32> for f32 {
#[inline(always)]
fn mul(&self, other: &f32) -> f32 { *self * *other }
}

#[cfg(stage0,notest)]
impl Div<f32,f32> for f32 {
#[inline(always)]
fn div(&self, other: &f32) -> f32 { *self / *other }
}
#[cfg(not(stage0),notest)]
#[cfg(notest)]
impl Quot<f32,f32> for f32 {
#[inline(always)]
fn quot(&self, other: &f32) -> f32 { *self / *other }
}

#[cfg(stage0,notest)]
impl Modulo<f32,f32> for f32 {
#[inline(always)]
fn modulo(&self, other: &f32) -> f32 { *self % *other }
}
#[cfg(not(stage0),notest)]
#[cfg(notest)]
impl Rem<f32,f32> for f32 {
#[inline(always)]
fn rem(&self, other: &f32) -> f32 { *self % *other }
Expand Down
12 changes: 2 additions & 10 deletions src/libcore/num/f64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,20 +296,12 @@ impl Sub<f64,f64> for f64 {
impl Mul<f64,f64> for f64 {
fn mul(&self, other: &f64) -> f64 { *self * *other }
}
#[cfg(stage0,notest)]
impl Div<f64,f64> for f64 {
fn div(&self, other: &f64) -> f64 { *self / *other }
}
#[cfg(not(stage0),notest)]
#[cfg(notest)]
impl Quot<f64,f64> for f64 {
#[inline(always)]
fn quot(&self, other: &f64) -> f64 { *self / *other }
}
#[cfg(stage0,notest)]
impl Modulo<f64,f64> for f64 {
fn modulo(&self, other: &f64) -> f64 { *self % *other }
}
#[cfg(not(stage0),notest)]
#[cfg(notest)]
impl Rem<f64,f64> for f64 {
#[inline(always)]
fn rem(&self, other: &f64) -> f64 { *self % *other }
Expand Down
15 changes: 2 additions & 13 deletions src/libcore/num/float.rs
Original file line number Diff line number Diff line change
Expand Up @@ -691,23 +691,12 @@ impl Mul<float,float> for float {
#[inline(always)]
fn mul(&self, other: &float) -> float { *self * *other }
}

#[cfg(stage0,notest)]
impl Div<float,float> for float {
#[inline(always)]
fn div(&self, other: &float) -> float { *self / *other }
}
#[cfg(not(stage0),notest)]
#[cfg(notest)]
impl Quot<float,float> for float {
#[inline(always)]
fn quot(&self, other: &float) -> float { *self / *other }
}
#[cfg(stage0,notest)]
impl Modulo<float,float> for float {
#[inline(always)]
fn modulo(&self, other: &float) -> float { *self % *other }
}
#[cfg(not(stage0),notest)]
#[cfg(notest)]
impl Rem<float,float> for float {
#[inline(always)]
fn rem(&self, other: &float) -> float { *self % *other }
Expand Down
14 changes: 0 additions & 14 deletions src/libcore/num/int-template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,13 +200,6 @@ impl Mul<T,T> for T {
#[inline(always)]
fn mul(&self, other: &T) -> T { *self * *other }
}

#[cfg(stage0,notest)]
impl Div<T,T> for T {
#[inline(always)]
fn div(&self, other: &T) -> T { *self / *other }
}
#[cfg(not(stage0),notest)]
impl Quot<T,T> for T {
///
/// Returns the integer quotient, truncated towards 0. As this behaviour reflects
Expand All @@ -229,13 +222,6 @@ impl Quot<T,T> for T {
#[inline(always)]
fn quot(&self, other: &T) -> T { *self / *other }
}

#[cfg(stage0,notest)]
impl Modulo<T,T> for T {
#[inline(always)]
fn modulo(&self, other: &T) -> T { *self % *other }
}
#[cfg(not(stage0),notest)]
impl Rem<T,T> for T {
///
/// Returns the integer remainder after division, satisfying:
Expand Down
28 changes: 2 additions & 26 deletions src/libcore/num/num.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,6 @@

//! An interface for numeric types
use cmp::{Eq, Ord};
#[cfg(stage0)]
use ops::{Add, Sub, Mul, Neg};
#[cfg(stage0)]
use Quot = ops::Div;
#[cfg(stage0)]
use Rem = ops::Modulo;
#[cfg(not(stage0))]
use ops::{Add, Sub, Mul, Quot, Rem, Neg};
use ops::{Not, BitAnd, BitOr, BitXor, Shl, Shr};
use option::Option;
Expand Down Expand Up @@ -391,25 +384,8 @@ pub fn pow_with_uint<T:NumCast+One+Zero+Copy+Quot<T,T>+Mul<T,T>>(
total
}

/// Helper function for testing numeric operations
#[cfg(stage0,test)]
pub fn test_num<T:Num + NumCast>(ten: T, two: T) {
assert_eq!(ten.add(&two), cast(12));
assert_eq!(ten.sub(&two), cast(8));
assert_eq!(ten.mul(&two), cast(20));
assert_eq!(ten.div(&two), cast(5));
assert_eq!(ten.modulo(&two), cast(0));

assert_eq!(ten.add(&two), ten + two);
assert_eq!(ten.sub(&two), ten - two);
assert_eq!(ten.mul(&two), ten * two);
assert_eq!(ten.div(&two), ten / two);
assert_eq!(ten.modulo(&two), ten % two);
}
#[cfg(stage1,test)]
#[cfg(stage2,test)]
#[cfg(stage3,test)]
pub fn test_num<T:Num + NumCast>(ten: T, two: T) {
#[cfg(test)]
fn test_num<T:Num + NumCast>(ten: T, two: T) {
assert_eq!(ten.add(&two), cast(12));
assert_eq!(ten.sub(&two), cast(8));
assert_eq!(ten.mul(&two), cast(20));
Expand Down
9 changes: 0 additions & 9 deletions src/libcore/num/strconv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,6 @@
// except according to those terms.

use core::cmp::{Ord, Eq};
#[cfg(stage0)]
use ops::{Add, Sub, Mul, Neg};
#[cfg(stage0)]
use Quot = ops::Div;
#[cfg(stage0)]
use Rem = ops::Modulo;
#[cfg(stage1)]
#[cfg(stage2)]
#[cfg(stage3)]
use ops::{Add, Sub, Mul, Quot, Rem, Neg};
use option::{None, Option, Some};
use char;
Expand Down
14 changes: 0 additions & 14 deletions src/libcore/num/uint-template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,24 +165,10 @@ impl Mul<T,T> for T {
#[inline(always)]
fn mul(&self, other: &T) -> T { *self * *other }
}

#[cfg(stage0,notest)]
impl Div<T,T> for T {
#[inline(always)]
fn div(&self, other: &T) -> T { *self / *other }
}
#[cfg(not(stage0),notest)]
impl Quot<T,T> for T {
#[inline(always)]
fn quot(&self, other: &T) -> T { *self / *other }
}

#[cfg(stage0,notest)]
impl Modulo<T,T> for T {
#[inline(always)]
fn modulo(&self, other: &T) -> T { *self % *other }
}
#[cfg(not(stage0),notest)]
impl Rem<T,T> for T {
#[inline(always)]
fn rem(&self, other: &T) -> T { *self % *other }
Expand Down
12 changes: 0 additions & 12 deletions src/libcore/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,12 @@ pub trait Mul<RHS,Result> {
fn mul(&self, rhs: &RHS) -> Result;
}

#[lang="div"]
#[cfg(stage0)]
pub trait Div<RHS,Result> {
fn div(&self, rhs: &RHS) -> Result;
}
#[lang="quot"]
#[cfg(not(stage0))]
pub trait Quot<RHS,Result> {
fn quot(&self, rhs: &RHS) -> Result;
}

#[lang="modulo"]
#[cfg(stage0)]
pub trait Modulo<RHS,Result> {
fn modulo(&self, rhs: &RHS) -> Result;
}
#[lang="rem"]
#[cfg(not(stage0))]
pub trait Rem<RHS,Result> {
fn rem(&self, rhs: &RHS) -> Result;
}
Expand Down
3 changes: 0 additions & 3 deletions src/libcore/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@

pub use either::{Either, Left, Right};
pub use kinds::{Const, Copy, Owned, Durable};
#[cfg(stage0)]
pub use ops::{Add, Sub, Mul, Div, Modulo, Neg, Not};
#[cfg(not(stage0))]
pub use ops::{Add, Sub, Mul, Quot, Rem, Neg, Not};
pub use ops::{BitAnd, BitOr, BitXor};
pub use ops::{Drop};
Expand Down
1 change: 0 additions & 1 deletion src/libcore/repr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ use io::{Writer, WriterUtil};
use libc::c_void;
use managed;
use ptr;
#[cfg(stage0)] use sys;
use reflect;
use reflect::{MovePtr, align};
use to_str::ToStr;
Expand Down
3 changes: 0 additions & 3 deletions src/libcore/rt/io/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,18 +125,15 @@ pub mod file;
pub mod net;

/// Readers and Writers for memory buffers and strings.
#[cfg(not(stage0))] // XXX Using unsnapshotted features
pub mod mem;

/// Non-blocking access to stdin, stdout, stderr
pub mod stdio;

/// Basic stream compression. XXX: Belongs with other flate code
#[cfg(not(stage0))] // XXX Using unsnapshotted features
pub mod flate;

/// Interop between byte streams and pipes. Not sure where it belongs
#[cfg(not(stage0))] // XXX "
pub mod comm_adapters;

/// Extension traits
Expand Down
3 changes: 0 additions & 3 deletions src/libstd/std.rc
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,10 @@ pub mod cmp;
pub mod base64;
pub mod rl;
pub mod workcache;
#[cfg(not(stage0))]
#[path="num/bigint.rs"]
pub mod bigint;
#[cfg(not(stage0))]
#[path="num/rational.rs"]
pub mod rational;
#[cfg(not(stage0))]
#[path="num/complex.rs"]
pub mod complex;
pub mod stats;
Expand Down

0 comments on commit b5a7e8b

Please sign in to comment.