diff options
| author | Nick Cameron <ncameron@mozilla.com> | 2015-02-23 17:16:46 +1300 |
|---|---|---|
| committer | Nick Cameron <ncameron@mozilla.com> | 2015-02-23 17:16:46 +1300 |
| commit | 1db684f67ad277ab7a002ee238872ca68fb13b27 (patch) | |
| tree | 10efe7339c5ce108ef697775751bf98760fd4380 | |
| parent | 5d8c9f5c9976a906c8d2b41f9375df2f735ec23b (diff) | |
| download | rust-1db684f67ad277ab7a002ee238872ca68fb13b27.tar.gz rust-1db684f67ad277ab7a002ee238872ca68fb13b27.zip | |
int audit - std::sync
| -rw-r--r-- | src/libstd/sync/barrier.rs | 10 | ||||
| -rw-r--r-- | src/libstd/sync/condvar.rs | 4 | ||||
| -rw-r--r-- | src/libstd/sync/mpsc/blocking.rs | 8 | ||||
| -rw-r--r-- | src/libstd/sync/mpsc/mod.rs | 188 | ||||
| -rw-r--r-- | src/libstd/sync/mpsc/oneshot.rs | 30 | ||||
| -rw-r--r-- | src/libstd/sync/mpsc/select.rs | 60 | ||||
| -rw-r--r-- | src/libstd/sync/mpsc/shared.rs | 8 | ||||
| -rw-r--r-- | src/libstd/sync/mpsc/spsc_queue.rs | 6 | ||||
| -rw-r--r-- | src/libstd/sync/mpsc/stream.rs | 10 | ||||
| -rw-r--r-- | src/libstd/sync/mpsc/sync.rs | 12 | ||||
| -rw-r--r-- | src/libstd/sync/mutex.rs | 10 | ||||
| -rw-r--r-- | src/libstd/sync/rwlock.rs | 4 | ||||
| -rw-r--r-- | src/libstd/sync/task_pool.rs | 4 |
13 files changed, 177 insertions, 177 deletions
diff --git a/src/libstd/sync/barrier.rs b/src/libstd/sync/barrier.rs index b036177af15..f697d10d5df 100644 --- a/src/libstd/sync/barrier.rs +++ b/src/libstd/sync/barrier.rs @@ -33,13 +33,13 @@ use sync::{Mutex, Condvar}; pub struct Barrier { lock: Mutex<BarrierState>, cvar: Condvar, - num_threads: uint, + num_threads: usize, } // The inner state of a double barrier struct BarrierState { - count: uint, - generation_id: uint, + count: usize, + generation_id: usize, } /// A result returned from wait. @@ -54,7 +54,7 @@ impl Barrier { /// A barrier will block `n`-1 threads which call `wait` and then wake up /// all threads at once when the `n`th thread calls `wait`. #[stable(feature = "rust1", since = "1.0.0")] - pub fn new(n: uint) -> Barrier { + pub fn new(n: usize) -> Barrier { Barrier { lock: Mutex::new(BarrierState { count: 0, @@ -115,7 +115,7 @@ mod tests { #[test] fn test_barrier() { - const N: uint = 10; + const N: usize = 10; let barrier = Arc::new(Barrier::new(N)); let (tx, rx) = channel(); diff --git a/src/libstd/sync/condvar.rs b/src/libstd/sync/condvar.rs index 52561d482c3..aa87abc6e9a 100644 --- a/src/libstd/sync/condvar.rs +++ b/src/libstd/sync/condvar.rs @@ -327,7 +327,7 @@ impl StaticCondvar { } fn verify(&self, mutex: &sys_mutex::Mutex) { - let addr = mutex as *const _ as uint; + let addr = mutex as *const _ as usize; match self.mutex.compare_and_swap(0, addr, Ordering::SeqCst) { // If we got out 0, then we have successfully bound the mutex to // this cvar. @@ -388,7 +388,7 @@ mod tests { #[test] fn notify_all() { - const N: uint = 10; + const N: usize = 10; let data = Arc::new((Mutex::new(0), Condvar::new())); let (tx, rx) = channel(); diff --git a/src/libstd/sync/mpsc/blocking.rs b/src/libstd/sync/mpsc/blocking.rs index 69b1e242b15..2e4155ea351 100644 --- a/src/libstd/sync/mpsc/blocking.rs +++ b/src/libstd/sync/mpsc/blocking.rs @@ -61,17 +61,17 @@ impl SignalToken { wake } - /// Convert to an unsafe uint value. Useful for storing in a pipe's state + /// Convert to an unsafe usize value. Useful for storing in a pipe's state /// flag. #[inline] - pub unsafe fn cast_to_uint(self) -> uint { + pub unsafe fn cast_to_usize(self) -> usize { mem::transmute(self.inner) } - /// Convert from an unsafe uint value. Useful for retrieving a pipe's state + /// Convert from an unsafe usize value. Useful for retrieving a pipe's state /// flag. #[inline] - pub unsafe fn cast_from_uint(signal_ptr: uint) -> SignalToken { + pub unsafe fn cast_from_usize(signal_ptr: usize) -> SignalToken { SignalToken { inner: mem::transmute(signal_ptr) } } diff --git a/src/libstd/sync/mpsc/mod.rs b/src/libstd/sync/mpsc/mod.rs index b437549a044..7bd1f3542eb 100644 --- a/src/libstd/sync/mpsc/mod.rs +++ b/src/libstd/sync/mpsc/mod.rs @@ -94,7 +94,7 @@ //! //! // The call to recv() will return an error because the channel has already //! // hung up (or been deallocated) -//! let (tx, rx) = channel::<int>(); +//! let (tx, rx) = channel::<i32>(); //! drop(tx); //! assert!(rx.recv().is_err()); //! ``` @@ -105,7 +105,7 @@ //! use std::thread; //! use std::sync::mpsc::sync_channel; //! -//! let (tx, rx) = sync_channel::<int>(0); +//! let (tx, rx) = sync_channel::<i32>(0); //! thread::spawn(move|| { //! // This will wait for the parent task to start receiving //! tx.send(53).unwrap(); @@ -123,7 +123,7 @@ //! use std::old_io::timer::Timer; //! use std::time::Duration; //! -//! let (tx, rx) = channel::<int>(); +//! let (tx, rx) = channel::<i32>(); //! let mut timer = Timer::new().unwrap(); //! let timeout = timer.oneshot(Duration::seconds(10)); //! @@ -147,7 +147,7 @@ //! use std::old_io::timer::Timer; //! use std::time::Duration; //! -//! let (tx, rx) = channel::<int>(); +//! let (tx, rx) = channel::<i32>(); //! let mut timer = Timer::new().unwrap(); //! //! loop { @@ -525,7 +525,7 @@ pub fn channel<T: Send>() -> (Sender<T>, Receiver<T>) { /// assert_eq!(rx.recv().unwrap(), 2); /// ``` #[stable(feature = "rust1", since = "1.0.0")] -pub fn sync_channel<T: Send>(bound: uint) -> (SyncSender<T>, Receiver<T>) { +pub fn sync_channel<T: Send>(bound: usize) -> (SyncSender<T>, Receiver<T>) { let a = Arc::new(UnsafeCell::new(sync::Packet::new(bound))); (SyncSender::new(a.clone()), Receiver::new(Flavor::Sync(a))) } @@ -1028,7 +1028,7 @@ mod test { use super::*; use thread; - pub fn stress_factor() -> uint { + pub fn stress_factor() -> usize { match env::var("RUST_TEST_STRESS") { Ok(val) => val.parse().unwrap(), Err(..) => 1, @@ -1037,7 +1037,7 @@ mod test { #[test] fn smoke() { - let (tx, rx) = channel::<int>(); + let (tx, rx) = channel::<i32>(); tx.send(1).unwrap(); assert_eq!(rx.recv().unwrap(), 1); } @@ -1058,7 +1058,7 @@ mod test { #[test] fn smoke_shared() { - let (tx, rx) = channel::<int>(); + let (tx, rx) = channel::<i32>(); tx.send(1).unwrap(); assert_eq!(rx.recv().unwrap(), 1); let tx = tx.clone(); @@ -1068,7 +1068,7 @@ mod test { #[test] fn smoke_threads() { - let (tx, rx) = channel::<int>(); + let (tx, rx) = channel::<i32>(); let _t = thread::spawn(move|| { tx.send(1).unwrap(); }); @@ -1077,21 +1077,21 @@ mod test { #[test] fn smoke_port_gone() { - let (tx, rx) = channel::<int>(); + let (tx, rx) = channel::<i32>(); drop(rx); assert!(tx.send(1).is_err()); } #[test] fn smoke_shared_port_gone() { - let (tx, rx) = channel::<int>(); + let (tx, rx) = channel::<i32>(); drop(rx); assert!(tx.send(1).is_err()) } #[test] fn smoke_shared_port_gone2() { - let (tx, rx) = channel::<int>(); + let (tx, rx) = channel::<i32>(); drop(rx); let tx2 = tx.clone(); drop(tx); @@ -1100,7 +1100,7 @@ mod test { #[test] fn port_gone_concurrent() { - let (tx, rx) = channel::<int>(); + let (tx, rx) = channel::<i32>(); let _t = thread::spawn(move|| { rx.recv().unwrap(); }); @@ -1109,7 +1109,7 @@ mod test { #[test] fn port_gone_concurrent_shared() { - let (tx, rx) = channel::<int>(); + let (tx, rx) = channel::<i32>(); let tx2 = tx.clone(); let _t = thread::spawn(move|| { rx.recv().unwrap(); @@ -1119,7 +1119,7 @@ mod test { #[test] fn smoke_chan_gone() { - let (tx, rx) = channel::<int>(); + let (tx, rx) = channel::<i32>(); drop(tx); assert!(rx.recv().is_err()); } @@ -1135,7 +1135,7 @@ mod test { #[test] fn chan_gone_concurrent() { - let (tx, rx) = channel::<int>(); + let (tx, rx) = channel::<i32>(); let _t = thread::spawn(move|| { tx.send(1).unwrap(); tx.send(1).unwrap(); @@ -1145,7 +1145,7 @@ mod test { #[test] fn stress() { - let (tx, rx) = channel::<int>(); + let (tx, rx) = channel::<i32>(); let t = thread::spawn(move|| { for _ in 0..10000 { tx.send(1).unwrap(); } }); @@ -1157,9 +1157,9 @@ mod test { #[test] fn stress_shared() { - static AMT: uint = 10000; - static NTHREADS: uint = 8; - let (tx, rx) = channel::<int>(); + static AMT: u32 = 10000; + static NTHREADS: u32 = 8; + let (tx, rx) = channel::<i32>(); let t = thread::spawn(move|| { for _ in 0..AMT * NTHREADS { @@ -1184,7 +1184,7 @@ mod test { #[test] fn send_from_outside_runtime() { let (tx1, rx1) = channel::<()>(); - let (tx2, rx2) = channel::<int>(); + let (tx2, rx2) = channel::<i32>(); let t1 = thread::spawn(move|| { tx1.send(()).unwrap(); for _ in 0..40 { @@ -1203,7 +1203,7 @@ mod test { #[test] fn recv_from_outside_runtime() { - let (tx, rx) = channel::<int>(); + let (tx, rx) = channel::<i32>(); let t = thread::spawn(move|| { for _ in 0..40 { assert_eq!(rx.recv().unwrap(), 1); @@ -1217,8 +1217,8 @@ mod test { #[test] fn no_runtime() { - let (tx1, rx1) = channel::<int>(); - let (tx2, rx2) = channel::<int>(); + let (tx1, rx1) = channel::<i32>(); + let (tx2, rx2) = channel::<i32>(); let t1 = thread::spawn(move|| { assert_eq!(rx1.recv().unwrap(), 1); tx2.send(2).unwrap(); @@ -1234,21 +1234,21 @@ mod test { #[test] fn oneshot_single_thread_close_port_first() { // Simple test of closing without sending - let (_tx, rx) = channel::<int>(); + let (_tx, rx) = channel::<i32>(); drop(rx); } #[test] fn oneshot_single_thread_close_chan_first() { // Simple test of closing without sending - let (tx, _rx) = channel::<int>(); + let (tx, _rx) = channel::<i32>(); drop(tx); } #[test] fn oneshot_single_thread_send_port_close() { // Testing that the sender cleans up the payload if receiver is closed - let (tx, rx) = channel::<Box<int>>(); + let (tx, rx) = channel::<Box<i32>>(); drop(rx); assert!(tx.send(box 0).is_err()); } @@ -1257,7 +1257,7 @@ mod test { fn oneshot_single_thread_recv_chan_close() { // Receiving on a closed chan will panic let res = thread::spawn(move|| { - let (tx, rx) = channel::<int>(); + let (tx, rx) = channel::<i32>(); drop(tx); rx.recv().unwrap(); }).join(); @@ -1267,42 +1267,42 @@ mod test { #[test] fn oneshot_single_thread_send_then_recv() { - let (tx, rx) = channel::<Box<int>>(); + let (tx, rx) = channel::<Box<i32>>(); tx.send(box 10).unwrap(); assert!(rx.recv().unwrap() == box 10); } #[test] fn oneshot_single_thread_try_send_open() { - let (tx, rx) = channel::<int>(); + let (tx, rx) = channel::<i32>(); assert!(tx.send(10).is_ok()); assert!(rx.recv().unwrap() == 10); } #[test] fn oneshot_single_thread_try_send_closed() { - let (tx, rx) = channel::<int>(); + let (tx, rx) = channel::<i32>(); drop(rx); assert!(tx.send(10).is_err()); } #[test] fn oneshot_single_thread_try_recv_open() { - let (tx, rx) = channel::<int>(); + let (tx, rx) = channel::<i32>(); tx.send(10).unwrap(); assert!(rx.recv() == Ok(10)); } #[test] fn oneshot_single_thread_try_recv_closed() { - let (tx, rx) = channel::<int>(); + let (tx, rx) = channel::<i32>(); drop(tx); assert!(rx.recv().is_err()); } #[test] fn oneshot_single_thread_peek_data() { - let (tx, rx) = channel::<int>(); + let (tx, rx) = channel::<i32>(); assert_eq!(rx.try_recv(), Err(TryRecvError::Empty)); tx.send(10).unwrap(); assert_eq!(rx.try_recv(), Ok(10)); @@ -1310,7 +1310,7 @@ mod test { #[test] fn oneshot_single_thread_peek_close() { - let (tx, rx) = channel::<int>(); + let (tx, rx) = channel::<i32>(); drop(tx); assert_eq!(rx.try_recv(), Err(TryRecvError::Disconnected)); assert_eq!(rx.try_recv(), Err(TryRecvError::Disconnected)); @@ -1318,13 +1318,13 @@ mod test { #[test] fn oneshot_single_thread_peek_open() { - let (_tx, rx) = channel::<int>(); + let (_tx, rx) = channel::<i32>(); assert_eq!(rx.try_recv(), Err(TryRecvError::Empty)); } #[test] fn oneshot_multi_task_recv_then_send() { - let (tx, rx) = channel::<Box<int>>(); + let (tx, rx) = channel::<Box<i32>>(); let _t = thread::spawn(move|| { assert!(rx.recv().unwrap() == box 10); }); @@ -1334,7 +1334,7 @@ mod test { #[test] fn oneshot_multi_task_recv_then_close() { - let (tx, rx) = channel::<Box<int>>(); + let (tx, rx) = channel::<Box<i32>>(); let _t = thread::spawn(move|| { drop(tx); }); @@ -1347,7 +1347,7 @@ mod test { #[test] fn oneshot_multi_thread_close_stress() { for _ in 0..stress_factor() { - let (tx, rx) = channel::<int>(); + let (tx, rx) = channel::<i32>(); let _t = thread::spawn(move|| { drop(rx); }); @@ -1358,7 +1358,7 @@ mod test { #[test] fn oneshot_multi_thread_send_close_stress() { for _ in 0..stress_factor() { - let (tx, rx) = channel::<int>(); + let (tx, rx) = channel::<i32>(); let _t = thread::spawn(move|| { drop(rx); }); @@ -1371,7 +1371,7 @@ mod test { #[test] fn oneshot_multi_thread_recv_close_stress() { for _ in 0..stress_factor() { - let (tx, rx) = channel::<int>(); + let (tx, rx) = channel::<i32>(); thread::spawn(move|| { let res = thread::spawn(move|| { rx.recv().unwrap(); @@ -1405,7 +1405,7 @@ mod test { send(tx, 0); recv(rx, 0); - fn send(tx: Sender<Box<int>>, i: int) { + fn send(tx: Sender<Box<i32>>, i: i32) { if i == 10 { return } thread::spawn(move|| { @@ -1414,7 +1414,7 @@ mod test { }); } - fn recv(rx: Receiver<Box<int>>, i: int) { + fn recv(rx: Receiver<Box<i32>>, i: i32) { if i == 10 { return } thread::spawn(move|| { @@ -1451,8 +1451,8 @@ mod test { #[test] fn test_nested_recv_iter() { - let (tx, rx) = channel::<int>(); - let (total_tx, total_rx) = channel::<int>(); + let (tx, rx) = channel::<i32>(); + let (total_tx, total_rx) = channel::<i32>(); let _t = thread::spawn(move|| { let mut acc = 0; @@ -1471,7 +1471,7 @@ mod test { #[test] fn test_recv_iter_break() { - let (tx, rx) = channel::<int>(); + let (tx, rx) = channel::<i32>(); let (count_tx, count_rx) = channel(); let _t = thread::spawn(move|| { @@ -1496,7 +1496,7 @@ mod test { #[test] fn try_recv_states() { - let (tx1, rx1) = channel::<int>(); + let (tx1, rx1) = channel::<i32>(); let (tx2, rx2) = channel::<()>(); let (tx3, rx3) = channel::<()>(); let _t = thread::spawn(move|| { @@ -1550,7 +1550,7 @@ mod sync_tests { use thread; use super::*; - pub fn stress_factor() -> uint { + pub fn stress_factor() -> usize { match env::var("RUST_TEST_STRESS") { Ok(val) => val.parse().unwrap(), Err(..) => 1, @@ -1559,7 +1559,7 @@ mod sync_tests { #[test] fn smoke() { - let (tx, rx) = sync_channel::<int>(1); + let (tx, rx) = sync_channel::<i32>(1); tx.send(1).unwrap(); assert_eq!(rx.recv().unwrap(), 1); } @@ -1572,7 +1572,7 @@ mod sync_tests { #[test] fn smoke_shared() { - let (tx, rx) = sync_channel::<int>(1); + let (tx, rx) = sync_channel::<i32>(1); tx.send(1).unwrap(); assert_eq!(rx.recv().unwrap(), 1); let tx = tx.clone(); @@ -1582,7 +1582,7 @@ mod sync_tests { #[test] fn smoke_threads() { - let (tx, rx) = sync_channel::<int>(0); + let (tx, rx) = sync_channel::<i32>(0); let _t = thread::spawn(move|| { tx.send(1).unwrap(); }); @@ -1591,14 +1591,14 @@ mod sync_tests { #[test] fn smoke_port_gone() { - let (tx, rx) = sync_channel::<int>(0); + let (tx, rx) = sync_channel::<i32>(0); drop(rx); assert!(tx.send(1).is_err()); } #[test] fn smoke_shared_port_gone2() { - let (tx, rx) = sync_channel::<int>(0); + let (tx, rx) = sync_channel::<i32>(0); drop(rx); let tx2 = tx.clone(); drop(tx); @@ -1607,7 +1607,7 @@ mod sync_tests { #[test] fn port_gone_concurrent() { - let (tx, rx) = sync_channel::<int>(0); + let (tx, rx) = sync_channel::<i32>(0); let _t = thread::spawn(move|| { rx.recv().unwrap(); }); @@ -1616,7 +1616,7 @@ mod sync_tests { #[test] fn port_gone_concurrent_shared() { - let (tx, rx) = sync_channel::<int>(0); + let (tx, rx) = sync_channel::<i32>(0); let tx2 = tx.clone(); let _t = thread::spawn(move|| { rx.recv().unwrap(); @@ -1626,7 +1626,7 @@ mod sync_tests { #[test] fn smoke_chan_gone() { - let (tx, rx) = sync_channel::<int>(0); + let (tx, rx) = sync_channel::<i32>(0); drop(tx); assert!(rx.recv().is_err()); } @@ -1642,7 +1642,7 @@ mod sync_tests { #[test] fn chan_gone_concurrent() { - let (tx, rx) = sync_channel::<int>(0); + let (tx, rx) = sync_channel::<i32>(0); thread::spawn(move|| { tx.send(1).unwrap(); tx.send(1).unwrap(); @@ -1652,7 +1652,7 @@ mod sync_tests { #[test] fn stress() { - let (tx, rx) = sync_channel::<int>(0); + let (tx, rx) = sync_channel::<i32>(0); thread::spawn(move|| { for _ in 0..10000 { tx.send(1).unwrap(); } }); @@ -1663,9 +1663,9 @@ mod sync_tests { #[test] fn stress_shared() { - static AMT: uint = 1000; - static NTHREADS: uint = 8; - let (tx, rx) = sync_channel::<int>(0); + static AMT: u32 = 1000; + static NTHREADS: u32 = 8; + let (tx, rx) = sync_channel::<i32>(0); let (dtx, drx) = sync_channel::<()>(0); thread::spawn(move|| { @@ -1692,21 +1692,21 @@ mod sync_tests { #[test] fn oneshot_single_thread_close_port_first() { // Simple test of closing without sending - let (_tx, rx) = sync_channel::<int>(0); + let (_tx, rx) = sync_channel::<i32>(0); drop(rx); } #[test] fn oneshot_single_thread_close_chan_first() { // Simple test of closing without sending - let (tx, _rx) = sync_channel::<int>(0); + let (tx, _rx) = sync_channel::<i32>(0); drop(tx); } #[test] fn oneshot_single_thread_send_port_close() { // Testing that the sender cleans up the payload if receiver is closed - let (tx, rx) = sync_channel::<Box<int>>(0); + let (tx, rx) = sync_channel::<Box<i32>>(0); drop(rx); assert!(tx.send(box 0).is_err()); } @@ -1715,7 +1715,7 @@ mod sync_tests { fn oneshot_single_thread_recv_chan_close() { // Receiving on a closed chan will panic let res = thread::spawn(move|| { - let (tx, rx) = sync_channel::<int>(0); + let (tx, rx) = sync_channel::<i32>(0); drop(tx); rx.recv().unwrap(); }).join(); @@ -1725,48 +1725,48 @@ mod sync_tests { #[test] fn oneshot_single_thread_send_then_recv() { - let (tx, rx) = sync_channel::<Box<int>>(1); + let (tx, rx) = sync_channel::<Box<i32>>(1); tx.send(box 10).unwrap(); assert!(rx.recv().unwrap() == box 10); } #[test] fn oneshot_single_thread_try_send_open() { - let (tx, rx) = sync_channel::<int>(1); + let (tx, rx) = sync_channel::<i32>(1); assert_eq!(tx.try_send(10), Ok(())); assert!(rx.recv().unwrap() == 10); } #[test] fn oneshot_single_thread_try_send_closed() { - let (tx, rx) = sync_channel::<int>(0); + let (tx, rx) = sync_channel::<i32>(0); drop(rx); assert_eq!(tx.try_send(10), Err(TrySendError::Disconnected(10))); } #[test] fn oneshot_single_thread_try_send_closed2() { - let (tx, _rx) = sync_channel::<int>(0); + let (tx, _rx) = sync_channel::<i32>(0); assert_eq!(tx.try_send(10), Err(TrySendError::Full(10))); } #[test] fn oneshot_single_thread_try_recv_open() { - let (tx, rx) = sync_channel::<int>(1); + let (tx, rx) = sync_channel::<i32>(1); tx.send(10).unwrap(); assert!(rx.recv() == Ok(10)); } #[test] fn oneshot_single_thread_try_recv_closed() { - let (tx, rx) = sync_channel::<int>(0); + let (tx, rx) = sync_channel::<i32>(0); drop(tx); assert!(rx.recv().is_err()); } #[test] fn oneshot_single_thread_peek_data() { - let (tx, rx) = sync_channel::<int>(1); + let (tx, rx) = sync_channel::<i32>(1); assert_eq!(rx.try_recv(), Err(TryRecvError::Empty)); tx.send(10).unwrap(); assert_eq!(rx.try_recv(), Ok(10)); @@ -1774,7 +1774,7 @@ mod sync_tests { #[test] fn oneshot_single_thread_peek_close() { - let (tx, rx) = sync_channel::<int>(0); + let (tx, rx) = sync_channel::<i32>(0); drop(tx); assert_eq!(rx.try_recv(), Err(TryRecvError::Disconnected)); assert_eq!(rx.try_recv(), Err(TryRecvError::Disconnected)); @@ -1782,13 +1782,13 @@ mod sync_tests { #[test] fn oneshot_single_thread_peek_open() { - let (_tx, rx) = sync_channel::<int>(0); + let (_tx, rx) = sync_channel::<i32>(0); assert_eq!(rx.try_recv(), Err(TryRecvError::Empty)); } #[test] fn oneshot_multi_task_recv_then_send() { - let (tx, rx) = sync_channel::<Box<int>>(0); + let (tx, rx) = sync_channel::<Box<i32>>(0); let _t = thread::spawn(move|| { assert!(rx.recv().unwrap() == box 10); }); @@ -1798,7 +1798,7 @@ mod sync_tests { #[test] fn oneshot_multi_task_recv_then_close() { - let (tx, rx) = sync_channel::<Box<int>>(0); + let (tx, rx) = sync_channel::<Box<i32>>(0); let _t = thread::spawn(move|| { drop(tx); }); @@ -1811,7 +1811,7 @@ mod sync_tests { #[test] fn oneshot_multi_thread_close_stress() { for _ in 0..stress_factor() { - let (tx, rx) = sync_channel::<int>(0); + let (tx, rx) = sync_channel::<i32>(0); let _t = thread::spawn(move|| { drop(rx); }); @@ -1822,7 +1822,7 @@ mod sync_tests { #[test] fn oneshot_multi_thread_send_close_stress() { for _ in 0..stress_factor() { - let (tx, rx) = sync_channel::<int>(0); + let (tx, rx) = sync_channel::<i32>(0); let _t = thread::spawn(move|| { drop(rx); }); @@ -1835,7 +1835,7 @@ mod sync_tests { #[test] fn oneshot_multi_thread_recv_close_stress() { for _ in 0..stress_factor() { - let (tx, rx) = sync_channel::<int>(0); + let (tx, rx) = sync_channel::<i32>(0); let _t = thread::spawn(move|| { let res = thread::spawn(move|| { rx.recv().unwrap(); @@ -1853,7 +1853,7 @@ mod sync_tests { #[test] fn oneshot_multi_thread_send_recv_stress() { for _ in 0..stress_factor() { - let (tx, rx) = sync_channel::<Box<int>>(0); + let (tx, rx) = sync_channel::<Box<i32>>(0); let _t = thread::spawn(move|| { tx.send(box 10).unwrap(); }); @@ -1864,12 +1864,12 @@ mod sync_tests { #[test] fn stream_send_recv_stress() { for _ in 0..stress_factor() { - let (tx, rx) = sync_channel::<Box<int>>(0); + let (tx, rx) = sync_channel::<Box<i32>>(0); send(tx, 0); recv(rx, 0); - fn send(tx: SyncSender<Box<int>>, i: int) { + fn send(tx: SyncSender<Box<i32>>, i: i32) { if i == 10 { return } thread::spawn(move|| { @@ -1878,7 +1878,7 @@ mod sync_tests { }); } - fn recv(rx: Receiver<Box<int>>, i: int) { + fn recv(rx: Receiver<Box<i32>>, i: i32) { if i == 10 { return } thread::spawn(move|| { @@ -1915,8 +1915,8 @@ mod sync_tests { #[test] fn test_nested_recv_iter() { - let (tx, rx) = sync_channel::<int>(0); - let (total_tx, total_rx) = sync_channel::<int>(0); + let (tx, rx) = sync_channel::<i32>(0); + let (total_tx, total_rx) = sync_channel::<i32>(0); let _t = thread::spawn(move|| { let mut acc = 0; @@ -1935,7 +1935,7 @@ mod sync_tests { #[test] fn test_recv_iter_break() { - let (tx, rx) = sync_channel::<int>(0); + let (tx, rx) = sync_channel::<i32>(0); let (count_tx, count_rx) = sync_channel(0); let _t = thread::spawn(move|| { @@ -1960,7 +1960,7 @@ mod sync_tests { #[test] fn try_recv_states() { - let (tx1, rx1) = sync_channel::<int>(1); + let (tx1, rx1) = sync_channel::<i32>(1); let (tx2, rx2) = sync_channel::<()>(1); let (tx3, rx3) = sync_channel::<()>(1); let _t = thread::spawn(move|| { @@ -2007,21 +2007,21 @@ mod sync_tests { #[test] fn send1() { - let (tx, rx) = sync_channel::<int>(0); + let (tx, rx) = sync_channel::<i32>(0); let _t = thread::spawn(move|| { rx.recv().unwrap(); }); assert_eq!(tx.send(1), Ok(())); } #[test] fn send2() { - let (tx, rx) = sync_channel::<int>(0); + let (tx, rx) = sync_channel::<i32>(0); let _t = thread::spawn(move|| { drop(rx); }); assert!(tx.send(1).is_err()); } #[test] fn send3() { - let (tx, rx) = sync_channel::<int>(1); + let (tx, rx) = sync_channel::<i32>(1); assert_eq!(tx.send(1), Ok(())); let _t =thread::spawn(move|| { drop(rx); }); assert!(tx.send(1).is_err()); @@ -2029,7 +2029,7 @@ mod sync_tests { #[test] fn send4() { - let (tx, rx) = sync_channel::<int>(0); + let (tx, rx) = sync_channel::<i32>(0); let tx2 = tx.clone(); let (done, donerx) = channel(); let done2 = done.clone(); @@ -2048,20 +2048,20 @@ mod sync_tests { #[test] fn try_send1() { - let (tx, _rx) = sync_channel::<int>(0); + let (tx, _rx) = sync_channel::<i32>(0); assert_eq!(tx.try_send(1), Err(TrySendError::Full(1))); } #[test] fn try_send2() { - let (tx, _rx) = sync_channel::<int>(1); + let (tx, _rx) = sync_channel::<i32>(1); assert_eq!(tx.try_send(1), Ok(())); assert_eq!(tx.try_send(1), Err(TrySendError::Full(1))); } #[test] fn try_send3() { - let (tx, rx) = sync_channel::<int>(1); + let (tx, rx) = sync_channel::<i32>(1); assert_eq!(tx.try_send(1), Ok(())); drop(rx); assert_eq!(tx.try_send(1), Err(TrySendError::Disconnected(1))); diff --git a/src/libstd/sync/mpsc/oneshot.rs b/src/libstd/sync/mpsc/oneshot.rs index eb45681fa62..f287712d9d4 100644 --- a/src/libstd/sync/mpsc/oneshot.rs +++ b/src/libstd/sync/mpsc/oneshot.rs @@ -22,7 +22,7 @@ /// /// # Implementation /// -/// Oneshots are implemented around one atomic uint variable. This variable +/// Oneshots are implemented around one atomic usize variable. This variable /// indicates both the state of the port/chan but also contains any tasks /// blocked on the port. All atomic operations happen on this one word. /// @@ -45,9 +45,9 @@ use core::mem; use sync::atomic::{AtomicUsize, Ordering}; // Various states you can find a port in. -const EMPTY: uint = 0; // initial state: no data, no blocked receiver -const DATA: uint = 1; // data ready for receiver to take -const DISCONNECTED: uint = 2; // channel is disconnected OR upgraded +const EMPTY: usize = 0; // initial state: no data, no blocked receiver +const DATA: usize = 1; // data ready for receiver to take +const DISCONNECTED: usize = 2; // channel is disconnected OR upgraded // Any other value represents a pointer to a SignalToken value. The // protocol ensures that when the state moves *to* a pointer, // ownership of the token is given to the packet, and when the state @@ -123,7 +123,7 @@ impl<T: Send> Packet<T> { // There is a thread waiting on the other end. We leave the 'DATA' // state inside so it'll pick it up on the other end. ptr => unsafe { - SignalToken::cast_from_uint(ptr).signal(); + SignalToken::cast_from_usize(ptr).signal(); Ok(()) } } @@ -143,7 +143,7 @@ impl<T: Send> Packet<T> { // like we're not empty, then immediately go through to `try_recv`. if self.state.load(Ordering::SeqCst) == EMPTY { let (wait_token, signal_token) = blocking::tokens(); - let ptr = unsafe { signal_token.cast_to_uint() }; + let ptr = unsafe { signal_token.cast_to_usize() }; // race with senders to enter the blocking state if self.state.compare_and_swap(EMPTY, ptr, Ordering::SeqCst) == EMPTY { @@ -151,7 +151,7 @@ impl<T: Send> Packet<T> { debug_assert!(self.state.load(Ordering::SeqCst) != EMPTY); } else { // drop the signal token, since we never blocked - drop(unsafe { SignalToken::cast_from_uint(ptr) }); + drop(unsafe { SignalToken::cast_from_usize(ptr) }); } } @@ -220,7 +220,7 @@ impl<T: Send> Packet<T> { DISCONNECTED => { self.upgrade = prev; UpDisconnected } // If someone's waiting, we gotta wake them up - ptr => UpWoke(unsafe { SignalToken::cast_from_uint(ptr) }) + ptr => UpWoke(unsafe { SignalToken::cast_from_usize(ptr) }) } } @@ -230,7 +230,7 @@ impl<T: Send> Packet<T> { // If someone's waiting, we gotta wake them up ptr => unsafe { - SignalToken::cast_from_uint(ptr).signal(); + SignalToken::cast_from_usize(ptr).signal(); } } } @@ -283,15 +283,15 @@ impl<T: Send> Packet<T> { // Attempts to start selection on this port. This can either succeed, fail // because there is data, or fail because there is an upgrade pending. pub fn start_selection(&mut self, token: SignalToken) -> SelectionResult<T> { - let ptr = unsafe { token.cast_to_uint() }; + let ptr = unsafe { token.cast_to_usize() }; match self.state.compare_and_swap(EMPTY, ptr, Ordering::SeqCst) { EMPTY => SelSuccess, DATA => { - drop(unsafe { SignalToken::cast_from_uint(ptr) }); + drop(unsafe { SignalToken::cast_from_usize(ptr) }); SelCanceled } DISCONNECTED if self.data.is_some() => { - drop(unsafe { SignalToken::cast_from_uint(ptr) }); + drop(unsafe { SignalToken::cast_from_usize(ptr) }); SelCanceled } DISCONNECTED => { @@ -300,7 +300,7 @@ impl<T: Send> Packet<T> { // propagate upwards whether the upgrade can receive // data GoUp(upgrade) => { - SelUpgraded(unsafe { SignalToken::cast_from_uint(ptr) }, upgrade) + SelUpgraded(unsafe { SignalToken::cast_from_usize(ptr) }, upgrade) } // If the other end disconnected without sending an @@ -308,7 +308,7 @@ impl<T: Send> Packet<T> { // disconnected). up => { self.upgrade = up; - drop(unsafe { SignalToken::cast_from_uint(ptr) }); + drop(unsafe { SignalToken::cast_from_usize(ptr) }); SelCanceled } } @@ -360,7 +360,7 @@ impl<T: Send> Packet<T> { // We woke ourselves up from select. ptr => unsafe { - drop(SignalToken::cast_from_uint(ptr)); + drop(SignalToken::cast_from_usize(ptr)); Ok(false) } } diff --git a/src/libstd/sync/mpsc/select.rs b/src/libstd/sync/mpsc/select.rs index db8efe19dc1..b6f93b8e0e5 100644 --- a/src/libstd/sync/mpsc/select.rs +++ b/src/libstd/sync/mpsc/select.rs @@ -71,7 +71,7 @@ use sync::mpsc::blocking::{self, SignalToken}; pub struct Select { head: *mut Handle<'static, ()>, tail: *mut Handle<'static, ()>, - next_id: Cell<uint>, + next_id: Cell<usize>, } impl !marker::Send for Select {} @@ -82,7 +82,7 @@ impl !marker::Send for Select {} pub struct Handle<'rx, T:'rx> { /// The ID of this handle, used to compare against the return value of /// `Select::wait()` - id: uint, + id: usize, selector: &'rx Select, next: *mut Handle<'static, ()>, prev: *mut Handle<'static, ()>, @@ -154,12 +154,12 @@ impl Select { /// the matching `id` will have some sort of event available on it. The /// event could either be that data is available or the corresponding /// channel has been closed. - pub fn wait(&self) -> uint { + pub fn wait(&self) -> usize { self.wait2(true) } /// Helper method for skipping the preflight checks during testing - fn wait2(&self, do_preflight_checks: bool) -> uint { + fn wait2(&self, do_preflight_checks: bool) -> usize { // Note that this is currently an inefficient implementation. We in // theory have knowledge about all receivers in the set ahead of time, // so this method shouldn't really have to iterate over all of them yet @@ -254,7 +254,7 @@ impl Select { impl<'rx, T: Send> Handle<'rx, T> { /// Retrieve the id of this handle. #[inline] - pub fn id(&self) -> uint { self.id } + pub fn id(&self) -> usize { self.id } /// Block to receive a value on the underlying receiver, returning `Some` on /// success or `None` if the channel disconnects. This function has the same @@ -369,8 +369,8 @@ mod test { #[test] fn smoke() { - let (tx1, rx1) = channel::<int>(); - let (tx2, rx2) = channel::<int>(); + let (tx1, rx1) = channel::<i32>(); + let (tx2, rx2) = channel::<i32>(); tx1.send(1).unwrap(); select! { foo = rx1.recv() => { assert_eq!(foo.unwrap(), 1); }, @@ -394,11 +394,11 @@ mod test { #[test] fn smoke2() { - let (_tx1, rx1) = channel::<int>(); - let (_tx2, rx2) = channel::<int>(); - let (_tx3, rx3) = channel::<int>(); - let (_tx4, rx4) = channel::<int>(); - let (tx5, rx5) = channel::<int>(); + let (_tx1, rx1) = channel::<i32>(); + let (_tx2, rx2) = channel::<i32>(); + let (_tx3, rx3) = channel::<i32>(); + let (_tx4, rx4) = channel::<i32>(); + let (tx5, rx5) = channel::<i32>(); tx5.send(4).unwrap(); select! { _foo = rx1.recv() => { panic!("1") }, @@ -411,8 +411,8 @@ mod test { #[test] fn closed() { - let (_tx1, rx1) = channel::<int>(); - let (tx2, rx2) = channel::<int>(); + let (_tx1, rx1) = channel::<i32>(); + let (tx2, rx2) = channel::<i32>(); drop(tx2); select! { @@ -423,9 +423,9 @@ mod test { #[test] fn unblocks() { - let (tx1, rx1) = channel::<int>(); - let (_tx2, rx2) = channel::<int>(); - let (tx3, rx3) = channel::<int>(); + let (tx1, rx1) = channel::<i32>(); + let (_tx2, rx2) = channel::<i32>(); + let (tx3, rx3) = channel::<i32>(); let _t = thread::spawn(move|| { for _ in 0..20 { thread::yield_now(); } @@ -447,8 +447,8 @@ mod test { #[test] fn both_ready() { - let (tx1, rx1) = channel::<int>(); - let (tx2, rx2) = channel::<int>(); + let (tx1, rx1) = channel::<i32>(); + let (tx2, rx2) = channel::<i32>(); let (tx3, rx3) = channel::<()>(); let _t = thread::spawn(move|| { @@ -473,9 +473,9 @@ mod test { #[test] fn stress() { - static AMT: int = 10000; - let (tx1, rx1) = channel::<int>(); - let (tx2, rx2) = channel::<int>(); + static AMT: u32 = 10000; + let (tx1, rx1) = channel::<i32>(); + let (tx2, rx2) = channel::<i32>(); let (tx3, rx3) = channel::<()>(); let _t = thread::spawn(move|| { @@ -500,8 +500,8 @@ mod test { #[test] fn cloning() { - let (tx1, rx1) = channel::<int>(); - let (_tx2, rx2) = channel::<int>(); + let (tx1, rx1) = channel::<i32>(); + let (_tx2, rx2) = channel::<i32>(); let (tx3, rx3) = channel::<()>(); let _t = thread::spawn(move|| { @@ -522,8 +522,8 @@ mod test { #[test] fn cloning2() { - let (tx1, rx1) = channel::<int>(); - let (_tx2, rx2) = channel::<int>(); + let (tx1, rx1) = channel::<i32>(); + let (_tx2, rx2) = channel::<i32>(); let (tx3, rx3) = channel::<()>(); let _t = thread::spawn(move|| { @@ -716,7 +716,7 @@ mod test { #[test] fn sync1() { - let (tx, rx) = sync_channel::<int>(1); + let (tx, rx) = sync_channel::<i32>(1); tx.send(1).unwrap(); select! { n = rx.recv() => { assert_eq!(n.unwrap(), 1); } @@ -725,7 +725,7 @@ mod test { #[test] fn sync2() { - let (tx, rx) = sync_channel::<int>(0); + let (tx, rx) = sync_channel::<i32>(0); let _t = thread::spawn(move|| { for _ in 0..100 { thread::yield_now() } tx.send(1).unwrap(); @@ -737,8 +737,8 @@ mod test { #[test] fn sync3() { - let (tx1, rx1) = sync_channel::<int>(0); - let (tx2, rx2): (Sender<int>, Receiver<int>) = channel(); + let (tx1, rx1) = sync_channel::<i32>(0); + let (tx2, rx2): (Sender<i32>, Receiver<i32>) = channel(); let _t = thread::spawn(move|| { tx1.send(1).unwrap(); }); let _t = thread::spawn(move|| { tx2.send(2).unwrap(); }); select! { diff --git a/src/libstd/sync/mpsc/shared.rs b/src/libstd/sync/mpsc/shared.rs index 729e7991f97..8d14824d37f 100644 --- a/src/libstd/sync/mpsc/shared.rs +++ b/src/libstd/sync/mpsc/shared.rs @@ -101,7 +101,7 @@ impl<T: Send> Packet<T> { token.map(|token| { assert_eq!(self.cnt.load(Ordering::SeqCst), 0); assert_eq!(self.to_wake.load(Ordering::SeqCst), 0); - self.to_wake.store(unsafe { token.cast_to_uint() }, Ordering::SeqCst); + self.to_wake.store(unsafe { token.cast_to_usize() }, Ordering::SeqCst); self.cnt.store(-1, Ordering::SeqCst); // This store is a little sketchy. What's happening here is that @@ -241,7 +241,7 @@ impl<T: Send> Packet<T> { // Returns true if blocking should proceed. fn decrement(&mut self, token: SignalToken) -> StartResult { assert_eq!(self.to_wake.load(Ordering::SeqCst), 0); - let ptr = unsafe { token.cast_to_uint() }; + let ptr = unsafe { token.cast_to_usize() }; self.to_wake.store(ptr, Ordering::SeqCst); let steals = self.steals; @@ -258,7 +258,7 @@ impl<T: Send> Packet<T> { } self.to_wake.store(0, Ordering::SeqCst); - drop(unsafe { SignalToken::cast_from_uint(ptr) }); + drop(unsafe { SignalToken::cast_from_usize(ptr) }); Abort } @@ -380,7 +380,7 @@ impl<T: Send> Packet<T> { let ptr = self.to_wake.load(Ordering::SeqCst); self.to_wake.store(0, Ordering::SeqCst); assert!(ptr != 0); - unsafe { SignalToken::cast_from_uint(ptr) } + unsafe { SignalToken::cast_from_usize(ptr) } } //////////////////////////////////////////////////////////////////////////// diff --git a/src/libstd/sync/mpsc/spsc_queue.rs b/src/libstd/sync/mpsc/spsc_queue.rs index f111e13975f..ed7190558d8 100644 --- a/src/libstd/sync/mpsc/spsc_queue.rs +++ b/src/libstd/sync/mpsc/spsc_queue.rs @@ -69,7 +69,7 @@ pub struct Queue<T> { // Cache maintenance fields. Additions and subtractions are stored // separately in order to allow them to use nonatomic addition/subtraction. - cache_bound: uint, + cache_bound: usize, cache_additions: AtomicUsize, cache_subtractions: AtomicUsize, } @@ -107,7 +107,7 @@ impl<T: Send> Queue<T> { /// cache (if desired). If the value is 0, then the cache has /// no bound. Otherwise, the cache will never grow larger than /// `bound` (although the queue itself could be much larger. - pub unsafe fn new(bound: uint) -> Queue<T> { + pub unsafe fn new(bound: usize) -> Queue<T> { let n1 = Node::new(); let n2 = Node::new(); (*n1).next.store(n2, Ordering::Relaxed); @@ -319,7 +319,7 @@ mod test { stress_bound(1); } - unsafe fn stress_bound(bound: uint) { + unsafe fn stress_bound(bound: usize) { let q = Arc::new(Queue::new(bound)); let (tx, rx) = channel(); diff --git a/src/libstd/sync/mpsc/stream.rs b/src/libstd/sync/mpsc/stream.rs index 2d528662f64..5a1e05f9c15 100644 --- a/src/libstd/sync/mpsc/stream.rs +++ b/src/libstd/sync/mpsc/stream.rs @@ -43,7 +43,7 @@ pub struct Packet<T> { queue: spsc::Queue<Message<T>>, // internal queue for all message cnt: AtomicIsize, // How many items are on this channel - steals: int, // How many times has a port received without blocking? + steals: isize, // How many times has a port received without blocking? to_wake: AtomicUsize, // SignalToken for the blocked thread to wake up port_dropped: AtomicBool, // flag if the channel has been destroyed. @@ -146,7 +146,7 @@ impl<T: Send> Packet<T> { let ptr = self.to_wake.load(Ordering::SeqCst); self.to_wake.store(0, Ordering::SeqCst); assert!(ptr != 0); - unsafe { SignalToken::cast_from_uint(ptr) } + unsafe { SignalToken::cast_from_usize(ptr) } } // Decrements the count on the channel for a sleeper, returning the sleeper @@ -154,7 +154,7 @@ impl<T: Send> Packet<T> { // steals into account. fn decrement(&mut self, token: SignalToken) -> Result<(), SignalToken> { assert_eq!(self.to_wake.load(Ordering::SeqCst), 0); - let ptr = unsafe { token.cast_to_uint() }; + let ptr = unsafe { token.cast_to_usize() }; self.to_wake.store(ptr, Ordering::SeqCst); let steals = self.steals; @@ -171,7 +171,7 @@ impl<T: Send> Packet<T> { } self.to_wake.store(0, Ordering::SeqCst); - Err(unsafe { SignalToken::cast_from_uint(ptr) }) + Err(unsafe { SignalToken::cast_from_usize(ptr) }) } pub fn recv(&mut self) -> Result<T, Failure<T>> { @@ -350,7 +350,7 @@ impl<T: Send> Packet<T> { } // increment the count on the channel (used for selection) - fn bump(&mut self, amt: int) -> int { + fn bump(&mut self, amt: isize) -> isize { match self.cnt.fetch_add(amt, Ordering::SeqCst) { DISCONNECTED => { self.cnt.store(DISCONNECTED, Ordering::SeqCst); diff --git a/src/libstd/sync/mpsc/sync.rs b/src/libstd/sync/mpsc/sync.rs index 36b50b0d4af..33c1614e1b2 100644 --- a/src/libstd/sync/mpsc/sync.rs +++ b/src/libstd/sync/mpsc/sync.rs @@ -64,7 +64,7 @@ struct State<T> { queue: Queue, // queue of senders waiting to send data blocker: Blocker, // currently blocked task on this channel buf: Buffer<T>, // storage for buffered messages - cap: uint, // capacity of this channel + cap: usize, // capacity of this channel /// A curious flag used to indicate whether a sender failed or succeeded in /// blocking. This is used to transmit information back to the task that it @@ -101,8 +101,8 @@ unsafe impl Send for Node {} /// A simple ring-buffer struct Buffer<T> { buf: Vec<Option<T>>, - start: uint, - size: uint, + start: usize, + size: usize, } #[derive(Debug)] @@ -137,7 +137,7 @@ fn wakeup<T>(token: SignalToken, guard: MutexGuard<State<T>>) { } impl<T: Send> Packet<T> { - pub fn new(cap: uint) -> Packet<T> { + pub fn new(cap: usize) -> Packet<T> { Packet { channels: AtomicUsize::new(1), lock: Mutex::new(State { @@ -442,8 +442,8 @@ impl<T> Buffer<T> { result.take().unwrap() } - fn size(&self) -> uint { self.size } - fn cap(&self) -> uint { self.buf.len() } + fn size(&self) -> usize { self.size } + fn cap(&self) -> usize { self.buf.len() } } //////////////////////////////////////////////////////////////////////////////// diff --git a/src/libstd/sync/mutex.rs b/src/libstd/sync/mutex.rs index b71cc0c2653..02b2db572ec 100644 --- a/src/libstd/sync/mutex.rs +++ b/src/libstd/sync/mutex.rs @@ -50,7 +50,7 @@ use sys_common::mutex as sys; /// use std::thread; /// use std::sync::mpsc::channel; /// -/// const N: uint = 10; +/// const N: usize = 10; /// /// // Spawn a few threads to increment a shared variable (non-atomically), and /// // let the main thread know once all increments are done. @@ -377,9 +377,9 @@ mod test { #[test] fn lots_and_lots() { static M: StaticMutex = MUTEX_INIT; - static mut CNT: uint = 0; - static J: uint = 1000; - static K: uint = 3; + static mut CNT: u32 = 0; + static J: u32 = 1000; + static K: u32 = 3; fn inc() { for _ in 0..J { @@ -501,7 +501,7 @@ mod test { let arc2 = arc.clone(); let _ = thread::spawn(move|| -> () { struct Unwinder { - i: Arc<Mutex<int>>, + i: Arc<Mutex<i32>>, } impl Drop for Unwinder { fn drop(&mut self) { diff --git a/src/libstd/sync/rwlock.rs b/src/libstd/sync/rwlock.rs index 6fd2a6ed77d..495a172e245 100644 --- a/src/libstd/sync/rwlock.rs +++ b/src/libstd/sync/rwlock.rs @@ -425,8 +425,8 @@ mod tests { #[test] fn frob() { static R: StaticRwLock = RW_LOCK_INIT; - static N: usize = 10; - static M: usize = 1000; + static N: u32 = 10; + static M: u32 = 1000; let (tx, rx) = channel::<()>(); for _ in 0..N { diff --git a/src/libstd/sync/task_pool.rs b/src/libstd/sync/task_pool.rs index a45048be24c..738aeccbe7a 100644 --- a/src/libstd/sync/task_pool.rs +++ b/src/libstd/sync/task_pool.rs @@ -89,7 +89,7 @@ impl TaskPool { /// # Panics /// /// This function will panic if `threads` is 0. - pub fn new(threads: uint) -> TaskPool { + pub fn new(threads: usize) -> TaskPool { assert!(threads >= 1); let (tx, rx) = channel::<Thunk>(); @@ -142,7 +142,7 @@ mod test { use super::*; use sync::mpsc::channel; - const TEST_TASKS: uint = 4; + const TEST_TASKS: u32 = 4; #[test] fn test_works() { |
