about summary refs log tree commit diff
path: root/src/libnative
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-07-02 11:08:21 -0700
committerAlex Crichton <alex@alexcrichton.com>2014-07-02 11:08:21 -0700
commitff1dd44b40a7243f43a8d32ba8bd6026197c320b (patch)
tree4460cbf0a917a289d1d3744d9645c5ab131ea9df /src/libnative
parentaa1163b92de7717eb7c5eba002b4012e0574a7fe (diff)
parentca2778ede7c21efc3cf2e4e1152875ec09360770 (diff)
downloadrust-ff1dd44b40a7243f43a8d32ba8bd6026197c320b.tar.gz
rust-ff1dd44b40a7243f43a8d32ba8bd6026197c320b.zip
Merge remote-tracking branch 'origin/master' into 0.11.0-release
Conflicts:
	src/libstd/lib.rs
Diffstat (limited to 'src/libnative')
-rw-r--r--src/libnative/io/addrinfo.rs21
-rw-r--r--src/libnative/io/c_unix.rs12
-rw-r--r--src/libnative/io/c_win32.rs14
-rw-r--r--src/libnative/io/file_unix.rs46
-rw-r--r--src/libnative/io/file_win32.rs19
-rw-r--r--src/libnative/io/mod.rs2
-rw-r--r--src/libnative/io/net.rs22
-rw-r--r--src/libnative/io/pipe_unix.rs10
-rw-r--r--src/libnative/io/pipe_win32.rs4
-rw-r--r--src/libnative/io/process.rs88
-rw-r--r--src/libnative/io/timer_unix.rs9
-rw-r--r--src/libnative/io/timer_win32.rs12
-rw-r--r--src/libnative/io/util.rs22
-rw-r--r--src/libnative/lib.rs11
-rw-r--r--src/libnative/task.rs4
15 files changed, 157 insertions, 139 deletions
diff --git a/src/libnative/io/addrinfo.rs b/src/libnative/io/addrinfo.rs
index 255c3f4bd21..0977b55d8b9 100644
--- a/src/libnative/io/addrinfo.rs
+++ b/src/libnative/io/addrinfo.rs
@@ -37,19 +37,21 @@ impl GetAddrInfoRequest {
                 ai_socktype: 0,
                 ai_protocol: 0,
                 ai_addrlen: 0,
-                ai_canonname: null(),
-                ai_addr: null(),
-                ai_next: null()
+                ai_canonname: mut_null(),
+                ai_addr: mut_null(),
+                ai_next: mut_null()
             }
         });
 
-        let hint_ptr = hint.as_ref().map_or(null(), |x| x as *libc::addrinfo);
+        let hint_ptr = hint.as_ref().map_or(null(), |x| {
+            x as *const libc::addrinfo
+        });
         let mut res = mut_null();
 
         // Make the call
         let s = unsafe {
-            let ch = if c_host.is_null() { null() } else { c_host.with_ref(|x| x) };
-            let cs = if c_serv.is_null() { null() } else { c_serv.with_ref(|x| x) };
+            let ch = if c_host.is_null() { null() } else { c_host.as_ptr() };
+            let cs = if c_serv.is_null() { null() } else { c_serv.as_ptr() };
             getaddrinfo(ch, cs, hint_ptr, &mut res)
         };
 
@@ -87,11 +89,12 @@ impl GetAddrInfoRequest {
 }
 
 extern "system" {
-    fn getaddrinfo(node: *c_char, service: *c_char,
-                   hints: *libc::addrinfo, res: *mut *mut libc::addrinfo) -> c_int;
+    fn getaddrinfo(node: *const c_char, service: *const c_char,
+                   hints: *const libc::addrinfo,
+                   res: *mut *mut libc::addrinfo) -> c_int;
     fn freeaddrinfo(res: *mut libc::addrinfo);
     #[cfg(not(windows))]
-    fn gai_strerror(errcode: c_int) -> *c_char;
+    fn gai_strerror(errcode: c_int) -> *const c_char;
 }
 
 #[cfg(windows)]
