diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2014-06-27 12:30:25 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2014-06-29 11:47:58 -0700 |
| commit | a5bb0a3a4574af88add700ace7aefc37172fa7a5 (patch) | |
| tree | 5c2505254a2fdc396d600807b071c00b064c18b7 /src/libsync | |
| parent | bd9563aa382ccfbda36049786329edcdc609930c (diff) | |
| download | rust-a5bb0a3a4574af88add700ace7aefc37172fa7a5.tar.gz rust-a5bb0a3a4574af88add700ace7aefc37172fa7a5.zip | |
librustc: Remove the fallback to `int` for integers and `f64` for
floating point numbers for real.
This will break code that looks like:
let mut x = 0;
while ... {
x += 1;
}
println!("{}", x);
Change that code to:
let mut x = 0i;
while ... {
x += 1;
}
println!("{}", x);
Closes #15201.
[breaking-change]
Diffstat (limited to 'src/libsync')
| -rw-r--r-- | src/libsync/atomics.rs | 4 | ||||
| -rw-r--r-- | src/libsync/comm/duplex.rs | 2 | ||||
| -rw-r--r-- | src/libsync/comm/mod.rs | 4 | ||||
| -rw-r--r-- | src/libsync/deque.rs | 6 | ||||
| -rw-r--r-- | src/libsync/lock.rs | 4 | ||||
| -rw-r--r-- | src/libsync/mpsc_queue.rs | 4 | ||||
| -rw-r--r-- | src/libsync/spsc_queue.rs | 6 |
7 files changed, 15 insertions, 15 deletions
diff --git a/src/libsync/atomics.rs b/src/libsync/atomics.rs index 8ce17b9bf3b..195efb844a7 100644 --- a/src/libsync/atomics.rs +++ b/src/libsync/atomics.rs @@ -143,7 +143,7 @@ impl<T> AtomicOption<T> { /// Remove the value, leaving the `AtomicOption` empty. #[inline] pub fn take(&self, order: Ordering) -> Option<Box<T>> { - unsafe { self.swap(mem::transmute(0), order) } + unsafe { self.swap(mem::transmute(0u), order) } } /// Replace an empty value with a non-empty value. @@ -155,7 +155,7 @@ impl<T> AtomicOption<T> { pub fn fill(&self, val: Box<T>, order: Ordering) -> Option<Box<T>> { unsafe { let val = mem::transmute(val); - let expected = mem::transmute(0); + let expected = mem::transmute(0u); let oldval = self.p.compare_and_swap(expected, val, order); if oldval == expected { None diff --git a/src/libsync/comm/duplex.rs b/src/libsync/comm/duplex.rs index 3840e55bb42..4ab2ac97cc1 100644 --- a/src/libsync/comm/duplex.rs +++ b/src/libsync/comm/duplex.rs @@ -64,7 +64,7 @@ mod test { let (left, right) = duplex(); left.send("abc".to_string()); - right.send(123); + right.send(123i); assert!(left.recv() == 123); assert!(right.recv() == "abc".to_string()); diff --git a/src/libsync/comm/mod.rs b/src/libsync/comm/mod.rs index 3e8f4eef370..665f94d80b2 100644 --- a/src/libsync/comm/mod.rs +++ b/src/libsync/comm/mod.rs @@ -1543,7 +1543,7 @@ mod test { let (tx, rx) = channel(); let (cdone, pdone) = channel(); let t = Thread::start(proc() { - let mut hits = 0; + let mut hits = 0u; while hits < 10 { match rx.try_recv() { Ok(()) => { hits += 1; } @@ -1993,7 +1993,7 @@ mod sync_tests { let (tx, rx) = sync_channel::<()>(0); let (cdone, pdone) = channel(); let t = Thread::start(proc() { - let mut hits = 0; + let mut hits = 0u; while hits < 10 { match rx.try_recv() { Ok(()) => { hits += 1; } diff --git a/src/libsync/deque.rs b/src/libsync/deque.rs index cdd030ac34a..8d2192aeb53 100644 --- a/src/libsync/deque.rs +++ b/src/libsync/deque.rs @@ -30,15 +30,15 @@ //! let (mut worker, mut stealer) = pool.deque(); //! //! // Only the worker may push/pop -//! worker.push(1); +//! worker.push(1i); //! worker.pop(); //! //! // Stealers take data from the other end of the deque -//! worker.push(1); +//! worker.push(1i); //! stealer.steal(); //! //! // Stealers can be cloned to have many stealers stealing in parallel -//! worker.push(1); +//! worker.push(1i); //! let mut stealer2 = stealer.clone(); //! stealer2.steal(); diff --git a/src/libsync/lock.rs b/src/libsync/lock.rs index dff9fee2b77..1d119bafea1 100644 --- a/src/libsync/lock.rs +++ b/src/libsync/lock.rs @@ -158,7 +158,7 @@ impl<'a> Condvar<'a> { /// ``` /// use sync::{Mutex, Arc}; /// -/// let mutex = Arc::new(Mutex::new(1)); +/// let mutex = Arc::new(Mutex::new(1i)); /// let mutex2 = mutex.clone(); /// /// spawn(proc() { @@ -487,7 +487,7 @@ mod tests { #[test] #[should_fail] fn test_arc_condvar_poison() { - let arc = Arc::new(Mutex::new(1)); + let arc = Arc::new(Mutex::new(1i)); let arc2 = arc.clone(); let (tx, rx) = channel(); diff --git a/src/libsync/mpsc_queue.rs b/src/libsync/mpsc_queue.rs index 4bb0acf580c..ecd37e68880 100644 --- a/src/libsync/mpsc_queue.rs +++ b/src/libsync/mpsc_queue.rs @@ -167,8 +167,8 @@ mod tests { #[test] fn test_full() { let q = Queue::new(); - q.push(box 1); - q.push(box 2); + q.push(box 1i); + q.push(box 2i); } #[test] diff --git a/src/libsync/spsc_queue.rs b/src/libsync/spsc_queue.rs index a4da1fd2335..2834d404c18 100644 --- a/src/libsync/spsc_queue.rs +++ b/src/libsync/spsc_queue.rs @@ -252,8 +252,8 @@ mod test { #[test] fn drop_full() { let q = Queue::new(0); - q.push(box 1); - q.push(box 2); + q.push(box 1i); + q.push(box 2i); } #[test] @@ -284,7 +284,7 @@ mod test { for _ in range(0u, 100000) { loop { match b.pop() { - Some(1) => break, + Some(1i) => break, Some(_) => fail!(), None => {} } |
