diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-03-08 18:21:49 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-03-27 10:14:50 -0700 |
| commit | bb9172d7b512c36f34d34b024640f030d1fde2eb (patch) | |
| tree | 0e4ea18ae30a12954db6b9fbe95f62222ade9301 /src/libstd/io | |
| parent | bdd24b2a56e8bf6b952bd8880364fb0a57c2c540 (diff) | |
| download | rust-bb9172d7b512c36f34d34b024640f030d1fde2eb.tar.gz rust-bb9172d7b512c36f34d34b024640f030d1fde2eb.zip | |
Fix fallout of removing default bounds
This is all purely fallout of getting the previous commit to compile.
Diffstat (limited to 'src/libstd/io')
| -rw-r--r-- | src/libstd/io/fs.rs | 3 | ||||
| -rw-r--r-- | src/libstd/io/net/tcp.rs | 11 | ||||
| -rw-r--r-- | src/libstd/io/net/udp.rs | 5 | ||||
| -rw-r--r-- | src/libstd/io/net/unix.rs | 13 | ||||
| -rw-r--r-- | src/libstd/io/pipe.rs | 4 | ||||
| -rw-r--r-- | src/libstd/io/process.rs | 2 | ||||
| -rw-r--r-- | src/libstd/io/stdio.rs | 21 | ||||
| -rw-r--r-- | src/libstd/io/timer.rs | 5 |
8 files changed, 36 insertions, 28 deletions
diff --git a/src/libstd/io/fs.rs b/src/libstd/io/fs.rs index e66aa8c0046..020f493e24b 100644 --- a/src/libstd/io/fs.rs +++ b/src/libstd/io/fs.rs @@ -53,6 +53,7 @@ use c_str::ToCStr; use clone::Clone; use container::Container; use iter::Iterator; +use kinds::Send; use super::{Reader, Writer, Seek}; use super::{SeekStyle, Read, Write, Open, IoError, Truncate, FileMode, FileAccess, FileStat, IoResult, FilePermission}; @@ -77,7 +78,7 @@ use vec::Vec; /// configured at creation time, via the `FileAccess` parameter to /// `File::open_mode()`. pub struct File { - priv fd: ~RtioFileStream, + priv fd: ~RtioFileStream:Send, priv path: Path, priv last_nread: int, } diff --git a/src/libstd/io/net/tcp.rs b/src/libstd/io/net/tcp.rs index 7b1dd114d34..e343fdcd325 100644 --- a/src/libstd/io/net/tcp.rs +++ b/src/libstd/io/net/tcp.rs @@ -20,9 +20,10 @@ #[deny(missing_doc)]; use clone::Clone; +use io::IoResult; use io::net::ip::SocketAddr; use io::{Reader, Writer, Listener, Acceptor}; -use io::IoResult; +use kinds::Send; use rt::rtio::{IoFactory, LocalIo, RtioSocket, RtioTcpListener}; use rt::rtio::{RtioTcpAcceptor, RtioTcpStream}; @@ -45,11 +46,11 @@ use rt::rtio::{RtioTcpAcceptor, RtioTcpStream}; /// drop(stream); // close the connection /// ``` pub struct TcpStream { - priv obj: ~RtioTcpStream + priv obj: ~RtioTcpStream:Send } impl TcpStream { - fn new(s: ~RtioTcpStream) -> TcpStream { + fn new(s: ~RtioTcpStream:Send) -> TcpStream { TcpStream { obj: s } } @@ -127,7 +128,7 @@ impl Writer for TcpStream { /// # } /// ``` pub struct TcpListener { - priv obj: ~RtioTcpListener + priv obj: ~RtioTcpListener:Send } impl TcpListener { @@ -160,7 +161,7 @@ impl Listener<TcpStream, TcpAcceptor> for TcpListener { /// a `TcpListener`'s `listen` method, and this object can be used to accept new /// `TcpStream` instances. pub struct TcpAcceptor { - priv obj: ~RtioTcpAcceptor + priv obj: ~RtioTcpAcceptor:Send } impl Acceptor<TcpStream> for TcpAcceptor { diff --git a/src/libstd/io/net/udp.rs b/src/libstd/io/net/udp.rs index 95241813257..8169fc1a917 100644 --- a/src/libstd/io/net/udp.rs +++ b/src/libstd/io/net/udp.rs @@ -16,9 +16,10 @@ //! datagram protocol. use clone::Clone; -use result::{Ok, Err}; use io::net::ip::SocketAddr; use io::{Reader, Writer, IoResult}; +use kinds::Send; +use result::{Ok, Err}; use rt::rtio::{RtioSocket, RtioUdpSocket, IoFactory, LocalIo}; /// A User Datagram Protocol socket. @@ -53,7 +54,7 @@ use rt::rtio::{RtioSocket, RtioUdpSocket, IoFactory, LocalIo}; /// drop(socket); // close the socket /// ``` pub struct UdpSocket { - priv obj: ~RtioUdpSocket + priv obj: ~RtioUdpSocket:Send } impl UdpSocket { diff --git a/src/libstd/io/net/unix.rs b/src/libstd/io/net/unix.rs index 9f04317a5c8..1a020f9a820 100644 --- a/src/libstd/io/net/unix.rs +++ b/src/libstd/io/net/unix.rs @@ -28,10 +28,11 @@ use prelude::*; use c_str::ToCStr; use clone::Clone; -use rt::rtio::{IoFactory, LocalIo, RtioUnixListener}; -use rt::rtio::{RtioUnixAcceptor, RtioPipe}; use io::pipe::PipeStream; use io::{Listener, Acceptor, Reader, Writer, IoResult}; +use kinds::Send; +use rt::rtio::{IoFactory, LocalIo, RtioUnixListener}; +use rt::rtio::{RtioUnixAcceptor, RtioPipe}; /// A stream which communicates over a named pipe. pub struct UnixStream { @@ -39,7 +40,7 @@ pub struct UnixStream { } impl UnixStream { - fn new(obj: ~RtioPipe) -> UnixStream { + fn new(obj: ~RtioPipe:Send) -> UnixStream { UnixStream { obj: PipeStream::new(obj) } } @@ -82,7 +83,7 @@ impl Writer for UnixStream { /// A value that can listen for incoming named pipe connection requests. pub struct UnixListener { /// The internal, opaque runtime Unix listener. - priv obj: ~RtioUnixListener, + priv obj: ~RtioUnixListener:Send, } impl UnixListener { @@ -124,7 +125,7 @@ impl Listener<UnixStream, UnixAcceptor> for UnixListener { /// A value that can accept named pipe connections, returned from `listen()`. pub struct UnixAcceptor { /// The internal, opaque runtime Unix acceptor. - priv obj: ~RtioUnixAcceptor, + priv obj: ~RtioUnixAcceptor:Send, } impl Acceptor<UnixStream> for UnixAcceptor { @@ -140,7 +141,7 @@ mod tests { use io::*; use io::test::*; - pub fn smalltest(server: proc(UnixStream), client: proc(UnixStream)) { + pub fn smalltest(server: proc:Send(UnixStream), client: proc:Send(UnixStream)) { let path1 = next_test_unix(); let path2 = path1.clone(); diff --git a/src/libstd/io/pipe.rs b/src/libstd/io/pipe.rs index 9984a3e5cdf..fbf79b19445 100644 --- a/src/libstd/io/pipe.rs +++ b/src/libstd/io/pipe.rs @@ -23,7 +23,7 @@ use rt::rtio::{RtioPipe, LocalIo}; /// A synchronous, in-memory pipe. pub struct PipeStream { /// The internal, opaque runtime pipe object. - priv obj: ~RtioPipe, + priv obj: ~RtioPipe:Send, } impl PipeStream { @@ -51,7 +51,7 @@ impl PipeStream { } #[doc(hidden)] - pub fn new(inner: ~RtioPipe) -> PipeStream { + pub fn new(inner: ~RtioPipe:Send) -> PipeStream { PipeStream { obj: inner } } } diff --git a/src/libstd/io/process.rs b/src/libstd/io/process.rs index de7b26d5ff4..2da79eba7bc 100644 --- a/src/libstd/io/process.rs +++ b/src/libstd/io/process.rs @@ -53,7 +53,7 @@ use rt::rtio::{RtioProcess, IoFactory, LocalIo}; /// assert!(child.wait().success()); /// ``` pub struct Process { - priv handle: ~RtioProcess, + priv handle: ~RtioProcess:Send, /// Handle to the child's stdin, if the `stdin` field of this process's /// `ProcessConfig` was `CreatePipe`. By default, this handle is `Some`. diff --git a/src/libstd/io/stdio.rs b/src/libstd/io/stdio.rs index 2f6cdcb5825..e52df042561 100644 --- a/src/libstd/io/stdio.rs +++ b/src/libstd/io/stdio.rs @@ -32,6 +32,7 @@ use fmt; use io::{Reader, Writer, IoResult, IoError, OtherIoError, standard_error, EndOfFile, LineBufferedWriter, BufferedReader}; use libc; +use kinds::Send; use mem::replace; use option::{Option, Some, None}; use prelude::drop; @@ -71,8 +72,8 @@ use slice::ImmutableVector; // tl;dr; TTY works on everything but when windows stdout is redirected, in that // case pipe also doesn't work, but magically file does! enum StdSource { - TTY(~RtioTTY), - File(~RtioFileStream), + TTY(~RtioTTY:Send), + File(~RtioFileStream:Send), } fn src<T>(fd: libc::c_int, readable: bool, f: |StdSource| -> T) -> T { @@ -145,8 +146,10 @@ pub fn stderr_raw() -> StdWriter { src(libc::STDERR_FILENO, false, |src| StdWriter { inner: src }) } -fn reset_helper(w: ~Writer, - f: |&mut Task, ~Writer| -> Option<~Writer>) -> Option<~Writer> { +fn reset_helper(w: ~Writer:Send, + f: |&mut Task, ~Writer:Send| -> Option<~Writer:Send>) + -> Option<~Writer:Send> +{ let mut t = Local::borrow(None::<Task>); // Be sure to flush any pending output from the writer match f(t.get(), w) { @@ -168,7 +171,7 @@ fn reset_helper(w: ~Writer, /// /// Note that this does not need to be called for all new tasks; the default /// output handle is to the process's stdout stream. -pub fn set_stdout(stdout: ~Writer) -> Option<~Writer> { +pub fn set_stdout(stdout: ~Writer:Send) -> Option<~Writer:Send> { reset_helper(stdout, |t, w| replace(&mut t.stdout, Some(w))) } @@ -180,7 +183,7 @@ pub fn set_stdout(stdout: ~Writer) -> Option<~Writer> { /// /// Note that this does not need to be called for all new tasks; the default /// output handle is to the process's stderr stream. -pub fn set_stderr(stderr: ~Writer) -> Option<~Writer> { +pub fn set_stderr(stderr: ~Writer:Send) -> Option<~Writer:Send> { reset_helper(stderr, |t, w| replace(&mut t.stderr, Some(w))) } @@ -206,7 +209,7 @@ fn with_task_stdout(f: |&mut Writer| -> IoResult<()> ) { Local::put(task); if my_stdout.is_none() { - my_stdout = Some(~stdout() as ~Writer); + my_stdout = Some(~stdout() as ~Writer:Send); } let ret = f(*my_stdout.get_mut_ref()); @@ -399,7 +402,7 @@ mod tests { let (tx, rx) = channel(); let (mut r, w) = (ChanReader::new(rx), ChanWriter::new(tx)); spawn(proc() { - set_stdout(~w as ~Writer); + set_stdout(~w); println!("hello!"); }); assert_eq!(r.read_to_str().unwrap(), ~"hello!\n"); @@ -411,7 +414,7 @@ mod tests { let (tx, rx) = channel(); let (mut r, w) = (ChanReader::new(rx), ChanWriter::new(tx)); spawn(proc() { - set_stderr(~w as ~Writer); + set_stderr(~w); fail!("my special message"); }); let s = r.read_to_str().unwrap(); diff --git a/src/libstd/io/timer.rs b/src/libstd/io/timer.rs index f64c36c611c..6840c418a9b 100644 --- a/src/libstd/io/timer.rs +++ b/src/libstd/io/timer.rs @@ -18,8 +18,9 @@ and create receivers which will receive notifications after a period of time. */ use comm::Receiver; -use rt::rtio::{IoFactory, LocalIo, RtioTimer}; use io::IoResult; +use kinds::Send; +use rt::rtio::{IoFactory, LocalIo, RtioTimer}; /// A synchronous timer object /// @@ -62,7 +63,7 @@ use io::IoResult; /// # } /// ``` pub struct Timer { - priv obj: ~RtioTimer + priv obj: ~RtioTimer:Send, } /// Sleep the current task for `msecs` milliseconds. |