diff --git a/src/libnative/io/c_unix.rs b/src/libnative/io/c_unix.rs
index b1bc36e0b05..9fbf3659d3f 100644
--- a/src/libnative/io/c_unix.rs
+++ b/src/libnative/io/c_unix.rs
@@ -57,12 +57,12 @@ pub static WNOHANG: libc::c_int = 1;
 
 extern {
     pub fn gettimeofday(timeval: *mut libc::timeval,
-                        tzp: *libc::c_void) -> libc::c_int;
+                        tzp: *mut libc::c_void) -> libc::c_int;
     pub fn select(nfds: libc::c_int,
-                  readfds: *fd_set,
-                  writefds: *fd_set,
-                  errorfds: *fd_set,
-                  timeout: *libc::timeval) -> libc::c_int;
+                  readfds: *mut fd_set,
+                  writefds: *mut fd_set,
+                  errorfds: *mut fd_set,
+                  timeout: *mut libc::timeval) -> libc::c_int;
     pub fn getsockopt(sockfd: libc::c_int,
                       level: libc::c_int,
                       optname: libc::c_int,
@@ -75,7 +75,7 @@ extern {
                    options: libc::c_int) -> libc::pid_t;
 
     pub fn sigaction(signum: libc::c_int,
-                     act: *sigaction,
+                     act: *const sigaction,
                      oldact: *mut sigaction) -> libc::c_int;
 
     pub fn sigaddset(set: *mut sigset_t, signum: libc::c_int) -> libc::c_int;
diff --git a/src/libnative/io/c_win32.rs b/src/libnative/io/c_win32.rs
index 1b6525c6e38..802526c9196 100644
--- a/src/libnative/io/c_win32.rs
+++ b/src/libnative/io/c_win32.rs
@@ -28,7 +28,7 @@ pub struct WSADATA {
     pub szSystemStatus: [u8, ..WSASYS_STATUS_LEN + 1],
     pub iMaxSockets: u16,
     pub iMaxUdpDg: u16,
-    pub lpVendorInfo: *u8,
+    pub lpVendorInfo: *mut u8,
 }
 
 pub type LPWSADATA = *mut WSADATA;
@@ -53,10 +53,10 @@ extern "system" {
     pub fn ioctlsocket(s: libc::SOCKET, cmd: libc::c_long,
                        argp: *mut libc::c_ulong) -> libc::c_int;
     pub fn select(nfds: libc::c_int,
-                  readfds: *fd_set,
-                  writefds: *fd_set,
-                  exceptfds: *fd_set,
-                  timeout: *libc::timeval) -> libc::c_int;
+                  readfds: *mut fd_set,
+                  writefds: *mut fd_set,
+                  exceptfds: *mut fd_set,
+                  timeout: *mut libc::timeval) -> libc::c_int;
     pub fn getsockopt(sockfd: libc::SOCKET,
                       level: libc::c_int,
                       optname: libc::c_int,
@@ -70,6 +70,7 @@ extern "system" {
 
 pub mod compat {
     use std::intrinsics::{atomic_store_relaxed, transmute};
+    use std::iter::Iterator;
     use libc::types::os::arch::extra::{LPCWSTR, HMODULE, LPCSTR, LPVOID};
 
     extern "system" {
@@ -82,7 +83,8 @@ pub mod compat {
     // layer (after it's loaded) shouldn't be any slower than a regular DLL
     // call.
     unsafe fn store_func(ptr: *mut uint, module: &str, symbol: &str, fallback: uint) {
-        let module = module.to_utf16().append_one(0);
+        let module: Vec<u16> = module.utf16_units().collect();
+        let module = module.append_one(0);
         symbol.with_c_str(|symbol| {
             let handle = GetModuleHandleW(module.as_ptr());
             let func: uint = transmute(GetProcAddress(handle, symbol));
diff --git a/src/libnative/io/file_unix.rs b/src/libnative/io/file_unix.rs
index edf2becc777..ddcff2be5f3 100644
--- a/src/libnative/io/file_unix.rs
+++ b/src/libnative/io/file_unix.rs
@@ -68,7 +68,7 @@ impl FileDesc {
     pub fn inner_write(&mut self, buf: &[u8]) -> IoResult<()> {
         let ret = keep_going(buf, |buf, len| {
             unsafe {
-                libc::write(self.fd(), buf as *libc::c_void,
+                libc::write(self.fd(), buf as *const libc::c_void,
                             len as libc::size_t) as i64
             }
         });
@@ -91,7 +91,7 @@ impl rtio::RtioFileStream for FileDesc {
     }
     fn pread(&mut self, buf: &mut [u8], offset: u64) -> IoResult<int> {
         match retry(|| unsafe {
-            libc::pread(self.fd(), buf.as_ptr() as *libc::c_void,
+            libc::pread(self.fd(), buf.as_ptr() as *mut _,
                         buf.len() as libc::size_t,
                         offset as libc::off_t) as libc::c_int
         }) {
@@ -101,7 +101,7 @@ impl rtio::RtioFileStream for FileDesc {
     }
     fn pwrite(&mut self, buf: &[u8], offset: u64) -> IoResult<()> {
         super::mkerr_libc(retry(|| unsafe {
-            libc::pwrite(self.fd(), buf.as_ptr() as *libc::c_void,
+            libc::pwrite(self.fd(), buf.as_ptr() as *const _,
                          buf.len() as libc::size_t, offset as libc::off_t)
         } as c_int))
     }
@@ -222,7 +222,7 @@ impl Drop for Inner {
 }
 
 pub struct CFile {
-    file: *libc::FILE,
+    file: *mut libc::FILE,
     fd: FileDesc,
 }
 
@@ -231,7 +231,7 @@ impl CFile {
     ///
     /// The `CFile` takes ownership of the `FILE` pointer and will close it upon
     /// destruction.
-    pub fn new(file: *libc::FILE) -> CFile {
+    pub fn new(file: *mut libc::FILE) -> CFile {
         CFile {
             file: file,
             fd: FileDesc::new(unsafe { libc::fileno(file) }, false)
@@ -263,7 +263,7 @@ impl rtio::RtioFileStream for CFile {
     fn write(&mut self, buf: &[u8]) -> IoResult<()> {
         let ret = keep_going(buf, |buf, len| {
             unsafe {
-                libc::fwrite(buf as *libc::c_void, 1, len as libc::size_t,
+                libc::fwrite(buf as *const libc::c_void, 1, len as libc::size_t,
                             self.file) as i64
             }
         });
@@ -339,7 +339,7 @@ pub fn open(path: &CString, fm: rtio::FileMode, fa: rtio::FileAccess)
                             libc::S_IRUSR | libc::S_IWUSR),
     };
 
-    match retry(|| unsafe { libc::open(path.with_ref(|p| p), flags, mode) }) {
+    match retry(|| unsafe { libc::open(path.as_ptr(), flags, mode) }) {
         -1 => Err(super::last_error()),
         fd => Ok(FileDesc::new(fd, true)),
     }
@@ -347,7 +347,7 @@ pub fn open(path: &CString, fm: rtio::FileMode, fa: rtio::FileAccess)
 
 pub fn mkdir(p: &CString, mode: uint) -> IoResult<()> {
     super::mkerr_libc(retry(|| unsafe {
-        libc::mkdir(p.with_ref(|p| p), mode as libc::mode_t)
+        libc::mkdir(p.as_ptr(), mode as libc::mode_t)
     }))
 }
 
@@ -356,7 +356,7 @@ pub fn readdir(p: &CString) -> IoResult<Vec<CString>> {
     use libc::{opendir, readdir_r, closedir};
 
     fn prune(root: &CString, dirs: Vec<Path>) -> Vec<CString> {
-        let root = unsafe { CString::new(root.with_ref(|p| p), false) };
+        let root = unsafe { CString::new(root.as_ptr(), false) };
         let root = Path::new(root);
 
         dirs.move_iter().filter(|path| {
@@ -366,14 +366,14 @@ pub fn readdir(p: &CString) -> IoResult<Vec<CString>> {
 
     extern {
         fn rust_dirent_t_size() -> libc::c_int;
-        fn rust_list_dir_val(ptr: *mut dirent_t) -> *libc::c_char;
+        fn rust_list_dir_val(ptr: *mut dirent_t) -> *const libc::c_char;
     }
 
     let size = unsafe { rust_dirent_t_size() };
     let mut buf = Vec::<u8>::with_capacity(size as uint);
     let ptr = buf.as_mut_slice().as_mut_ptr() as *mut dirent_t;
 
-    let dir_ptr = p.with_ref(|buf| unsafe { opendir(buf) });
+    let dir_ptr = unsafe {opendir(p.as_ptr())};
 
     if dir_ptr as uint != 0 {
         let mut paths = vec!();
@@ -393,37 +393,37 @@ pub fn readdir(p: &CString) -> IoResult<Vec<CString>> {
 }
 
 pub fn unlink(p: &CString) -> IoResult<()> {
-    super::mkerr_libc(retry(|| unsafe { libc::unlink(p.with_ref(|p| p)) }))
+    super::mkerr_libc(retry(|| unsafe { libc::unlink(p.as_ptr()) }))
 }
 
 pub fn rename(old: &CString, new: &CString) -> IoResult<()> {
     super::mkerr_libc(retry(|| unsafe {
-        libc::rename(old.with_ref(|p| p), new.with_ref(|p| p))
+        libc::rename(old.as_ptr(), new.as_ptr())
     }))
 }
 
 pub fn chmod(p: &CString, mode: uint) -> IoResult<()> {
     super::mkerr_libc(retry(|| unsafe {
-        libc::chmod(p.with_ref(|p| p), mode as libc::mode_t)
+        libc::chmod(p.as_ptr(), mode as libc::mode_t)
     }))
 }
 
 pub fn rmdir(p: &CString) -> IoResult<()> {
     super::mkerr_libc(retry(|| unsafe {
-        libc::rmdir(p.with_ref(|p| p))
+        libc::rmdir(p.as_ptr())
     }))
 }
 
 pub fn chown(p: &CString, uid: int, gid: int) -> IoResult<()> {
     super::mkerr_libc(retry(|| unsafe {
-        libc::chown(p.with_ref(|p| p), uid as libc::uid_t,
+        libc::chown(p.as_ptr(), uid as libc::uid_t,
                     gid as libc::gid_t)
     }))
 }
 
 pub fn readlink(p: &CString) -> IoResult<CString> {
-    let p = p.with_ref(|p| p);
-    let mut len = unsafe { libc::pathconf(p, libc::_PC_NAME_MAX) };
+    let p = p.as_ptr();
+    let mut len = unsafe { libc::pathconf(p as *mut _, libc::_PC_NAME_MAX) };
     if len == -1 {
         len = 1024; // FIXME: read PATH_MAX from C ffi?
     }
@@ -443,13 +443,13 @@ pub fn readlink(p: &CString) -> IoResult<CString> {
 
 pub fn symlink(src: &CString, dst: &CString) -> IoResult<()> {
     super::mkerr_libc(retry(|| unsafe {
-        libc::symlink(src.with_ref(|p| p), dst.with_ref(|p| p))
+        libc::symlink(src.as_ptr(), dst.as_ptr())
     }))
 }
 
 pub fn link(src: &CString, dst: &CString) -> IoResult<()> {
     super::mkerr_libc(retry(|| unsafe {
-        libc::link(src.with_ref(|p| p), dst.with_ref(|p| p))
+        libc::link(src.as_ptr(), dst.as_ptr())
     }))
 }
 
@@ -489,7 +489,7 @@ fn mkstat(stat: &libc::stat) -> rtio::FileStat {
 
 pub fn stat(p: &CString) -> IoResult<rtio::FileStat> {
     let mut stat: libc::stat = unsafe { mem::zeroed() };
-    match retry(|| unsafe { libc::stat(p.with_ref(|p| p), &mut stat) }) {
+    match retry(|| unsafe { libc::stat(p.as_ptr(), &mut stat) }) {
         0 => Ok(mkstat(&stat)),
         _ => Err(super::last_error()),
     }
@@ -497,7 +497,7 @@ pub fn stat(p: &CString) -> IoResult<rtio::FileStat> {
 
 pub fn lstat(p: &CString) -> IoResult<rtio::FileStat> {
     let mut stat: libc::stat = unsafe { mem::zeroed() };
-    match retry(|| unsafe { libc::lstat(p.with_ref(|p| p), &mut stat) }) {
+    match retry(|| unsafe { libc::lstat(p.as_ptr(), &mut stat) }) {
         0 => Ok(mkstat(&stat)),
         _ => Err(super::last_error()),
     }
@@ -509,7 +509,7 @@ pub fn utime(p: &CString, atime: u64, mtime: u64) -> IoResult<()> {
         modtime: (mtime / 1000) as libc::time_t,
     };
     super::mkerr_libc(retry(|| unsafe {
-        libc::utime(p.with_ref(|p| p), &buf)
+        libc::utime(p.as_ptr(), &buf)
     }))
 }
 
diff --git a/src/libnative/io/file_win32.rs b/src/libnative/io/file_win32.rs
index cd9abc70a4e..98553603313 100644
--- a/src/libnative/io/file_win32.rs
+++ b/src/libnative/io/file_win32.rs
@@ -255,7 +255,7 @@ impl Drop for Inner {
 
 pub fn to_utf16(s: &CString) -> IoResult<Vec<u16>> {
     match s.as_str() {
-        Some(s) => Ok(s.to_utf16().append_one(0)),
+        Some(s) => Ok(s.utf16_units().collect::<Vec<u16>>().append_one(0)),
         None => Err(IoError {
             code: libc::ERROR_INVALID_NAME as uint,
             extra: 0,
@@ -347,7 +347,7 @@ pub fn readdir(p: &CString) -> IoResult<Vec<CString>> {
     use std::rt::libc_heap::malloc_raw;
 
     fn prune(root: &CString, dirs: Vec<Path>) -> Vec<CString> {
-        let root = unsafe { CString::new(root.with_ref(|p| p), false) };
+        let root = unsafe { CString::new(root.as_ptr(), false) };
         let root = Path::new(root);
 
         dirs.move_iter().filter(|path| {
@@ -357,21 +357,22 @@ pub fn readdir(p: &CString) -> IoResult<Vec<CString>> {
 
     extern {
         fn rust_list_dir_wfd_size() -> libc::size_t;
-        fn rust_list_dir_wfd_fp_buf(wfd: *libc::c_void) -> *u16;
+        fn rust_list_dir_wfd_fp_buf(wfd: *mut libc::c_void) -> *const u16;
     }
     let star = Path::new(unsafe {
-        CString::new(p.with_ref(|p| p), false)
+        CString::new(p.as_ptr(), false)
     }).join("*");
     let path = try!(to_utf16(&star.to_c_str()));
 
     unsafe {
         let wfd_ptr = malloc_raw(rust_list_dir_wfd_size() as uint);
-        let find_handle = libc::FindFirstFileW(path.as_ptr(), wfd_ptr as libc::HANDLE);
+        let find_handle = libc::FindFirstFileW(path.as_ptr(),
+                                               wfd_ptr as libc::HANDLE);
         if find_handle as libc::c_int != libc::INVALID_HANDLE_VALUE {
             let mut paths = vec!();
             let mut more_files = 1 as libc::c_int;
             while more_files != 0 {
-                let fp_buf = rust_list_dir_wfd_fp_buf(wfd_ptr as *c_void);
+                let fp_buf = rust_list_dir_wfd_fp_buf(wfd_ptr as *mut c_void);
                 if fp_buf as uint == 0 {
                     fail!("os::list_dir() failure: got null ptr from wfd");
                 } else {
@@ -446,7 +447,7 @@ pub fn readlink(p: &CString) -> IoResult<CString> {
     // without the null pointer
     let ret = fill_utf16_buf_and_decode(|buf, sz| unsafe {
         GetFinalPathNameByHandleW(handle,
-                                  buf as *u16,
+                                  buf as *const u16,
                                   sz - 1,
                                   libc::VOLUME_NAME_DOS)
     });
@@ -514,12 +515,12 @@ pub fn lstat(_p: &CString) -> IoResult<rtio::FileStat> {
 }
 
 pub fn utime(p: &CString, atime: u64, mtime: u64) -> IoResult<()> {
-    let buf = libc::utimbuf {
+    let mut buf = libc::utimbuf {
         actime: (atime / 1000) as libc::time64_t,
         modtime: (mtime / 1000) as libc::time64_t,
     };
     let p = try!(to_utf16(p));
     super::mkerr_libc(unsafe {
-        libc::wutime(p.as_ptr(), &buf)
+        libc::wutime(p.as_ptr(), &mut buf)
     })
 }
diff --git a/src/libnative/io/mod.rs b/src/libnative/io/mod.rs
index 32775e2cfb5..f6764b8f26a 100644
--- a/src/libnative/io/mod.rs
+++ b/src/libnative/io/mod.rs
@@ -132,7 +132,7 @@ fn retry(f: || -> libc::c_int) -> libc::c_int {
     }
 }
 
-fn keep_going(data: &[u8], f: |*u8, uint| -> i64) -> i64 {
+fn keep_going(data: &[u8], f: |*const u8, uint| -> i64) -> i64 {
     let origamt = data.len();
     let mut data = data.as_ptr();
     let mut amt = origamt;
diff --git a/src/libnative/io/net.rs b/src/libnative/io/net.rs
index 5dfae8d9efe..dfc2c55cde7 100644
--- a/src/libnative/io/net.rs
+++ b/src/libnative/io/net.rs
@@ -105,7 +105,7 @@ fn socket(addr: rtio::SocketAddr, ty: libc::c_int) -> IoResult<sock_t> {
 fn setsockopt<T>(fd: sock_t, opt: libc::c_int, val: libc::c_int,
                  payload: T) -> IoResult<()> {
     unsafe {
-        let payload = &payload as *T as *libc::c_void;
+        let payload = &payload as *const T as *const libc::c_void;
         let ret = libc::setsockopt(fd, opt, val,
                                    payload,
                                    mem::size_of::<T>() as libc::socklen_t);
@@ -278,7 +278,7 @@ impl TcpStream {
         let ret = TcpStream::new(Inner::new(fd));
 
         let (addr, len) = addr_to_sockaddr(addr);
-        let addrp = &addr as *_ as *libc::sockaddr;
+        let addrp = &addr as *const _ as *const libc::sockaddr;
         let len = len as libc::socklen_t;
 
         match timeout {
@@ -369,7 +369,7 @@ impl rtio::RtioTcpStream for TcpStream {
     fn write(&mut self, buf: &[u8]) -> IoResult<()> {
         let fd = self.fd();
         let dolock = || self.lock_nonblocking();
-        let dowrite = |nb: bool, buf: *u8, len: uint| unsafe {
+        let dowrite = |nb: bool, buf: *const u8, len: uint| unsafe {
             let flags = if nb {c::MSG_DONTWAIT} else {0};
             libc::send(fd,
                        buf as *mut libc::c_void,
@@ -456,7 +456,7 @@ impl TcpListener {
         let ret = TcpListener { inner: Inner::new(fd) };
 
         let (addr, len) = addr_to_sockaddr(addr);
-        let addrp = &addr as *_ as *libc::sockaddr;
+        let addrp = &addr as *const _ as *const libc::sockaddr;
         let len = len as libc::socklen_t;
 
         // On platforms with Berkeley-derived sockets, this allows
@@ -564,7 +564,7 @@ impl UdpSocket {
         };
 
         let (addr, len) = addr_to_sockaddr(addr);
-        let addrp = &addr as *_ as *libc::sockaddr;
+        let addrp = &addr as *const _ as *const libc::sockaddr;
         let len = len as libc::socklen_t;
 
         match unsafe { libc::bind(fd, addrp, len) } {
@@ -630,7 +630,7 @@ impl rtio::RtioSocket for UdpSocket {
 #[cfg(unix)]    type msglen_t = libc::size_t;
 
 impl rtio::RtioUdpSocket for UdpSocket {
-    fn recvfrom(&mut self, buf: &mut [u8]) -> IoResult<(uint, rtio::SocketAddr)> {
+    fn recv_from(&mut self, buf: &mut [u8]) -> IoResult<(uint, rtio::SocketAddr)> {
         let fd = self.fd();
         let mut storage: libc::sockaddr_storage = unsafe { mem::zeroed() };
         let storagep = &mut storage as *mut _ as *mut libc::sockaddr;
@@ -652,17 +652,17 @@ impl rtio::RtioUdpSocket for UdpSocket {
         })
     }
 
-    fn sendto(&mut self, buf: &[u8], dst: rtio::SocketAddr) -> IoResult<()> {
+    fn send_to(&mut self, buf: &[u8], dst: rtio::SocketAddr) -> IoResult<()> {
         let (dst, dstlen) = addr_to_sockaddr(dst);
-        let dstp = &dst as *_ as *libc::sockaddr;
+        let dstp = &dst as *const _ as *const libc::sockaddr;
         let dstlen = dstlen as libc::socklen_t;
 
         let fd = self.fd();
         let dolock = || self.lock_nonblocking();
-        let dowrite = |nb, buf: *u8, len: uint| unsafe {
+        let dowrite = |nb, buf: *const u8, len: uint| unsafe {
             let flags = if nb {c::MSG_DONTWAIT} else {0};
             libc::sendto(fd,
-                         buf as *libc::c_void,
+                         buf as *const libc::c_void,
                          len as msglen_t,
                          flags,
                          dstp,
@@ -842,7 +842,7 @@ pub fn write<T>(fd: sock_t,
                 buf: &[u8],
                 write_everything: bool,
                 lock: || -> T,
-                write: |bool, *u8, uint| -> i64) -> IoResult<uint> {
+                write: |bool, *const u8, uint| -> i64) -> IoResult<uint> {
     let mut ret = -1;
     let mut written = 0;
     if deadline == 0 {
diff --git a/src/libnative/io/pipe_unix.rs b/src/libnative/io/pipe_unix.rs
index db0d1743c72..b5b2065f996 100644
--- a/src/libnative/io/pipe_unix.rs
+++ b/src/libnative/io/pipe_unix.rs
@@ -78,7 +78,7 @@ fn connect(addr: &CString, ty: libc::c_int,
            timeout: Option<u64>) -> IoResult<Inner> {
     let (addr, len) = try!(addr_to_sockaddr_un(addr));
     let inner = Inner::new(try!(unix_socket(ty)));
-    let addrp = &addr as *_ as *libc::sockaddr;
+    let addrp = &addr as *const _ as *const libc::sockaddr;
     let len = len as libc::socklen_t;
 
     match timeout {
@@ -98,9 +98,9 @@ fn connect(addr: &CString, ty: libc::c_int,
 fn bind(addr: &CString, ty: libc::c_int) -> IoResult<Inner> {
     let (addr, len) = try!(addr_to_sockaddr_un(addr));
     let inner = Inner::new(try!(unix_socket(ty)));
-    let addrp = &addr as *libc::sockaddr_storage;
+    let addrp = &addr as *const _;
     match unsafe {
-        libc::bind(inner.fd, addrp as *libc::sockaddr, len as libc::socklen_t)
+        libc::bind(inner.fd, addrp as *const _, len as libc::socklen_t)
     } {
         -1 => Err(super::last_error()),
         _  => Ok(inner)
@@ -166,7 +166,7 @@ impl rtio::RtioPipe for UnixStream {
     fn write(&mut self, buf: &[u8]) -> IoResult<()> {
         let fd = self.fd();
         let dolock = || self.lock_nonblocking();
-        let dowrite = |nb: bool, buf: *u8, len: uint| unsafe {
+        let dowrite = |nb: bool, buf: *const u8, len: uint| unsafe {
             let flags = if nb {c::MSG_DONTWAIT} else {0};
             libc::send(fd,
                        buf as *mut libc::c_void,
@@ -278,7 +278,7 @@ impl Drop for UnixListener {
         // careful to unlink the path before we close the file descriptor to
         // prevent races where we unlink someone else's path.
         unsafe {
-            let _ = libc::unlink(self.path.with_ref(|p| p));
+            let _ = libc::unlink(self.path.as_ptr());
         }
     }
 }
diff --git a/src/libnative/io/pipe_win32.rs b/src/libnative/io/pipe_win32.rs
index 5d9ddb1f59c..da713e3f2a9 100644
--- a/src/libnative/io/pipe_win32.rs
+++ b/src/libnative/io/pipe_win32.rs
@@ -152,7 +152,7 @@ impl Drop for Inner {
     }
 }
 
-unsafe fn pipe(name: *u16, init: bool) -> libc::HANDLE {
+unsafe fn pipe(name: *const u16, init: bool) -> libc::HANDLE {
     libc::CreateNamedPipeW(
         name,
         libc::PIPE_ACCESS_DUPLEX |
@@ -210,7 +210,7 @@ pub struct UnixStream {
 }
 
 impl UnixStream {
-    fn try_connect(p: *u16) -> Option<libc::HANDLE> {
+    fn try_connect(p: *const u16) -> Option<libc::HANDLE> {
         // Note that most of this is lifted from the libuv implementation.
         // The idea is that if we fail to open a pipe in read/write mode
         // that we try afterwards in just read or just write
diff --git a/src/libnative/io/process.rs b/src/libnative/io/process.rs
index 59a075f22b2..6fab73115cf 100644
--- a/src/libnative/io/process.rs
+++ b/src/libnative/io/process.rs
@@ -43,7 +43,7 @@ pub struct Process {
     /// A handle to the process - on unix this will always be NULL, but on
     /// windows it will be a HANDLE to the process, which will prevent the
     /// pid being re-used until the handle is closed.
-    handle: *(),
+    handle: *mut (),
 
     /// None until finish() is called.
     exit_code: Option<rtio::ProcessExit>,
@@ -269,7 +269,7 @@ unsafe fn killpid(pid: pid_t, signal: int) -> IoResult<()> {
 
 struct SpawnProcessResult {
     pid: pid_t,
-    handle: *(),
+    handle: *mut (),
 }
 
 #[cfg(windows)]
@@ -294,6 +294,8 @@ fn spawn_process_os(cfg: ProcessConfig,
     use libc::funcs::extra::msvcrt::get_osfhandle;
 
     use std::mem;
+    use std::iter::Iterator;
+    use std::str::StrSlice;
 
     if cfg.gid.is_some() || cfg.uid.is_some() {
         return Err(IoError {
@@ -328,7 +330,8 @@ fn spawn_process_os(cfg: ProcessConfig,
                         lpSecurityDescriptor: ptr::mut_null(),
                         bInheritHandle: 1,
                     };
-                    let filename = "NUL".to_utf16().append_one(0);
+                    let filename: Vec<u16> = "NUL".utf16_units().collect();
+                    let filename = filename.append_one(0);
                     *slot = libc::CreateFileW(filename.as_ptr(),
                                               access,
                                               libc::FILE_SHARE_READ |
@@ -371,7 +374,8 @@ fn spawn_process_os(cfg: ProcessConfig,
 
         with_envp(cfg.env, |envp| {
             with_dirp(cfg.cwd, |dirp| {
-                let mut cmd_str = cmd_str.to_utf16().append_one(0);
+                let mut cmd_str: Vec<u16> = cmd_str.as_slice().utf16_units().collect();
+                cmd_str = cmd_str.append_one(0);
                 let created = CreateProcessW(ptr::null(),
                                              cmd_str.as_mut_ptr(),
                                              ptr::mut_null(),
@@ -403,7 +407,7 @@ fn spawn_process_os(cfg: ProcessConfig,
 
         Ok(SpawnProcessResult {
             pid: pi.dwProcessId as pid_t,
-            handle: pi.hProcess as *()
+            handle: pi.hProcess as *mut ()
         })
     }
 }
@@ -515,14 +519,14 @@ fn spawn_process_os(cfg: ProcessConfig,
     }
 
     #[cfg(target_os = "macos")]
-    unsafe fn set_environ(envp: *c_void) {
-        extern { fn _NSGetEnviron() -> *mut *c_void; }
+    unsafe fn set_environ(envp: *const c_void) {
+        extern { fn _NSGetEnviron() -> *mut *const c_void; }
 
         *_NSGetEnviron() = envp;
     }
     #[cfg(not(target_os = "macos"))]
-    unsafe fn set_environ(envp: *c_void) {
-        extern { static mut environ: *c_void; }
+    unsafe fn set_environ(envp: *const c_void) {
+        extern { static mut environ: *const c_void; }
         environ = envp;
     }
 
@@ -531,7 +535,7 @@ fn spawn_process_os(cfg: ProcessConfig,
         assert_eq!(ret, 0);
     }
 
-    let dirp = cfg.cwd.map(|c| c.with_ref(|p| p)).unwrap_or(ptr::null());
+    let dirp = cfg.cwd.map(|c| c.as_ptr()).unwrap_or(ptr::null());
 
     let cfg = unsafe {
         mem::transmute::<ProcessConfig,ProcessConfig<'static>>(cfg)
@@ -568,7 +572,7 @@ fn spawn_process_os(cfg: ProcessConfig,
                     Err(..) => {
                         Ok(SpawnProcessResult {
                             pid: pid,
-                            handle: ptr::null()
+                            handle: ptr::mut_null()
                         })
                     }
                     Ok(..) => fail!("short read on the cloexec pipe"),
@@ -633,7 +637,7 @@ fn spawn_process_os(cfg: ProcessConfig,
                         } else {
                             libc::O_RDWR
                         };
-                        devnull.with_ref(|p| libc::open(p, flags, 0))
+                        libc::open(devnull.as_ptr(), flags, 0)
                     }
                     Some(obj) => {
                         let fd = obj.fd();
@@ -668,17 +672,18 @@ fn spawn_process_os(cfg: ProcessConfig,
             }
             match cfg.uid {
                 Some(u) => {
-                    // When dropping privileges from root, the `setgroups` call will
-                    // remove any extraneous groups. If we don't call this, then
-                    // even though our uid has dropped, we may still have groups
-                    // that enable us to do super-user things. This will fail if we
-                    // aren't root, so don't bother checking the return value, this
-                    // is just done as an optimistic privilege dropping function.
+                    // When dropping privileges from root, the `setgroups` call
+                    // will remove any extraneous groups. If we don't call this,
+                    // then even though our uid has dropped, we may still have
+                    // groups that enable us to do super-user things. This will
+                    // fail if we aren't root, so don't bother checking the
+                    // return value, this is just done as an optimistic
+                    // privilege dropping function.
                     extern {
                         fn setgroups(ngroups: libc::c_int,
-                                     ptr: *libc::c_void) -> libc::c_int;
+                                     ptr: *const libc::c_void) -> libc::c_int;
                     }
-                    let _ = setgroups(0, 0 as *libc::c_void);
+                    let _ = setgroups(0, 0 as *const libc::c_void);
 
                     if libc::setuid(u as libc::uid_t) != 0 {
                         fail(&mut output);
@@ -698,23 +703,24 @@ fn spawn_process_os(cfg: ProcessConfig,
             if !envp.is_null() {
                 set_environ(envp);
             }
-            let _ = execvp(*argv, argv);
+            let _ = execvp(*argv, argv as *mut _);
             fail(&mut output);
         })
     })
 }
 
 #[cfg(unix)]
-fn with_argv<T>(prog: &CString, args: &[CString], cb: proc(**libc::c_char) -> T) -> T {
-    let mut ptrs: Vec<*libc::c_char> = Vec::with_capacity(args.len()+1);
+fn with_argv<T>(prog: &CString, args: &[CString],
+                cb: proc(*const *const libc::c_char) -> T) -> T {
+    let mut ptrs: Vec<*const libc::c_char> = Vec::with_capacity(args.len()+1);
 
     // Convert the CStrings into an array of pointers. Note: the
     // lifetime of the various CStrings involved is guaranteed to be
     // larger than the lifetime of our invocation of cb, but this is
     // technically unsafe as the callback could leak these pointers
     // out of our scope.
-    ptrs.push(prog.with_ref(|buf| buf));
-    ptrs.extend(args.iter().map(|tmp| tmp.with_ref(|buf| buf)));
+    ptrs.push(prog.as_ptr());
+    ptrs.extend(args.iter().map(|tmp| tmp.as_ptr()));
 
     // Add a terminating null pointer (required by libc).
     ptrs.push(ptr::null());
@@ -723,7 +729,8 @@ fn with_argv<T>(prog: &CString, args: &[CString], cb: proc(**libc::c_char) -> T)
 }
 
 #[cfg(unix)]
-fn with_envp<T>(env: Option<&[(CString, CString)]>, cb: proc(*c_void) -> T) -> T {
+fn with_envp<T>(env: Option<&[(CString, CString)]>,
+                cb: proc(*const c_void) -> T) -> T {
     // On posixy systems we can pass a char** for envp, which is a
     // null-terminated array of "k=v\0" strings. Since we must create
     // these strings locally, yet expose a raw pointer to them, we
@@ -742,13 +749,13 @@ fn with_envp<T>(env: Option<&[(CString, CString)]>, cb: proc(*c_void) -> T) -> T
             }
 
             // As with `with_argv`, this is unsafe, since cb could leak the pointers.
-            let mut ptrs: Vec<*libc::c_char> =
+            let mut ptrs: Vec<*const libc::c_char> =
                 tmps.iter()
-                    .map(|tmp| tmp.as_ptr() as *libc::c_char)
+                    .map(|tmp| tmp.as_ptr() as *const libc::c_char)
                     .collect();
             ptrs.push(ptr::null());
 
-            cb(ptrs.as_ptr() as *c_void)
+            cb(ptrs.as_ptr() as *const c_void)
         }
         _ => cb(ptr::null())
     }
@@ -767,7 +774,7 @@ fn with_envp<T>(env: Option<&[(CString, CString)]>, cb: |*mut c_void| -> T) -> T
                 let kv = format!("{}={}",
                                  pair.ref0().as_str().unwrap(),
                                  pair.ref1().as_str().unwrap());
-                blk.push_all(kv.to_utf16().as_slice());
+                blk.extend(kv.as_slice().utf16_units());
                 blk.push(0);
             }
 
@@ -780,12 +787,14 @@ fn with_envp<T>(env: Option<&[(CString, CString)]>, cb: |*mut c_void| -> T) -> T
 }
 
 #[cfg(windows)]
-fn with_dirp<T>(d: Option<&CString>, cb: |*u16| -> T) -> T {
+fn with_dirp<T>(d: Option<&CString>, cb: |*const u16| -> T) -> T {
     match d {
       Some(dir) => {
           let dir_str = dir.as_str()
                            .expect("expected workingdirectory to be utf-8 encoded");
-          let dir_str = dir_str.to_utf16().append_one(0);
+          let dir_str: Vec<u16> = dir_str.utf16_units().collect();
+          let dir_str = dir_str.append_one(0);
+
           cb(dir_str.as_ptr())
       },
       None => cb(ptr::null())
@@ -793,14 +802,14 @@ fn with_dirp<T>(d: Option<&CString>, cb: |*u16| -> T) -> T {
 }
 
 #[cfg(windows)]
-fn free_handle(handle: *()) {
+fn free_handle(handle: *mut ()) {
     assert!(unsafe {
         libc::CloseHandle(mem::transmute(handle)) != 0
     })
 }
 
 #[cfg(unix)]
-fn free_handle(_handle: *()) {
+fn free_handle(_handle: *mut ()) {
     // unix has no process handle object, just a pid
 }
 
@@ -1014,15 +1023,16 @@ fn waitpid(pid: pid_t, deadline: u64) -> IoResult<rtio::ProcessExit> {
                     let now = ::io::timer::now();
                     let ms = if now < deadline {deadline - now} else {0};
                     tv = util::ms_to_timeval(ms);
-                    (&tv as *_, idx)
+                    (&mut tv as *mut _, idx)
                 }
-                None => (ptr::null(), -1),
+                None => (ptr::mut_null(), -1),
             };
 
             // Wait for something to happen
             c::fd_set(&mut set, input);
             c::fd_set(&mut set, read_fd);
-            match unsafe { c::select(max, &set, ptr::null(), ptr::null(), p) } {
+            match unsafe { c::select(max, &mut set, ptr::mut_null(),
+                                     ptr::mut_null(), p) } {
                 // interrupted, retry
                 -1 if os::errno() == libc::EINTR as int => continue,
 
@@ -1132,9 +1142,9 @@ fn waitpid(pid: pid_t, deadline: u64) -> IoResult<rtio::ProcessExit> {
     // which will wake up the other end at some point, so we just allow this
     // signal to be coalesced with the pending signals on the pipe.
     extern fn sigchld_handler(_signum: libc::c_int) {
-        let mut msg = 1;
+        let msg = 1i;
         match unsafe {
-            libc::write(WRITE_FD, &mut msg as *mut _ as *libc::c_void, 1)
+            libc::write(WRITE_FD, &msg as *const _ as *const libc::c_void, 1)
         } {
             1 => {}
             -1 if util::wouldblock() => {} // see above comments
diff --git a/src/libnative/io/timer_unix.rs b/src/libnative/io/timer_unix.rs
index 304ff973835..8d6563bafad 100644
--- a/src/libnative/io/timer_unix.rs
+++ b/src/libnative/io/timer_unix.rs
@@ -88,7 +88,7 @@ pub enum Req {
 pub fn now() -> u64 {
     unsafe {
         let mut now: libc::timeval = mem::zeroed();
-        assert_eq!(c::gettimeofday(&mut now, ptr::null()), 0);
+        assert_eq!(c::gettimeofday(&mut now, ptr::mut_null()), 0);
         return (now.tv_sec as u64) * 1000 + (now.tv_usec as u64) / 1000;
     }
 }
@@ -146,7 +146,7 @@ fn helper(input: libc::c_int, messages: Receiver<Req>, _: int) {
     'outer: loop {
         let timeout = if active.len() == 0 {
             // Empty array? no timeout (wait forever for the next request)
-            ptr::null()
+            ptr::mut_null()
         } else {
             let now = now();
             // If this request has already expired, then signal it and go
@@ -162,12 +162,13 @@ fn helper(input: libc::c_int, messages: Receiver<Req>, _: int) {
             let tm = active.get(0).target - now;
             timeout.tv_sec = (tm / 1000) as libc::time_t;
             timeout.tv_usec = ((tm % 1000) * 1000) as libc::suseconds_t;
-            &timeout as *libc::timeval
+            &mut timeout as *mut libc::timeval
         };
 
         c::fd_set(&mut set, input);
         match unsafe {
-            c::select(input + 1, &set, ptr::null(), ptr::null(), timeout)
+            c::select(input + 1, &mut set, ptr::mut_null(),
+                      ptr::mut_null(), timeout)
         } {
             // timed out
             0 => signal(&mut active, &mut dead),
diff --git a/src/libnative/io/timer_win32.rs b/src/libnative/io/timer_win32.rs
index 9be09c6de07..1e5594126b1 100644
--- a/src/libnative/io/timer_win32.rs
+++ b/src/libnative/io/timer_win32.rs
@@ -141,7 +141,7 @@ impl rtio::RtioTimer for Timer {
         // 100ns intervals, so we multiply by 10^4.
         let due = -(msecs as i64 * 10000) as libc::LARGE_INTEGER;
         assert_eq!(unsafe {
-            imp::SetWaitableTimer(self.obj, &due, 0, ptr::null(),
+            imp::SetWaitableTimer(self.obj, &due, 0, ptr::mut_null(),
                                   ptr::mut_null(), 0)
         }, 1);
 
@@ -154,7 +154,7 @@ impl rtio::RtioTimer for Timer {
         // see above for the calculation
         let due = -(msecs as i64 * 10000) as libc::LARGE_INTEGER;
         assert_eq!(unsafe {
-            imp::SetWaitableTimer(self.obj, &due, 0, ptr::null(),
+            imp::SetWaitableTimer(self.obj, &due, 0, ptr::mut_null(),
                                   ptr::mut_null(), 0)
         }, 1);
 
@@ -169,7 +169,7 @@ impl rtio::RtioTimer for Timer {
         let due = -(msecs as i64 * 10000) as libc::LARGE_INTEGER;
         assert_eq!(unsafe {
             imp::SetWaitableTimer(self.obj, &due, msecs as libc::LONG,
-                                  ptr::null(), ptr::mut_null(), 0)
+                                  ptr::mut_null(), ptr::mut_null(), 0)
         }, 1);
 
         unsafe { HELPER.send(NewTimer(self.obj, cb, false)) }
@@ -188,20 +188,20 @@ mod imp {
     use libc::{LPSECURITY_ATTRIBUTES, BOOL, LPCSTR, HANDLE, LARGE_INTEGER,
                     LONG, LPVOID, DWORD, c_void};
 
-    pub type PTIMERAPCROUTINE = *c_void;
+    pub type PTIMERAPCROUTINE = *mut c_void;
 
     extern "system" {
         pub fn CreateWaitableTimerA(lpTimerAttributes: LPSECURITY_ATTRIBUTES,
                                     bManualReset: BOOL,
                                     lpTimerName: LPCSTR) -> HANDLE;
         pub fn SetWaitableTimer(hTimer: HANDLE,
-                                pDueTime: *LARGE_INTEGER,
+                                pDueTime: *const LARGE_INTEGER,
                                 lPeriod: LONG,
                                 pfnCompletionRoutine: PTIMERAPCROUTINE,
                                 lpArgToCompletionRoutine: LPVOID,
                                 fResume: BOOL) -> BOOL;
         pub fn WaitForMultipleObjects(nCount: DWORD,
-                                      lpHandles: *HANDLE,
+                                      lpHandles: *const HANDLE,
                                       bWaitAll: BOOL,
                                       dwMilliseconds: DWORD) -> DWORD;
         pub fn WaitForSingleObject(hHandle: HANDLE,
diff --git a/src/libnative/io/util.rs b/src/libnative/io/util.rs
index a3c5349fa45..31ba2223082 100644
--- a/src/libnative/io/util.rs
+++ b/src/libnative/io/util.rs
@@ -90,7 +90,7 @@ pub fn set_nonblocking(fd: net::sock_t, nb: bool) -> IoResult<()> {
 // See http://developerweb.net/viewtopic.php?id=3196 for where this is
 // derived from.
 pub fn connect_timeout(fd: net::sock_t,
-                       addrp: *libc::sockaddr,
+                       addrp: *const libc::sockaddr,
                        len: libc::socklen_t,
                        timeout_ms: u64) -> IoResult<()> {
     use std::os;
@@ -145,16 +145,16 @@ pub fn connect_timeout(fd: net::sock_t,
             // Recalculate the timeout each iteration (it is generally
             // undefined what the value of the 'tv' is after select
             // returns EINTR).
-            let tv = ms_to_timeval(timeout - (::io::timer::now() - start));
-            c::select(fd + 1, ptr::null(), set as *mut _ as *_,
-                      ptr::null(), &tv)
+            let mut tv = ms_to_timeval(timeout - (::io::timer::now() - start));
+            c::select(fd + 1, ptr::mut_null(), set as *mut _,
+                      ptr::mut_null(), &mut tv)
         })
     }
     #[cfg(windows)]
     fn await(_fd: net::sock_t, set: &mut c::fd_set,
              timeout: u64) -> libc::c_int {
-        let tv = ms_to_timeval(timeout);
-        unsafe { c::select(1, ptr::null(), &*set, ptr::null(), &tv) }
+        let mut tv = ms_to_timeval(timeout);
+        unsafe { c::select(1, ptr::mut_null(), set, ptr::mut_null(), &mut tv) }
     }
 }
 
@@ -163,25 +163,25 @@ pub fn await(fd: net::sock_t, deadline: Option<u64>,
     let mut set: c::fd_set = unsafe { mem::zeroed() };
     c::fd_set(&mut set, fd);
     let (read, write) = match status {
-        Readable => (&set as *_, ptr::null()),
-        Writable => (ptr::null(), &set as *_),
+        Readable => (&mut set as *mut _, ptr::mut_null()),
+        Writable => (ptr::mut_null(), &mut set as *mut _),
     };
     let mut tv: libc::timeval = unsafe { mem::zeroed() };
 
     match retry(|| {
         let now = ::io::timer::now();
         let tvp = match deadline {
-            None => ptr::null(),
+            None => ptr::mut_null(),
             Some(deadline) => {
                 // If we're past the deadline, then pass a 0 timeout to
                 // select() so we can poll the status
                 let ms = if deadline < now {0} else {deadline - now};
                 tv = ms_to_timeval(ms);
-                &tv as *_
+                &mut tv as *mut _
             }
         };
         let n = if cfg!(windows) {1} else {fd as libc::c_int + 1};
-        let r = unsafe { c::select(n, read, write, ptr::null(), tvp) };
+        let r = unsafe { c::select(n, read, write, ptr::mut_null(), tvp) };
         r
     }) {
         -1 => Err(last_error()),
diff --git a/src/libnative/lib.rs b/src/libnative/lib.rs
index ade7a479d1e..2e43ddba644 100644
--- a/src/libnative/lib.rs
+++ b/src/libnative/lib.rs
@@ -20,7 +20,9 @@
 //! extern crate native;
 //!
 //! #[start]
-//! fn start(argc: int, argv: **u8) -> int { native::start(argc, argv, main) }
+//! fn start(argc: int, argv: *const *const u8) -> int {
+//!     native::start(argc, argv, main)
+//! }
 //!
 //! fn main() {
 //!     // this code is running on the main OS thread
@@ -55,7 +57,6 @@
 
 #![deny(unused_result, unused_must_use)]
 #![allow(non_camel_case_types, deprecated)]
-#![allow(unknown_features)] // NOTE: remove after a stage0 snap
 #![feature(default_type_params, lang_items)]
 
 // NB this crate explicitly does *not* allow glob imports, please seriously
@@ -84,7 +85,7 @@ static OS_DEFAULT_STACK_ESTIMATE: uint = 2 * (1 << 20);
 
 #[lang = "start"]
 #[cfg(not(test))]
-pub fn lang_start(main: *u8, argc: int, argv: **u8) -> int {
+pub fn lang_start(main: *const u8, argc: int, argv: *const *const u8) -> int {
     use std::mem;
     start(argc, argv, proc() {
         let main: extern "Rust" fn() = unsafe { mem::transmute(main) };
@@ -101,9 +102,9 @@ pub fn lang_start(main: *u8, argc: int, argv: **u8) -> int {
 ///
 /// This function will only return once *all* native threads in the system have
 /// exited.
-pub fn start(argc: int, argv: **u8, main: proc()) -> int {
+pub fn start(argc: int, argv: *const *const u8, main: proc()) -> int {
     let something_around_the_top_of_the_stack = 1;
-    let addr = &something_around_the_top_of_the_stack as *int;
+    let addr = &something_around_the_top_of_the_stack as *const int;
     let my_stack_top = addr as uint;
 
     // FIXME #11359 we just assume that this thread has a stack of a
diff --git a/src/libnative/task.rs b/src/libnative/task.rs
index 0b863d9f694..7ba588ac21c 100644
--- a/src/libnative/task.rs
+++ b/src/libnative/task.rs
@@ -81,7 +81,7 @@ pub fn spawn_opts(opts: TaskOpts, f: proc():Send) {
     // which our stack started).
     Thread::spawn_stack(stack, proc() {
         let something_around_the_top_of_the_stack = 1;
-        let addr = &something_around_the_top_of_the_stack as *int;
+        let addr = &something_around_the_top_of_the_stack as *const int;
         let my_stack = addr as uint;
         unsafe {
             stack::record_stack_bounds(my_stack - stack + 1024, my_stack);
@@ -198,7 +198,7 @@ impl rt::Runtime for Ops {
         cur_task.put_runtime(self);
 
         unsafe {
-            let cur_task_dupe = &*cur_task as *Task;
+            let cur_task_dupe = &mut *cur_task as *mut Task;
             let task = BlockedTask::block(cur_task);
 
             if times == 1 {