about summary refs log tree commit diff
path: root/src/libstd/rt
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstd/rt')
-rw-r--r--src/libstd/rt/at_exit_imp.rs5
-rw-r--r--src/libstd/rt/mod.rs5
-rw-r--r--src/libstd/rt/rtio.rs159
-rw-r--r--src/libstd/rt/task.rs15
-rw-r--r--src/libstd/rt/thread.rs16
-rw-r--r--src/libstd/rt/unwind.rs6
6 files changed, 107 insertions, 99 deletions
diff --git a/src/libstd/rt/at_exit_imp.rs b/src/libstd/rt/at_exit_imp.rs
index 96dcc5244c0..a5bfaf190d9 100644
--- a/src/libstd/rt/at_exit_imp.rs
+++ b/src/libstd/rt/at_exit_imp.rs
@@ -14,13 +14,14 @@
 
 use cast;
 use iter::Iterator;
+use kinds::Send;
 use mem;
 use option::{Some, None};
 use ptr::RawPtr;
 use unstable::sync::Exclusive;
 use slice::OwnedVector;
 
-type Queue = Exclusive<~[proc()]>;
+type Queue = Exclusive<~[proc:Send()]>;
 
 // You'll note that these variables are *not* atomic, and this is done on
 // purpose. This module is designed to have init() called *once* in a
@@ -39,7 +40,7 @@ pub fn init() {
     }
 }
 
