diff options
| author | Kiet Tran <ktt3ja@gmail.com> | 2013-12-08 02:55:28 -0500 |
|---|---|---|
| committer | Kiet Tran <ktt3ja@gmail.com> | 2013-12-08 02:55:28 -0500 |
| commit | 1755408d1a58684b6c9bce11aeceb18a1ec2d66e (patch) | |
| tree | 9d781272021fe4ead382ffc8f87c048f194e25b5 /src/libstd | |
| parent | c06dd0e0afb4b78ab4e482a7488adcf1c865bd19 (diff) | |
| download | rust-1755408d1a58684b6c9bce11aeceb18a1ec2d66e.tar.gz rust-1755408d1a58684b6c9bce11aeceb18a1ec2d66e.zip | |
Remove dead codes
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/hash.rs | 101 | ||||
| -rw-r--r-- | src/libstd/io/comm_adapters.rs | 8 | ||||
| -rw-r--r-- | src/libstd/io/native/file.rs | 4 | ||||
| -rw-r--r-- | src/libstd/io/native/mod.rs | 1 | ||||
| -rw-r--r-- | src/libstd/iter.rs | 2 | ||||
| -rw-r--r-- | src/libstd/num/f32.rs | 20 | ||||
| -rw-r--r-- | src/libstd/num/f64.rs | 14 | ||||
| -rw-r--r-- | src/libstd/os.rs | 12 | ||||
| -rw-r--r-- | src/libstd/path/windows.rs | 5 | ||||
| -rw-r--r-- | src/libstd/rand/mod.rs | 1 | ||||
| -rw-r--r-- | src/libstd/rt/basic.rs | 22 | ||||
| -rw-r--r-- | src/libstd/rt/local_heap.rs | 2 | ||||
| -rw-r--r-- | src/libstd/rt/local_ptr.rs | 2 | ||||
| -rw-r--r-- | src/libstd/rt/thread_local_storage.rs | 2 | ||||
| -rw-r--r-- | src/libstd/run.rs | 5 | ||||
| -rw-r--r-- | src/libstd/unicode.rs | 1 | ||||
| -rw-r--r-- | src/libstd/unstable/sync.rs | 1 |
17 files changed, 38 insertions, 165 deletions
diff --git a/src/libstd/hash.rs b/src/libstd/hash.rs index 5a671eea7a3..fd439eb05e2 100644 --- a/src/libstd/hash.rs +++ b/src/libstd/hash.rs @@ -91,107 +91,6 @@ impl<A:IterBytes> Hash for A { } } -fn hash_keyed_2<A: IterBytes, - B: IterBytes>(a: &A, b: &B, k0: u64, k1: u64) -> u64 { - let mut s = State::new(k0, k1); - a.iter_bytes(true, |bytes| { - s.input(bytes); - true - }); - b.iter_bytes(true, |bytes| { - s.input(bytes); - true - }); - s.result_u64() -} - -fn hash_keyed_3<A: IterBytes, - B: IterBytes, - C: IterBytes>(a: &A, b: &B, c: &C, k0: u64, k1: u64) -> u64 { - let mut s = State::new(k0, k1); - a.iter_bytes(true, |bytes| { - s.input(bytes); - true - }); - b.iter_bytes(true, |bytes| { - s.input(bytes); - true - }); - c.iter_bytes(true, |bytes| { - s.input(bytes); - true - }); - s.result_u64() -} - -fn hash_keyed_4<A: IterBytes, - B: IterBytes, - C: IterBytes, - D: IterBytes>( - a: &A, - b: &B, - c: &C, - d: &D, - k0: u64, - k1: u64) - -> u64 { - let mut s = State::new(k0, k1); - a.iter_bytes(true, |bytes| { - s.input(bytes); - true - }); - b.iter_bytes(true, |bytes| { - s.input(bytes); - true - }); - c.iter_bytes(true, |bytes| { - s.input(bytes); - true - }); - d.iter_bytes(true, |bytes| { - s.input(bytes); - true - }); - s.result_u64() -} - -fn hash_keyed_5<A: IterBytes, - B: IterBytes, - C: IterBytes, - D: IterBytes, - E: IterBytes>( - a: &A, - b: &B, - c: &C, - d: &D, - e: &E, - k0: u64, - k1: u64) - -> u64 { - let mut s = State::new(k0, k1); - a.iter_bytes(true, |bytes| { - s.input(bytes); - true - }); - b.iter_bytes(true, |bytes| { - s.input(bytes); - true - }); - c.iter_bytes(true, |bytes| { - s.input(bytes); - true - }); - d.iter_bytes(true, |bytes| { - s.input(bytes); - true - }); - e.iter_bytes(true, |bytes| { - s.input(bytes); - true - }); - s.result_u64() -} - #[inline] pub fn default_state() -> State { State::new(0, 0) diff --git a/src/libstd/io/comm_adapters.rs b/src/libstd/io/comm_adapters.rs index 98dbec27fb9..f9cf847621e 100644 --- a/src/libstd/io/comm_adapters.rs +++ b/src/libstd/io/comm_adapters.rs @@ -12,7 +12,7 @@ use option::Option; use comm::{GenericPort, GenericChan}; use super::{Reader, Writer}; -struct PortReader<P>; +pub struct PortReader<P>; impl<P: GenericPort<~[u8]>> PortReader<P> { pub fn new(_port: P) -> PortReader<P> { fail!() } @@ -24,7 +24,7 @@ impl<P: GenericPort<~[u8]>> Reader for PortReader<P> { fn eof(&mut self) -> bool { fail!() } } -struct ChanWriter<C>; +pub struct ChanWriter<C>; impl<C: GenericChan<~[u8]>> ChanWriter<C> { pub fn new(_chan: C) -> ChanWriter<C> { fail!() } @@ -34,7 +34,7 @@ impl<C: GenericChan<~[u8]>> Writer for ChanWriter<C> { fn write(&mut self, _buf: &[u8]) { fail!() } } -struct ReaderPort<R>; +pub struct ReaderPort<R>; impl<R: Reader> ReaderPort<R> { pub fn new(_reader: R) -> ReaderPort<R> { fail!() } @@ -46,7 +46,7 @@ impl<R: Reader> GenericPort<~[u8]> for ReaderPort<R> { fn try_recv(&self) -> Option<~[u8]> { fail!() } } -struct WriterChan<W>; +pub struct WriterChan<W>; impl<W: Writer> WriterChan<W> { pub fn new(_writer: W) -> WriterChan<W> { fail!() } diff --git a/src/libstd/io/native/file.rs b/src/libstd/io/native/file.rs index 218040b72d6..7b5104657d9 100644 --- a/src/libstd/io/native/file.rs +++ b/src/libstd/io/native/file.rs @@ -756,10 +756,6 @@ pub fn link(src: &CString, dst: &CString) -> IoResult<()> { #[cfg(windows)] fn mkstat(stat: &libc::stat, path: &CString) -> io::FileStat { let path = unsafe { CString::new(path.with_ref(|p| p), false) }; - - // FileStat times are in milliseconds - fn mktime(secs: u64, nsecs: u64) -> u64 { secs * 1000 + nsecs / 1000000 } - let kind = match (stat.st_mode as c_int) & libc::S_IFMT { libc::S_IFREG => io::TypeFile, libc::S_IFDIR => io::TypeDirectory, diff --git a/src/libstd/io/native/mod.rs b/src/libstd/io/native/mod.rs index c92f480728e..00b26116e67 100644 --- a/src/libstd/io/native/mod.rs +++ b/src/libstd/io/native/mod.rs @@ -100,6 +100,7 @@ fn mkerr_libc(ret: libc::c_int) -> IoResult<()> { } // windows has zero values as errors +#[cfg(windows)] fn mkerr_winbool(ret: libc::c_int) -> IoResult<()> { if ret == 0 { Err(last_error()) diff --git a/src/libstd/iter.rs b/src/libstd/iter.rs index 75a7d5db132..8cebc49be7c 100644 --- a/src/libstd/iter.rs +++ b/src/libstd/iter.rs @@ -1690,7 +1690,7 @@ impl<T> Fuse<T> { /// Resets the fuse such that the next call to .next() or .next_back() will /// call the underlying iterator again even if it prevously returned None. #[inline] - fn reset_fuse(&mut self) { + pub fn reset_fuse(&mut self) { self.done = false } } diff --git a/src/libstd/num/f32.rs b/src/libstd/num/f32.rs index 92eb4a80fca..4eef3323403 100644 --- a/src/libstd/num/f32.rs +++ b/src/libstd/num/f32.rs @@ -57,7 +57,7 @@ delegate!( fn log2(n: f32) -> f32 = intrinsics::log2f32, fn mul_add(a: f32, b: f32, c: f32) -> f32 = intrinsics::fmaf32, fn pow(n: f32, e: f32) -> f32 = intrinsics::powf32, - fn powi(n: f32, e: c_int) -> f32 = intrinsics::powif32, + // fn powi(n: f32, e: c_int) -> f32 = intrinsics::powif32, fn sin(n: f32) -> f32 = intrinsics::sinf32, fn sqrt(n: f32) -> f32 = intrinsics::sqrtf32, @@ -79,25 +79,25 @@ delegate!( fn cbrt(n: c_float) -> c_float = c_float_utils::cbrt, fn copysign(x: c_float, y: c_float) -> c_float = c_float_utils::copysign, fn cosh(n: c_float) -> c_float = c_float_utils::cosh, - fn erf(n: c_float) -> c_float = c_float_utils::erf, - fn erfc(n: c_float) -> c_float = c_float_utils::erfc, + // fn erf(n: c_float) -> c_float = c_float_utils::erf, + // fn erfc(n: c_float) -> c_float = c_float_utils::erfc, fn exp_m1(n: c_float) -> c_float = c_float_utils::exp_m1, fn abs_sub(a: c_float, b: c_float) -> c_float = c_float_utils::abs_sub, fn next_after(x: c_float, y: c_float) -> c_float = c_float_utils::next_after, fn frexp(n: c_float, value: &mut c_int) -> c_float = c_float_utils::frexp, fn hypot(x: c_float, y: c_float) -> c_float = c_float_utils::hypot, fn ldexp(x: c_float, n: c_int) -> c_float = c_float_utils::ldexp, - fn lgamma(n: c_float, sign: &mut c_int) -> c_float = c_float_utils::lgamma, - fn log_radix(n: c_float) -> c_float = c_float_utils::log_radix, + // fn lgamma(n: c_float, sign: &mut c_int) -> c_float = c_float_utils::lgamma, + // fn log_radix(n: c_float) -> c_float = c_float_utils::log_radix, fn ln_1p(n: c_float) -> c_float = c_float_utils::ln_1p, - fn ilog_radix(n: c_float) -> c_int = c_float_utils::ilog_radix, - fn modf(n: c_float, iptr: &mut c_float) -> c_float = c_float_utils::modf, + // fn ilog_radix(n: c_float) -> c_int = c_float_utils::ilog_radix, + // fn modf(n: c_float, iptr: &mut c_float) -> c_float = c_float_utils::modf, fn round(n: c_float) -> c_float = c_float_utils::round, - fn ldexp_radix(n: c_float, i: c_int) -> c_float = c_float_utils::ldexp_radix, + // fn ldexp_radix(n: c_float, i: c_int) -> c_float = c_float_utils::ldexp_radix, fn sinh(n: c_float) -> c_float = c_float_utils::sinh, fn tan(n: c_float) -> c_float = c_float_utils::tan, - fn tanh(n: c_float) -> c_float = c_float_utils::tanh, - fn tgamma(n: c_float) -> c_float = c_float_utils::tgamma + fn tanh(n: c_float) -> c_float = c_float_utils::tanh + // fn tgamma(n: c_float) -> c_float = c_float_utils::tgamma ) // These are not defined inside consts:: for consistency with diff --git a/src/libstd/num/f64.rs b/src/libstd/num/f64.rs index 2dfb23283df..1668019409e 100644 --- a/src/libstd/num/f64.rs +++ b/src/libstd/num/f64.rs @@ -59,7 +59,7 @@ delegate!( fn log2(n: f64) -> f64 = intrinsics::log2f64, fn mul_add(a: f64, b: f64, c: f64) -> f64 = intrinsics::fmaf64, fn pow(n: f64, e: f64) -> f64 = intrinsics::powf64, - fn powi(n: f64, e: c_int) -> f64 = intrinsics::powif64, + // fn powi(n: f64, e: c_int) -> f64 = intrinsics::powif64, fn sin(n: f64) -> f64 = intrinsics::sinf64, fn sqrt(n: f64) -> f64 = intrinsics::sqrtf64, @@ -81,8 +81,8 @@ delegate!( fn cbrt(n: c_double) -> c_double = c_double_utils::cbrt, fn copysign(x: c_double, y: c_double) -> c_double = c_double_utils::copysign, fn cosh(n: c_double) -> c_double = c_double_utils::cosh, - fn erf(n: c_double) -> c_double = c_double_utils::erf, - fn erfc(n: c_double) -> c_double = c_double_utils::erfc, + // fn erf(n: c_double) -> c_double = c_double_utils::erf, + // fn erfc(n: c_double) -> c_double = c_double_utils::erfc, fn exp_m1(n: c_double) -> c_double = c_double_utils::exp_m1, fn abs_sub(a: c_double, b: c_double) -> c_double = c_double_utils::abs_sub, fn next_after(x: c_double, y: c_double) -> c_double = c_double_utils::next_after, @@ -90,12 +90,12 @@ delegate!( fn hypot(x: c_double, y: c_double) -> c_double = c_double_utils::hypot, fn ldexp(x: c_double, n: c_int) -> c_double = c_double_utils::ldexp, fn lgamma(n: c_double, sign: &mut c_int) -> c_double = c_double_utils::lgamma, - fn log_radix(n: c_double) -> c_double = c_double_utils::log_radix, + // fn log_radix(n: c_double) -> c_double = c_double_utils::log_radix, fn ln_1p(n: c_double) -> c_double = c_double_utils::ln_1p, - fn ilog_radix(n: c_double) -> c_int = c_double_utils::ilog_radix, - fn modf(n: c_double, iptr: &mut c_double) -> c_double = c_double_utils::modf, + // fn ilog_radix(n: c_double) -> c_int = c_double_utils::ilog_radix, + // fn modf(n: c_double, iptr: &mut c_double) -> c_double = c_double_utils::modf, fn round(n: c_double) -> c_double = c_double_utils::round, - fn ldexp_radix(n: c_double, i: c_int) -> c_double = c_double_utils::ldexp_radix, + // fn ldexp_radix(n: c_double, i: c_int) -> c_double = c_double_utils::ldexp_radix, fn sinh(n: c_double) -> c_double = c_double_utils::sinh, fn tan(n: c_double) -> c_double = c_double_utils::tan, fn tanh(n: c_double) -> c_double = c_double_utils::tanh, diff --git a/src/libstd/os.rs b/src/libstd/os.rs index 34331769614..ff939310865 100644 --- a/src/libstd/os.rs +++ b/src/libstd/os.rs @@ -32,6 +32,7 @@ use c_str::CString; use clone::Clone; use container::Container; +#[cfg(target_os = "macos")] use iter::range; use libc; use libc::{c_char, c_void, c_int, size_t}; @@ -338,12 +339,6 @@ pub fn pipe() -> Pipe { } } -fn dup2(src: c_int, dst: c_int) -> c_int { - unsafe { - libc::dup2(src, dst) - } -} - /// Returns the proper dll filename for the given basename of a file. pub fn dll_filename(base: &str) -> ~str { format!("{}{}{}", DLL_PREFIX, base, DLL_SUFFIX) @@ -708,6 +703,7 @@ pub fn set_exit_status(code: int) { rt::set_exit_status(code); } +#[cfg(target_os = "macos")] unsafe fn load_argc_and_argv(argc: c_int, argv: **c_char) -> ~[~str] { let mut args = ~[]; for i in range(0u, argc as uint) { @@ -787,10 +783,6 @@ extern "system" { fn CommandLineToArgvW(lpCmdLine: LPCWSTR, pNumArgs: *mut c_int) -> **u16; } -struct OverriddenArgs { - val: ~[~str] -} - /// Returns the arguments which this program was started with (normally passed /// via the command line). pub fn args() -> ~[~str] { diff --git a/src/libstd/path/windows.rs b/src/libstd/path/windows.rs index cc2af54fd10..b7a0d685f12 100644 --- a/src/libstd/path/windows.rs +++ b/src/libstd/path/windows.rs @@ -1049,11 +1049,6 @@ fn prefix_len(p: Option<PathPrefix>) -> uint { } } -fn prefix_is_sep(p: Option<PathPrefix>, c: u8) -> bool { - c.is_ascii() && if !prefix_is_verbatim(p) { is_sep(c as char) } - else { is_sep_verbatim(c as char) } -} - #[cfg(test)] mod tests { use super::*; diff --git a/src/libstd/rand/mod.rs b/src/libstd/rand/mod.rs index ae53ef8b7c0..3a33fb182aa 100644 --- a/src/libstd/rand/mod.rs +++ b/src/libstd/rand/mod.rs @@ -886,6 +886,7 @@ mod test { } } +#[cfg(test)] static RAND_BENCH_N: u64 = 100; #[cfg(test)] diff --git a/src/libstd/rt/basic.rs b/src/libstd/rt/basic.rs index d857f39ceaf..311138d15a2 100644 --- a/src/libstd/rt/basic.rs +++ b/src/libstd/rt/basic.rs @@ -37,17 +37,6 @@ struct BasicLoop { enum Message { RunRemote(uint), RemoveRemote(uint) } -struct Time { - sec: u64, - nsec: u64, -} - -impl Ord for Time { - fn lt(&self, other: &Time) -> bool { - self.sec < other.sec || self.nsec < other.nsec - } -} - impl BasicLoop { fn new() -> BasicLoop { BasicLoop { @@ -238,14 +227,3 @@ impl Drop for BasicPausible { } } } - -fn time() -> Time { - extern { - fn rust_get_time(sec: &mut i64, nsec: &mut i32); - } - let mut sec = 0; - let mut nsec = 0; - unsafe { rust_get_time(&mut sec, &mut nsec) } - - Time { sec: sec as u64, nsec: nsec as u64 } -} diff --git a/src/libstd/rt/local_heap.rs b/src/libstd/rt/local_heap.rs index c98a66453eb..2386a261bdf 100644 --- a/src/libstd/rt/local_heap.rs +++ b/src/libstd/rt/local_heap.rs @@ -25,7 +25,9 @@ use unstable::intrinsics::TyDesc; use unstable::raw; // This has no meaning with out rtdebug also turned on. +#[cfg(rtdebug)] static TRACK_ALLOCATIONS: int = 0; +#[cfg(rtdebug)] static MAGIC: u32 = 0xbadc0ffe; pub type Box = raw::Box<()>; diff --git a/src/libstd/rt/local_ptr.rs b/src/libstd/rt/local_ptr.rs index bff9390ee3b..be3b5f951eb 100644 --- a/src/libstd/rt/local_ptr.rs +++ b/src/libstd/rt/local_ptr.rs @@ -15,6 +15,8 @@ //! XXX: Add runtime checks for usage of inconsistent pointer types. //! and for overwriting an existing pointer. +#[allow(dead_code)]; + use cast; use cell::Cell; use unstable::finally::Finally; diff --git a/src/libstd/rt/thread_local_storage.rs b/src/libstd/rt/thread_local_storage.rs index 62e1b6c50d6..d5affdd5173 100644 --- a/src/libstd/rt/thread_local_storage.rs +++ b/src/libstd/rt/thread_local_storage.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[allow(dead_code)]; + use libc::c_void; #[cfg(unix)] use libc::c_int; diff --git a/src/libstd/run.rs b/src/libstd/run.rs index d29b7388fe2..2447bba98d6 100644 --- a/src/libstd/run.rs +++ b/src/libstd/run.rs @@ -183,7 +183,10 @@ impl Process { self.inner.io[0].take(); } - fn close_outputs(&mut self) { + /** + * Closes the handle to stdout and stderr. + */ + pub fn close_outputs(&mut self) { self.inner.io[1].take(); self.inner.io[2].take(); } diff --git a/src/libstd/unicode.rs b/src/libstd/unicode.rs index f19ce98ff1a..144500fac5d 100644 --- a/src/libstd/unicode.rs +++ b/src/libstd/unicode.rs @@ -12,6 +12,7 @@ #[allow(missing_doc)]; #[allow(non_uppercase_statics)]; +#[allow(dead_code)]; pub mod general_category { diff --git a/src/libstd/unstable/sync.rs b/src/libstd/unstable/sync.rs index 9df43dfc5d2..d8e437fda81 100644 --- a/src/libstd/unstable/sync.rs +++ b/src/libstd/unstable/sync.rs @@ -35,6 +35,7 @@ pub enum UnsafeArcUnwrap<T> { UnsafeArcT(T) } +#[cfg(test)] impl<T> UnsafeArcUnwrap<T> { fn expect_t(self, msg: &'static str) -> T { match self { |
