diff options
| author | bors <bors@rust-lang.org> | 2014-05-03 10:56:57 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-05-03 10:56:57 -0700 |
| commit | 0c691df8acaf10aa3721476e5d7fafcee11b0aaa (patch) | |
| tree | 7aca9144c64039fea0aff444e13870b4be40fae7 /src/libnative | |
| parent | bca9647cd34c78a1c7c2409fbb2c31cb2c8194d7 (diff) | |
| parent | a5be12ce7e88c1d28de1c98215991127d1e765f0 (diff) | |
| download | rust-0c691df8acaf10aa3721476e5d7fafcee11b0aaa.tar.gz rust-0c691df8acaf10aa3721476e5d7fafcee11b0aaa.zip | |
auto merge of #13773 : brson/rust/boxxy, r=alexcrichton
`box` is the way you allocate in future-rust.
Diffstat (limited to 'src/libnative')
| -rw-r--r-- | src/libnative/io/file_unix.rs | 2 | ||||
| -rw-r--r-- | src/libnative/io/file_win32.rs | 2 | ||||
| -rw-r--r-- | src/libnative/io/mod.rs | 24 | ||||
| -rw-r--r-- | src/libnative/io/net.rs | 8 | ||||
| -rw-r--r-- | src/libnative/io/pipe_unix.rs | 6 | ||||
| -rw-r--r-- | src/libnative/io/pipe_win32.rs | 6 | ||||
| -rw-r--r-- | src/libnative/io/timer_helper.rs | 2 | ||||
| -rw-r--r-- | src/libnative/io/timer_unix.rs | 2 | ||||
| -rw-r--r-- | src/libnative/task.rs | 6 |
9 files changed, 29 insertions, 29 deletions
diff --git a/src/libnative/io/file_unix.rs b/src/libnative/io/file_unix.rs index d97a0430fea..7c19eb54326 100644 --- a/src/libnative/io/file_unix.rs +++ b/src/libnative/io/file_unix.rs @@ -176,7 +176,7 @@ impl rtio::RtioPipe for FileDesc { self.inner_write(buf) } fn clone(&self) -> ~rtio::RtioPipe:Send { - ~FileDesc { inner: self.inner.clone() } as ~rtio::RtioPipe:Send + box FileDesc { inner: self.inner.clone() } as ~rtio::RtioPipe:Send } } diff --git a/src/libnative/io/file_win32.rs b/src/libnative/io/file_win32.rs index de515659bf7..6a6fb31d3e3 100644 --- a/src/libnative/io/file_win32.rs +++ b/src/libnative/io/file_win32.rs @@ -207,7 +207,7 @@ impl rtio::RtioPipe for FileDesc { self.inner_write(buf) } fn clone(&self) -> ~rtio::RtioPipe:Send { - ~FileDesc { inner: self.inner.clone() } as ~rtio::RtioPipe:Send + box FileDesc { inner: self.inner.clone() } as ~rtio::RtioPipe:Send } } diff --git a/src/libnative/io/mod.rs b/src/libnative/io/mod.rs index 944766e8fd0..fb92d0d55cf 100644 --- a/src/libnative/io/mod.rs +++ b/src/libnative/io/mod.rs @@ -167,20 +167,20 @@ impl rtio::IoFactory for IoFactory { // networking fn tcp_connect(&mut self, addr: SocketAddr, timeout: Option<u64>) -> IoResult<~RtioTcpStream:Send> { - net::TcpStream::connect(addr, timeout).map(|s| ~s as ~RtioTcpStream:Send) + net::TcpStream::connect(addr, timeout).map(|s| box s as ~RtioTcpStream:Send) } fn tcp_bind(&mut self, addr: SocketAddr) -> IoResult<~RtioTcpListener:Send> { - net::TcpListener::bind(addr).map(|s| ~s as ~RtioTcpListener:Send) + net::TcpListener::bind(addr).map(|s| box s as ~RtioTcpListener:Send) } fn udp_bind(&mut self, addr: SocketAddr) -> IoResult<~RtioUdpSocket:Send> { - net::UdpSocket::bind(addr).map(|u| ~u as ~RtioUdpSocket:Send) + net::UdpSocket::bind(addr).map(|u| box u as ~RtioUdpSocket:Send) } fn unix_bind(&mut self, path: &CString) -> IoResult<~RtioUnixListener:Send> { - pipe::UnixListener::bind(path).map(|s| ~s as ~RtioUnixListener:Send) + pipe::UnixListener::bind(path).map(|s| box s as ~RtioUnixListener:Send) } fn unix_connect(&mut self, path: &CString, timeout: Option<u64>) -> IoResult<~RtioPipe:Send> { - pipe::UnixStream::connect(path, timeout).map(|s| ~s as ~RtioPipe:Send) + pipe::UnixStream::connect(path, timeout).map(|s| box s as ~RtioPipe:Send) } fn get_host_addresses(&mut self, host: Option<&str>, servname: Option<&str>, hint: Option<ai::Hint>) -> IoResult<~[ai::Info]> { @@ -194,11 +194,11 @@ impl rtio::IoFactory for IoFactory { rtio::CloseSynchronously | rtio::CloseAsynchronously => true, rtio::DontClose => false }; - ~file::FileDesc::new(fd, close) as ~RtioFileStream:Send + box file::FileDesc::new(fd, close) as ~RtioFileStream:Send } fn fs_open(&mut self, path: &CString, fm: io::FileMode, fa: io::FileAccess) -> IoResult<~RtioFileStream:Send> { - file::open(path, fm, fa).map(|fd| ~fd as ~RtioFileStream:Send) + file::open(path, fm, fa).map(|fd| box fd as ~RtioFileStream:Send) } fn fs_unlink(&mut self, path: &CString) -> IoResult<()> { file::unlink(path) @@ -245,26 +245,26 @@ impl rtio::IoFactory for IoFactory { // misc fn timer_init(&mut self) -> IoResult<~RtioTimer:Send> { - timer::Timer::new().map(|t| ~t as ~RtioTimer:Send) + timer::Timer::new().map(|t| box t as ~RtioTimer:Send) } fn spawn(&mut self, config: ProcessConfig) -> IoResult<(~RtioProcess:Send, ~[Option<~RtioPipe:Send>])> { process::Process::spawn(config).map(|(p, io)| { - (~p as ~RtioProcess:Send, - io.move_iter().map(|p| p.map(|p| ~p as ~RtioPipe:Send)).collect()) + (box p as ~RtioProcess:Send, + io.move_iter().map(|p| p.map(|p| box p as ~RtioPipe:Send)).collect()) }) } fn kill(&mut self, pid: libc::pid_t, signum: int) -> IoResult<()> { process::Process::kill(pid, signum) } fn pipe_open(&mut self, fd: c_int) -> IoResult<~RtioPipe:Send> { - Ok(~file::FileDesc::new(fd, true) as ~RtioPipe:Send) + Ok(box file::FileDesc::new(fd, true) as ~RtioPipe:Send) } fn tty_open(&mut self, fd: c_int, _readable: bool) -> IoResult<~RtioTTY:Send> { if unsafe { libc::isatty(fd) } != 0 { - Ok(~file::FileDesc::new(fd, true) as ~RtioTTY:Send) + Ok(box file::FileDesc::new(fd, true) as ~RtioTTY:Send) } else { Err(IoError { kind: io::MismatchedFileTypeForOperation, diff --git a/src/libnative/io/net.rs b/src/libnative/io/net.rs index cc41da846b2..c47e549b20a 100644 --- a/src/libnative/io/net.rs +++ b/src/libnative/io/net.rs @@ -352,7 +352,7 @@ impl rtio::RtioTcpStream for TcpStream { } fn clone(&self) -> ~rtio::RtioTcpStream:Send { - ~TcpStream { inner: self.inner.clone() } as ~rtio::RtioTcpStream:Send + box TcpStream { inner: self.inner.clone() } as ~rtio::RtioTcpStream:Send } fn close_write(&mut self) -> IoResult<()> { super::mkerr_libc(unsafe { @@ -419,7 +419,7 @@ impl TcpListener { impl rtio::RtioTcpListener for TcpListener { fn listen(~self) -> IoResult<~rtio::RtioTcpAcceptor:Send> { - self.native_listen(128).map(|a| ~a as ~rtio::RtioTcpAcceptor:Send) + self.native_listen(128).map(|a| box a as ~rtio::RtioTcpAcceptor:Send) } } @@ -466,7 +466,7 @@ impl rtio::RtioSocket for TcpAcceptor { impl rtio::RtioTcpAcceptor for TcpAcceptor { fn accept(&mut self) -> IoResult<~rtio::RtioTcpStream:Send> { - self.native_accept().map(|s| ~s as ~rtio::RtioTcpStream:Send) + self.native_accept().map(|s| box s as ~rtio::RtioTcpStream:Send) } fn accept_simultaneously(&mut self) -> IoResult<()> { Ok(()) } @@ -638,6 +638,6 @@ impl rtio::RtioUdpSocket for UdpSocket { } fn clone(&self) -> ~rtio::RtioUdpSocket:Send { - ~UdpSocket { inner: self.inner.clone() } as ~rtio::RtioUdpSocket:Send + box UdpSocket { inner: self.inner.clone() } as ~rtio::RtioUdpSocket:Send } } diff --git a/src/libnative/io/pipe_unix.rs b/src/libnative/io/pipe_unix.rs index 190cae05d43..178247f3190 100644 --- a/src/libnative/io/pipe_unix.rs +++ b/src/libnative/io/pipe_unix.rs @@ -145,7 +145,7 @@ impl rtio::RtioPipe for UnixStream { } fn clone(&self) -> ~rtio::RtioPipe:Send { - ~UnixStream { inner: self.inner.clone() } as ~rtio::RtioPipe:Send + box UnixStream { inner: self.inner.clone() } as ~rtio::RtioPipe:Send } } @@ -177,7 +177,7 @@ impl UnixListener { impl rtio::RtioUnixListener for UnixListener { fn listen(~self) -> IoResult<~rtio::RtioUnixAcceptor:Send> { - self.native_listen(128).map(|a| ~a as ~rtio::RtioUnixAcceptor:Send) + self.native_listen(128).map(|a| box a as ~rtio::RtioUnixAcceptor:Send) } } @@ -210,7 +210,7 @@ impl UnixAcceptor { impl rtio::RtioUnixAcceptor for UnixAcceptor { fn accept(&mut self) -> IoResult<~rtio::RtioPipe:Send> { - self.native_accept().map(|s| ~s as ~rtio::RtioPipe:Send) + self.native_accept().map(|s| box s as ~rtio::RtioPipe:Send) } fn set_timeout(&mut self, timeout: Option<u64>) { self.deadline = timeout.map(|a| ::io::timer::now() + a).unwrap_or(0); diff --git a/src/libnative/io/pipe_win32.rs b/src/libnative/io/pipe_win32.rs index a4f09ded0ac..bf7f82ef662 100644 --- a/src/libnative/io/pipe_win32.rs +++ b/src/libnative/io/pipe_win32.rs @@ -354,7 +354,7 @@ impl rtio::RtioPipe for UnixStream { } fn clone(&self) -> ~rtio::RtioPipe:Send { - ~UnixStream { + box UnixStream { inner: self.inner.clone(), read: None, write: None, @@ -403,7 +403,7 @@ impl Drop for UnixListener { impl rtio::RtioUnixListener for UnixListener { fn listen(~self) -> IoResult<~rtio::RtioUnixAcceptor:Send> { - self.native_listen().map(|a| ~a as ~rtio::RtioUnixAcceptor:Send) + self.native_listen().map(|a| box a as ~rtio::RtioUnixAcceptor:Send) } } @@ -527,7 +527,7 @@ impl UnixAcceptor { impl rtio::RtioUnixAcceptor for UnixAcceptor { fn accept(&mut self) -> IoResult<~rtio::RtioPipe:Send> { - self.native_accept().map(|s| ~s as ~rtio::RtioPipe:Send) + self.native_accept().map(|s| box s as ~rtio::RtioPipe:Send) } fn set_timeout(&mut self, timeout: Option<u64>) { self.deadline = timeout.map(|i| i + ::io::timer::now()).unwrap_or(0); diff --git a/src/libnative/io/timer_helper.rs b/src/libnative/io/timer_helper.rs index 4b29feab84f..298dd2f368d 100644 --- a/src/libnative/io/timer_helper.rs +++ b/src/libnative/io/timer_helper.rs @@ -48,7 +48,7 @@ pub fn boot(helper: fn(imp::signal, Receiver<Req>)) { let (tx, rx) = channel(); // promote this to a shared channel drop(tx.clone()); - HELPER_CHAN = cast::transmute(~tx); + HELPER_CHAN = cast::transmute(box tx); let (receive, send) = imp::new(); HELPER_SIGNAL = send; diff --git a/src/libnative/io/timer_unix.rs b/src/libnative/io/timer_unix.rs index e5d4a6bb02b..8435c05c771 100644 --- a/src/libnative/io/timer_unix.rs +++ b/src/libnative/io/timer_unix.rs @@ -207,7 +207,7 @@ impl Timer { let id = unsafe { ID.fetch_add(1, atomics::Relaxed) }; Ok(Timer { id: id, - inner: Some(~Inner { + inner: Some(box Inner { tx: None, interval: 0, target: 0, diff --git a/src/libnative/task.rs b/src/libnative/task.rs index 8a82ae55faa..512080e4204 100644 --- a/src/libnative/task.rs +++ b/src/libnative/task.rs @@ -32,7 +32,7 @@ use task; /// Creates a new Task which is ready to execute as a 1:1 task. pub fn new(stack_bounds: (uint, uint)) -> ~Task { - let mut task = ~Task::new(); + let mut task = box Task::new(); let mut ops = ops(); ops.stack_bounds = stack_bounds; task.put_runtime(ops); @@ -40,7 +40,7 @@ pub fn new(stack_bounds: (uint, uint)) -> ~Task { } fn ops() -> ~Ops { - ~Ops { + box Ops { lock: unsafe { NativeMutex::new() }, awoken: false, io: io::IoFactory::new(), @@ -62,7 +62,7 @@ pub fn spawn_opts(opts: TaskOpts, f: proc():Send) { stderr, stdout, } = opts; - let mut task = ~Task::new(); + let mut task = box Task::new(); task.name = name; task.stderr = stderr; task.stdout = stdout; |