-pub fn push(f: proc()) {
+pub fn push(f: proc:Send()) {
     unsafe {
         rtassert!(!RUNNING);
         rtassert!(!QUEUE.is_null());
diff --git a/src/libstd/rt/mod.rs b/src/libstd/rt/mod.rs
index 795281026a4..28f11f44054 100644
--- a/src/libstd/rt/mod.rs
+++ b/src/libstd/rt/mod.rs
@@ -55,6 +55,7 @@ Several modules in `core` are clients of `rt`:
 #[allow(missing_doc)];
 
 use any::Any;
+use kinds::Send;
 use option::Option;
 use result::Result;
 use task::TaskOpts;
@@ -156,7 +157,7 @@ pub trait Runtime {
 
     // Miscellaneous calls which are very different depending on what context
     // you're in.
-    fn spawn_sibling(~self, cur_task: ~Task, opts: TaskOpts, f: proc());
+    fn spawn_sibling(~self, cur_task: ~Task, opts: TaskOpts, f: proc:Send());
     fn local_io<'a>(&'a mut self) -> Option<rtio::LocalIo<'a>>;
     /// The (low, high) edges of the current stack.
     fn stack_bounds(&self) -> (uint, uint); // (lo, hi)
@@ -195,7 +196,7 @@ pub fn init(argc: int, argv: **u8) {
 ///
 /// It is forbidden for procedures to register more `at_exit` handlers when they
 /// are running, and doing so will lead to a process abort.
-pub fn at_exit(f: proc()) {
+pub fn at_exit(f: proc:Send()) {
     at_exit_imp::push(f);
 }
 
diff --git a/src/libstd/rt/rtio.rs b/src/libstd/rt/rtio.rs
index 60933aeb38b..5f0f0afd185 100644
--- a/src/libstd/rt/rtio.rs
+++ b/src/libstd/rt/rtio.rs
@@ -13,16 +13,17 @@ use cast;
 use comm::{Sender, Receiver};
 use libc::c_int;
 use libc;
+use kinds::Send;
 use ops::Drop;
 use option::{Option, Some, None};
 use path::Path;
-use result::{Result, Err};
-use rt::task::Task;
+use result::Err;
 use rt::local::Local;
+use rt::task::Task;
 
 use ai = io::net::addrinfo;
 use io;
-use io::{IoError, IoResult};
+use io::IoResult;
 use io::net::ip::{IpAddr, SocketAddr};
 use io::process::{ProcessConfig, ProcessExit};
 use io::signal::Signum;
@@ -35,9 +36,10 @@ pub trait Callback {
 
 pub trait EventLoop {
     fn run(&mut self);
-    fn callback(&mut self, proc());
-    fn pausable_idle_callback(&mut self, ~Callback) -> ~PausableIdleCallback;
-    fn remote_callback(&mut self, ~Callback) -> ~RemoteCallback;
+    fn callback(&mut self, arg: proc:Send());
+    fn pausable_idle_callback(&mut self,
+                              ~Callback:Send) -> ~PausableIdleCallback:Send;
+    fn remote_callback(&mut self, ~Callback:Send) -> ~RemoteCallback:Send;
 
     /// The asynchronous I/O services. Not all event loops may provide one.
     fn io<'a>(&'a mut self) -> Option<&'a mut IoFactory>;
@@ -143,93 +145,94 @@ impl<'a> LocalIo<'a> {
 
 pub trait IoFactory {
     // networking
-    fn tcp_connect(&mut self, addr: SocketAddr) -> Result<~RtioTcpStream, IoError>;
-    fn tcp_bind(&mut self, addr: SocketAddr) -> Result<~RtioTcpListener, IoError>;
-    fn udp_bind(&mut self, addr: SocketAddr) -> Result<~RtioUdpSocket, IoError>;
-    fn unix_bind(&mut self, path: &CString) ->
-        Result<~RtioUnixListener, IoError>;
-    fn unix_connect(&mut self, path: &CString) -> Result<~RtioPipe, IoError>;
+    fn tcp_connect(&mut self, addr: SocketAddr) -> IoResult<~RtioTcpStream:Send>;
+    fn tcp_bind(&mut self, addr: SocketAddr) -> IoResult<~RtioTcpListener:Send>;
+    fn udp_bind(&mut self, addr: SocketAddr) -> IoResult<~RtioUdpSocket:Send>;
+    fn unix_bind(&mut self, path: &CString)
+        -> IoResult<~RtioUnixListener:Send>;
+    fn unix_connect(&mut self, path: &CString) -> IoResult<~RtioPipe:Send>;
     fn get_host_addresses(&mut self, host: Option<&str>, servname: Option<&str>,
-                          hint: Option<ai::Hint>) -> Result<~[ai::Info], IoError>;
+                          hint: Option<ai::Hint>) -> IoResult<~[ai::Info]>;
 
     // filesystem operations
-    fn fs_from_raw_fd(&mut self, fd: c_int, close: CloseBehavior) -> ~RtioFileStream;
+    fn fs_from_raw_fd(&mut self, fd: c_int, close: CloseBehavior)
+        -> ~RtioFileStream:Send;
     fn fs_open(&mut self, path: &CString, fm: FileMode, fa: FileAccess)
-        -> Result<~RtioFileStream, IoError>;
-    fn fs_unlink(&mut self, path: &CString) -> Result<(), IoError>;
-    fn fs_stat(&mut self, path: &CString) -> Result<FileStat, IoError>;
+        -> IoResult<~RtioFileStream:Send>;
+    fn fs_unlink(&mut self, path: &CString) -> IoResult<()>;
+    fn fs_stat(&mut self, path: &CString) -> IoResult<FileStat>;
     fn fs_mkdir(&mut self, path: &CString,
-                mode: FilePermission) -> Result<(), IoError>;
+                mode: FilePermission) -> IoResult<()>;
     fn fs_chmod(&mut self, path: &CString,
-                mode: FilePermission) -> Result<(), IoError>;
-    fn fs_rmdir(&mut self, path: &CString) -> Result<(), IoError>;
-    fn fs_rename(&mut self, path: &CString, to: &CString) -> Result<(), IoError>;
+                mode: FilePermission) -> IoResult<()>;
+    fn fs_rmdir(&mut self, path: &CString) -> IoResult<()>;
+    fn fs_rename(&mut self, path: &CString, to: &CString) -> IoResult<()>;
     fn fs_readdir(&mut self, path: &CString, flags: c_int) ->
-        Result<~[Path], IoError>;
-    fn fs_lstat(&mut self, path: &CString) -> Result<FileStat, IoError>;
+        IoResult<~[Path]>;
+    fn fs_lstat(&mut self, path: &CString) -> IoResult<FileStat>;
     fn fs_chown(&mut self, path: &CString, uid: int, gid: int) ->
-        Result<(), IoError>;
-    fn fs_readlink(&mut self, path: &CString) -> Result<Path, IoError>;
-    fn fs_symlink(&mut self, src: &CString, dst: &CString) -> Result<(), IoError>;
-    fn fs_link(&mut self, src: &CString, dst: &CString) -> Result<(), IoError>;
+        IoResult<()>;
+    fn fs_readlink(&mut self, path: &CString) -> IoResult<Path>;
+    fn fs_symlink(&mut self, src: &CString, dst: &CString) -> IoResult<()>;
+    fn fs_link(&mut self, src: &CString, dst: &CString) -> IoResult<()>;
     fn fs_utime(&mut self, src: &CString, atime: u64, mtime: u64) ->
-        Result<(), IoError>;
+        IoResult<()>;
 
     // misc
-    fn timer_init(&mut self) -> Result<~RtioTimer, IoError>;
+    fn timer_init(&mut self) -> IoResult<~RtioTimer:Send>;
     fn spawn(&mut self, config: ProcessConfig)
-            -> Result<(~RtioProcess, ~[Option<~RtioPipe>]), IoError>;
-    fn kill(&mut self, pid: libc::pid_t, signal: int) -> Result<(), IoError>;
-    fn pipe_open(&mut self, fd: c_int) -> Result<~RtioPipe, IoError>;
+            -> IoResult<(~RtioProcess:Send, ~[Option<~RtioPipe:Send>])>;
+    fn kill(&mut self, pid: libc::pid_t, signal: int) -> IoResult<()>;
+    fn pipe_open(&mut self, fd: c_int) -> IoResult<~RtioPipe:Send>;
     fn tty_open(&mut self, fd: c_int, readable: bool)
-            -> Result<~RtioTTY, IoError>;
+            -> IoResult<~RtioTTY:Send>;
     fn signal(&mut self, signal: Signum, channel: Sender<Signum>)
-        -> Result<~RtioSignal, IoError>;
+        -> IoResult<~RtioSignal:Send>;
 }
 
 pub trait RtioTcpListener : RtioSocket {
-    fn listen(~self) -> Result<~RtioTcpAcceptor, IoError>;
+    fn listen(~self) -> IoResult<~RtioTcpAcceptor:Send>;
 }
 
 pub trait RtioTcpAcceptor : RtioSocket {
-    fn accept(&mut self) -> Result<~RtioTcpStream, IoError>;
-    fn accept_simultaneously(&mut self) -> Result<(), IoError>;
-    fn dont_accept_simultaneously(&mut self) -> Result<(), IoError>;
+    fn accept(&mut self) -> IoResult<~RtioTcpStream:Send>;
+    fn accept_simultaneously(&mut self) -> IoResult<()>;
+    fn dont_accept_simultaneously(&mut self) -> IoResult<()>;
 }
 
 pub trait RtioTcpStream : RtioSocket {
-    fn read(&mut self, buf: &mut [u8]) -> Result<uint, IoError>;
-    fn write(&mut self, buf: &[u8]) -> Result<(), IoError>;
-    fn peer_name(&mut self) -> Result<SocketAddr, IoError>;
-    fn control_congestion(&mut self) -> Result<(), IoError>;
-    fn nodelay(&mut self) -> Result<(), IoError>;
-    fn keepalive(&mut self, delay_in_seconds: uint) -> Result<(), IoError>;
-    fn letdie(&mut self) -> Result<(), IoError>;
-    fn clone(&self) -> ~RtioTcpStream;
-    fn close_write(&mut self) -> Result<(), IoError>;
+    fn read(&mut self, buf: &mut [u8]) -> IoResult<uint>;
+    fn write(&mut self, buf: &[u8]) -> IoResult<()>;
+    fn peer_name(&mut self) -> IoResult<SocketAddr>;
+    fn control_congestion(&mut self) -> IoResult<()>;
+    fn nodelay(&mut self) -> IoResult<()>;
+    fn keepalive(&mut self, delay_in_seconds: uint) -> IoResult<()>;
+    fn letdie(&mut self) -> IoResult<()>;
+    fn clone(&self) -> ~RtioTcpStream:Send;
+    fn close_write(&mut self) -> IoResult<()>;
 }
 
 pub trait RtioSocket {
-    fn socket_name(&mut self) -> Result<SocketAddr, IoError>;
+    fn socket_name(&mut self) -> IoResult<SocketAddr>;
 }
 
 pub trait RtioUdpSocket : RtioSocket {
-    fn recvfrom(&mut self, buf: &mut [u8]) -> Result<(uint, SocketAddr), IoError>;
-    fn sendto(&mut self, buf: &[u8], dst: SocketAddr) -> Result<(), IoError>;
+    fn recvfrom(&mut self, buf: &mut [u8]) -> IoResult<(uint, SocketAddr)>;
+    fn sendto(&mut self, buf: &[u8], dst: SocketAddr) -> IoResult<()>;
 
-    fn join_multicast(&mut self, multi: IpAddr) -> Result<(), IoError>;
-    fn leave_multicast(&mut self, multi: IpAddr) -> Result<(), IoError>;
+    fn join_multicast(&mut self, multi: IpAddr) -> IoResult<()>;
+    fn leave_multicast(&mut self, multi: IpAddr) -> IoResult<()>;
 
-    fn loop_multicast_locally(&mut self) -> Result<(), IoError>;
-    fn dont_loop_multicast_locally(&mut self) -> Result<(), IoError>;
+    fn loop_multicast_locally(&mut self) -> IoResult<()>;
+    fn dont_loop_multicast_locally(&mut self) -> IoResult<()>;
 
-    fn multicast_time_to_live(&mut self, ttl: int) -> Result<(), IoError>;
-    fn time_to_live(&mut self, ttl: int) -> Result<(), IoError>;
+    fn multicast_time_to_live(&mut self, ttl: int) -> IoResult<()>;
+    fn time_to_live(&mut self, ttl: int) -> IoResult<()>;
 
-    fn hear_broadcasts(&mut self) -> Result<(), IoError>;
-    fn ignore_broadcasts(&mut self) -> Result<(), IoError>;
+    fn hear_broadcasts(&mut self) -> IoResult<()>;
+    fn ignore_broadcasts(&mut self) -> IoResult<()>;
 
-    fn clone(&self) -> ~RtioUdpSocket;
+    fn clone(&self) -> ~RtioUdpSocket:Send;
 }
 
 pub trait RtioTimer {
@@ -239,42 +242,42 @@ pub trait RtioTimer {
 }
 
 pub trait RtioFileStream {
-    fn read(&mut self, buf: &mut [u8]) -> Result<int, IoError>;
-    fn write(&mut self, buf: &[u8]) -> Result<(), IoError>;
-    fn pread(&mut self, buf: &mut [u8], offset: u64) -> Result<int, IoError>;
-    fn pwrite(&mut self, buf: &[u8], offset: u64) -> Result<(), IoError>;
-    fn seek(&mut self, pos: i64, whence: SeekStyle) -> Result<u64, IoError>;
-    fn tell(&self) -> Result<u64, IoError>;
-    fn fsync(&mut self) -> Result<(), IoError>;
-    fn datasync(&mut self) -> Result<(), IoError>;
-    fn truncate(&mut self, offset: i64) -> Result<(), IoError>;
+    fn read(&mut self, buf: &mut [u8]) -> IoResult<int>;
+    fn write(&mut self, buf: &[u8]) -> IoResult<()>;
+    fn pread(&mut self, buf: &mut [u8], offset: u64) -> IoResult<int>;
+    fn pwrite(&mut self, buf: &[u8], offset: u64) -> IoResult<()>;
+    fn seek(&mut self, pos: i64, whence: SeekStyle) -> IoResult<u64>;
+    fn tell(&self) -> IoResult<u64>;
+    fn fsync(&mut self) -> IoResult<()>;
+    fn datasync(&mut self) -> IoResult<()>;
+    fn truncate(&mut self, offset: i64) -> IoResult<()>;
 }
 
 pub trait RtioProcess {
     fn id(&self) -> libc::pid_t;
-    fn kill(&mut self, signal: int) -> Result<(), IoError>;
+    fn kill(&mut self, signal: int) -> IoResult<()>;
     fn wait(&mut self) -> ProcessExit;
 }
 
 pub trait RtioPipe {
-    fn read(&mut self, buf: &mut [u8]) -> Result<uint, IoError>;
-    fn write(&mut self, buf: &[u8]) -> Result<(), IoError>;
-    fn clone(&self) -> ~RtioPipe;
+    fn read(&mut self, buf: &mut [u8]) -> IoResult<uint>;
+    fn write(&mut self, buf: &[u8]) -> IoResult<()>;
+    fn clone(&self) -> ~RtioPipe:Send;
 }
 
 pub trait RtioUnixListener {
-    fn listen(~self) -> Result<~RtioUnixAcceptor, IoError>;
+    fn listen(~self) -> IoResult<~RtioUnixAcceptor:Send>;
 }
 
 pub trait RtioUnixAcceptor {
-    fn accept(&mut self) -> Result<~RtioPipe, IoError>;
+    fn accept(&mut self) -> IoResult<~RtioPipe:Send>;
 }
 
 pub trait RtioTTY {
-    fn read(&mut self, buf: &mut [u8]) -> Result<uint, IoError>;
-    fn write(&mut self, buf: &[u8]) -> Result<(), IoError>;
-    fn set_raw(&mut self, raw: bool) -> Result<(), IoError>;
-    fn get_winsize(&mut self) -> Result<(int, int), IoError>;
+    fn read(&mut self, buf: &mut [u8]) -> IoResult<uint>;
+    fn write(&mut self, buf: &[u8]) -> IoResult<()>;
+    fn set_raw(&mut self, raw: bool) -> IoResult<()>;
+    fn get_winsize(&mut self) -> IoResult<(int, int)>;
     fn isatty(&self) -> bool;
 }
 
diff --git a/src/libstd/rt/task.rs b/src/libstd/rt/task.rs
index ededc69c5a1..211c09977d4 100644
--- a/src/libstd/rt/task.rs
+++ b/src/libstd/rt/task.rs
@@ -20,6 +20,7 @@ use clone::Clone;
 use comm::Sender;
 use io::Writer;
 use iter::{Iterator, Take};
+use kinds::Send;
 use local_data;
 use ops::Drop;
 use option::{Option, Some, None};
@@ -50,10 +51,10 @@ pub struct Task {
     destroyed: bool,
     name: Option<SendStr>,
 
-    stdout: Option<~Writer>,
-    stderr: Option<~Writer>,
+    stdout: Option<~Writer:Send>,
+    stderr: Option<~Writer:Send>,
 
-    priv imp: Option<~Runtime>,
+    priv imp: Option<~Runtime:Send>,
 }
 
 pub struct GarbageCollector;
@@ -69,7 +70,7 @@ pub enum BlockedTask {
 pub enum DeathAction {
     /// Action to be done with the exit code. If set, also makes the task wait
     /// until all its watched children exit before collecting the status.
-    Execute(proc(TaskResult)),
+    Execute(proc:Send(TaskResult)),
     /// A channel to send the result of the task on when the task exits
     SendMessage(Sender<TaskResult>),
 }
@@ -195,7 +196,7 @@ impl Task {
     /// Inserts a runtime object into this task, transferring ownership to the
     /// task. It is illegal to replace a previous runtime object in this task
     /// with this argument.
-    pub fn put_runtime(&mut self, ops: ~Runtime) {
+    pub fn put_runtime(&mut self, ops: ~Runtime:Send) {
         assert!(self.imp.is_none());
         self.imp = Some(ops);
     }
@@ -225,7 +226,7 @@ impl Task {
                 Ok(t) => Some(t),
                 Err(t) => {
                     let (_, obj): (uint, uint) = cast::transmute(t);
-                    let obj: ~Runtime = cast::transmute((vtable, obj));
+                    let obj: ~Runtime:Send = cast::transmute((vtable, obj));
                     self.put_runtime(obj);
                     None
                 }
@@ -235,7 +236,7 @@ impl Task {
 
     /// Spawns a sibling to this task. The newly spawned task is configured with
     /// the `opts` structure and will run `f` as the body of its code.
-    pub fn spawn_sibling(mut ~self, opts: TaskOpts, f: proc()) {
+    pub fn spawn_sibling(mut ~self, opts: TaskOpts, f: proc:Send()) {
         let ops = self.imp.take_unwrap();
         ops.spawn_sibling(self, opts, f)
     }
diff --git a/src/libstd/rt/thread.rs b/src/libstd/rt/thread.rs
index 0cbd67557de..7c4bd895469 100644
--- a/src/libstd/rt/thread.rs
+++ b/src/libstd/rt/thread.rs
@@ -68,13 +68,13 @@ impl Thread<()> {
     /// to finish executing. This means that even if `join` is not explicitly
     /// called, when the `Thread` falls out of scope its destructor will block
     /// waiting for the OS thread.
-    pub fn start<T: Send>(main: proc() -> T) -> Thread<T> {
+    pub fn start<T: Send>(main: proc:Send() -> T) -> Thread<T> {
         Thread::start_stack(DEFAULT_STACK_SIZE, main)
     }
 
     /// Performs the same functionality as `start`, but specifies an explicit
     /// stack size for the new thread.
-    pub fn start_stack<T: Send>(stack: uint, main: proc() -> T) -> Thread<T> {
+    pub fn start_stack<T: Send>(stack: uint, main: proc:Send() -> T) -> Thread<T> {
 
         // We need the address of the packet to fill in to be stable so when
         // `main` fills it in it's still valid, so allocate an extra ~ box to do
@@ -83,7 +83,7 @@ impl Thread<()> {
         let packet2: *mut Option<T> = unsafe {
             *cast::transmute::<&~Option<T>, **mut Option<T>>(&packet)
         };
-        let main: proc() = proc() unsafe { *packet2 = Some(main()); };
+        let main = proc() unsafe { *packet2 = Some(main()); };
         let native = unsafe { imp::create(stack, ~main) };
 
         Thread {
@@ -99,13 +99,13 @@ impl Thread<()> {
     /// This corresponds to creating threads in the 'detached' state on unix
     /// systems. Note that platforms may not keep the main program alive even if
     /// there are detached thread still running around.
-    pub fn spawn(main: proc()) {
+    pub fn spawn(main: proc:Send()) {
         Thread::spawn_stack(DEFAULT_STACK_SIZE, main)
     }
 
     /// Performs the same functionality as `spawn`, but explicitly specifies a
     /// stack size for the new thread.
-    pub fn spawn_stack(stack: uint, main: proc()) {
+    pub fn spawn_stack(stack: uint, main: proc:Send()) {
         unsafe {
             let handle = imp::create(stack, ~main);
             imp::detach(handle);
@@ -146,6 +146,7 @@ impl<T: Send> Drop for Thread<T> {
 mod imp {
     use cast;
     use cmp;
+    use kinds::Send;
     use libc;
     use libc::types::os::arch::extra::{LPSECURITY_ATTRIBUTES, SIZE_T, BOOL,
                                        LPVOID, DWORD, LPDWORD, HANDLE};
@@ -155,7 +156,7 @@ mod imp {
     pub type rust_thread = HANDLE;
     pub type rust_thread_return = DWORD;
 
-    pub unsafe fn create(stack: uint, p: ~proc()) -> rust_thread {
+    pub unsafe fn create(stack: uint, p: ~proc:Send()) -> rust_thread {
         let arg: *mut libc::c_void = cast::transmute(p);
         // FIXME On UNIX, we guard against stack sizes that are too small but
         // that's because pthreads enforces that stacks are at least
@@ -203,6 +204,7 @@ mod imp {
 mod imp {
     use cast;
     use cmp;
+    use kinds::Send;
     use libc::consts::os::posix01::{PTHREAD_CREATE_JOINABLE, PTHREAD_STACK_MIN};
     use libc;
     use mem;
@@ -213,7 +215,7 @@ mod imp {
     pub type rust_thread = libc::pthread_t;
     pub type rust_thread_return = *u8;
 
-    pub unsafe fn create(stack: uint, p: ~proc()) -> rust_thread {
+    pub unsafe fn create(stack: uint, p: ~proc:Send()) -> rust_thread {
         let mut native: libc::pthread_t = mem::uninit();
         let mut attr: libc::pthread_attr_t = mem::uninit();
         assert_eq!(pthread_attr_init(&mut attr), 0);
diff --git a/src/libstd/rt/unwind.rs b/src/libstd/rt/unwind.rs
index 7f54b8b3320..930e0858da1 100644
--- a/src/libstd/rt/unwind.rs
+++ b/src/libstd/rt/unwind.rs
@@ -76,7 +76,7 @@ use uw = rt::libunwind;
 
 pub struct Unwinder {
     priv unwinding: bool,
-    priv cause: Option<~Any>
+    priv cause: Option<~Any:Send>
 }
 
 impl Unwinder {
@@ -126,7 +126,7 @@ impl Unwinder {
         }
     }
 
-    pub fn begin_unwind(&mut self, cause: ~Any) -> ! {
+    pub fn begin_unwind(&mut self, cause: ~Any:Send) -> ! {
         rtdebug!("begin_unwind()");
 
         self.unwinding = true;
@@ -372,7 +372,7 @@ pub fn begin_unwind<M: Any + Send>(msg: M, file: &'static str, line: uint) -> !
 /// Do this split took the LLVM IR line counts of `fn main() { fail!()
 /// }` from ~1900/3700 (-O/no opts) to 180/590.
 #[inline(never)] #[cold] // this is the slow path, please never inline this
-fn begin_unwind_inner(msg: ~Any, file: &'static str, line: uint) -> ! {
+fn begin_unwind_inner(msg: ~Any:Send, file: &'static str, line: uint) -> ! {
     let mut task;
     {
         let msg_s = match msg.as_ref::<&'static str>() {