about summary refs log tree commit diff
path: root/src/libsync
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-10-14 23:05:01 -0700
committerAlex Crichton <alex@alexcrichton.com>2014-10-19 12:59:40 -0700
commit9d5d97b55d6487ee23b805bc1acbaa0669b82116 (patch)
treeb72dcf7045e331e94ea0f8658d088ab42d917935 /src/libsync
parentfb169d5543c84e11038ba2d07b538ec88fb49ca6 (diff)
downloadrust-9d5d97b55d6487ee23b805bc1acbaa0669b82116.tar.gz
rust-9d5d97b55d6487ee23b805bc1acbaa0669b82116.zip
Remove a large amount of deprecated functionality
Spring cleaning is here! In the Fall! This commit removes quite a large amount
of deprecated functionality from the standard libraries. I tried to ensure that
only old deprecated functionality was removed.

This is removing lots and lots of deprecated features, so this is a breaking
change. Please consult the deprecation messages of the deleted code to see how
to migrate code forward if it still needs migration.

[breaking-change]
Diffstat (limited to 'src/libsync')
-rw-r--r--src/libsync/comm/duplex.rs78
-rw-r--r--src/libsync/comm/mod.rs13
-rw-r--r--src/libsync/mpmc_bounded_queue.rs5
-rw-r--r--src/libsync/mpsc_queue.rs3
-rw-r--r--src/libsync/mutex.rs3
-rw-r--r--src/libsync/spsc_queue.rs4
6 files changed, 10 insertions, 96 deletions
diff --git a/src/libsync/comm/duplex.rs b/src/libsync/comm/duplex.rs
deleted file mode 100644
index 1dc1f4b87f2..00000000000
--- a/src/libsync/comm/duplex.rs
+++ /dev/null
@@ -1,78 +0,0 @@
-// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-/*!
-
-Higher level communication abstractions.
-
-*/
-
-#![allow(missing_doc)]
-#![allow(deprecated)]
-#![deprecated = "This type is replaced by having a pair of channels. This type \
-                 is not fully composable with other channels in terms of \
-                 or possible semantics on a duplex stream. It will be removed \
-                 soon"]
-
-use core::prelude::*;
-
-use comm;
-use comm::{Sender, Receiver, channel};
-
-/// An extension of `pipes::stream` that allows both sending and receiving.
-pub struct DuplexStream<S, R> {
-    tx: Sender<S>,
-    rx: Receiver<R>,
-}
-
-/// Creates a bidirectional stream.
-pub fn duplex<S: Send, R: Send>() -> (DuplexStream<S, R>, DuplexStream<R, S>) {
-    let (tx1, rx1) = channel();
-    let (tx2, rx2) = channel();
-    (DuplexStream { tx: tx1, rx: rx2 },
-     DuplexStream { tx: tx2, rx: rx1 })
-}
-
-// Allow these methods to be used without import:
-impl<S:Send,R:Send> DuplexStream<S, R> {
-    pub fn send(&self, x: S) {
-        self.tx.send(x)
-    }
-    pub fn send_opt(&self, x: S) -> Result<(), S> {
-        self.tx.send_opt(x)
-    }
-    pub fn recv(&self) -> R {
-        self.rx.recv()
-    }
-    pub fn try_recv(&self) -> Result<R, comm::TryRecvError> {
-        self.rx.try_recv()
-    }
-    pub fn recv_opt(&self) -> Result<R, ()> {
-        self.rx.recv_opt()
-    }
-}
-
-#[allow(deprecated)]
-#[cfg(test)]
-mod test {
-    use std::prelude::*;
-    use comm::duplex;
-
-    #[test]
-    pub fn duplex_stream_1() {
-        let (left, right) = duplex();
-
-        left.send("abc".to_string());
-        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 4e66dd69a60..ddfd1088a41 100644
--- a/src/libsync/comm/mod.rs
+++ b/src/libsync/comm/mod.rs
@@ -333,7 +333,6 @@ use rustrt::local::Local;
 use rustrt::task::{Task, BlockedTask};
 
 pub use comm::select::{Select, Handle};
-pub use comm::duplex::{DuplexStream, duplex};
 
 macro_rules! test (
     { fn $name:ident() $b:block $(#[$a:meta])*} => (
@@ -354,14 +353,13 @@ macro_rules! test (
             $(#[$a])* #[test] fn native() {
                 use native;
                 let (tx, rx) = channel();
-                native::task::spawn(proc() { tx.send(f()) });
+                spawn(proc() { tx.send(f()) });
                 rx.recv();
             }
         }
     )
 )
 
-mod duplex;
 mod oneshot;
 mod select;
 mod shared;
@@ -1064,7 +1062,6 @@ impl<T: Send> Drop for Receiver<T> {
 mod test {
     use std::prelude::*;
 
-    use native;
     use std::os;
     use super::*;
 
@@ -1224,7 +1221,7 @@ mod test {
             tx3.send(());
         });
         rx1.recv();
-        native::task::spawn(proc() {
+        spawn(proc() {
             for _ in range(0i, 40) {
                 tx2.send(1);
             }
@@ -1238,7 +1235,7 @@ mod test {
     fn recv_from_outside_runtime() {
         let (tx, rx) = channel::<int>();
         let (dtx, drx) = channel();
-        native::task::spawn(proc() {
+        spawn(proc() {
             for _ in range(0i, 40) {
                 assert_eq!(rx.recv(), 1);
             }
@@ -1256,12 +1253,12 @@ mod test {
         let (tx2, rx2) = channel::<int>();
         let (tx3, rx3) = channel::<()>();
         let tx4 = tx3.clone();
-        native::task::spawn(proc() {
+        spawn(proc() {
             assert_eq!(rx1.recv(), 1);
             tx2.send(2);
             tx4.send(());
         });
-        native::task::spawn(proc() {
+        spawn(proc() {
             tx1.send(1);
             assert_eq!(rx2.recv(), 2);
             tx3.send(());
diff --git a/src/libsync/mpmc_bounded_queue.rs b/src/libsync/mpmc_bounded_queue.rs
index fa29bb6088a..b3b504f49ca 100644
--- a/src/libsync/mpmc_bounded_queue.rs
+++ b/src/libsync/mpmc_bounded_queue.rs
@@ -167,7 +167,6 @@ impl<T: Send> Clone for Queue<T> {
 mod tests {
     use std::prelude::*;
     use super::Queue;
-    use native;
 
     #[test]
     fn test() {
@@ -180,7 +179,7 @@ mod tests {
         for _ in range(0, nthreads) {
             let q = q.clone();
             let tx = tx.clone();
-            native::task::spawn(proc() {
+            spawn(proc() {
                 let q = q;
                 for i in range(0, nmsgs) {
                     assert!(q.push(i));
@@ -194,7 +193,7 @@ mod tests {
             let (tx, rx) = channel();
             completion_rxs.push(rx);
             let q = q.clone();
-            native::task::spawn(proc() {
+            spawn(proc() {
                 let q = q;
                 let mut i = 0u;
                 loop {
diff --git a/src/libsync/mpsc_queue.rs b/src/libsync/mpsc_queue.rs
index ad2539fc260..ac2acf3d7d4 100644
--- a/src/libsync/mpsc_queue.rs
+++ b/src/libsync/mpsc_queue.rs
@@ -161,7 +161,6 @@ mod tests {
 
     use alloc::arc::Arc;
 
-    use native;
     use super::{Queue, Data, Empty, Inconsistent};
 
     #[test]
@@ -186,7 +185,7 @@ mod tests {
         for _ in range(0, nthreads) {
             let tx = tx.clone();
             let q = q.clone();
-            native::task::spawn(proc() {
+            spawn(proc() {
                 for i in range(0, nmsgs) {
                     q.push(i);
                 }
diff --git a/src/libsync/mutex.rs b/src/libsync/mutex.rs
index 796c62354c3..7d191eab2d1 100644
--- a/src/libsync/mutex.rs
+++ b/src/libsync/mutex.rs
@@ -525,7 +525,6 @@ impl Drop for Mutex {
 mod test {
     use std::prelude::*;
     use super::{Mutex, StaticMutex, MUTEX_INIT};
-    use native;
 
     #[test]
     fn smoke() {
@@ -563,7 +562,7 @@ mod test {
         let (tx, rx) = channel();
         for _ in range(0, K) {
             let tx2 = tx.clone();
-            native::task::spawn(proc() { inc(); tx2.send(()); });
+            spawn(proc() { inc(); tx2.send(()); });
             let tx2 = tx.clone();
             spawn(proc() { inc(); tx2.send(()); });
         }
diff --git a/src/libsync/spsc_queue.rs b/src/libsync/spsc_queue.rs
index cb4d33049d8..9cd64d46bad 100644
--- a/src/libsync/spsc_queue.rs
+++ b/src/libsync/spsc_queue.rs
@@ -296,8 +296,6 @@ impl<T: Send> Drop for Queue<T> {
 mod test {
     use std::prelude::*;
 
-    use native;
-
     use super::{queue};
 
     #[test]
@@ -364,7 +362,7 @@ mod test {
             let (consumer, mut producer) = queue(bound);
 
             let (tx, rx) = channel();
-            native::task::spawn(proc() {
+            spawn(proc() {
                 // Move the consumer to a local mutable slot
                 let mut consumer = consumer;
                 for _ in range(0u, 100000) {