about summary refs log tree commit diff
path: root/src/libnative/io
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-04-10 15:31:55 -0700
committerbors <bors@rust-lang.org>2014-04-10 15:31:55 -0700
commit0156af156d70efd5a3c96d0c5b8fc9bec39a7ae5 (patch)
tree7cae8ac126922eee38607c2a0032c85cdad7ba0d /src/libnative/io
parent5bcb76181a3b0df2df5ade348af3a1d29fca795e (diff)
parent1f2c18a0afd55bf3a5319d9e3810ec1ac6b3e1bb (diff)
auto merge of #13443 : alexcrichton/rust/rollup, r=alexcrichton
Closes #13441 (debuginfo: Fixes and improvements for #12840, #12886, and #13213)
Closes #13433 (Remove references to @Trait from a compiler error message)
Closes #13430 (Fix outdated lint warning about inner attribute)
Closes #13425 (Remove a pile of (mainly) internal `~[]` uses)
Closes #13419 (Stop using transmute_mut in RefCell)
Closes #13417 (Remove an unnecessary file `src/libnative/io/p`.)
Closes #13409 (Closing assorted resolve bugs)
Closes #13406 (Generalized the pretty-print entry points to support `-o <file>`.)
Closes #13403 (test: Add a test for #7663)
Closes #13402 (rustdoc: Prune the paths that do not appear in the index.)
Closes #13396 (rustc: Remove absolute rpaths)
Closes #13371 (Rename ast::Purity and ast::Impure Function. Closes #7287)
Closes #13350 (collections: replace all ~[T] with Vec<T>.)
Diffstat (limited to 'src/libnative/io')
-rw-r--r--src/libnative/io/file_unix.rs7
-rw-r--r--src/libnative/io/file_win32.rs8
-rw-r--r--src/libnative/io/mod.rs2
-rw-r--r--src/libnative/io/p0
-rw-r--r--src/libnative/io/timer_other.rs12
-rw-r--r--src/libnative/io/timer_timerfd.rs12
-rw-r--r--src/libnative/io/timer_win32.rs6
7 files changed, 23 insertions, 24 deletions
diff --git a/src/libnative/io/file_unix.rs b/src/libnative/io/file_unix.rs
index 56460166b48..5446ab2950e 100644
--- a/src/libnative/io/file_unix.rs
+++ b/src/libnative/io/file_unix.rs
@@ -340,11 +340,11 @@ pub fn mkdir(p: &CString, mode: io::FilePermission) -> IoResult<()> {
     }))
 }
 
-pub fn readdir(p: &CString) -> IoResult<~[Path]> {
+pub fn readdir(p: &CString) -> IoResult<Vec<Path>> {
     use libc::{dirent_t};
     use libc::{opendir, readdir_r, closedir};
 
-    fn prune(root: &CString, dirs: ~[Path]) -> ~[Path] {
+    fn prune(root: &CString, dirs: Vec<Path>) -> Vec<Path> {
         let root = unsafe { CString::new(root.with_ref(|p| p), false) };
         let root = Path::new(root);
 
@@ -365,7 +365,7 @@ pub fn readdir(p: &CString) -> IoResult<~[Path]> {
     let dir_ptr = p.with_ref(|buf| unsafe { opendir(buf) });
 
     if dir_ptr as uint != 0 {
-        let mut paths = ~[];
+        let mut paths = vec!();
         let mut entry_ptr = 0 as *mut dirent_t;
         while unsafe { readdir_r(dir_ptr, ptr, &mut entry_ptr) == 0 } {
             if entry_ptr.is_null() { break }
@@ -571,4 +571,3 @@ mod tests {
         }
     }
 }
-
diff --git a/src/libnative/io/file_win32.rs b/src/libnative/io/file_win32.rs
index 3e8ee55df94..de515659bf7 100644
--- a/src/libnative/io/file_win32.rs
+++ b/src/libnative/io/file_win32.rs
@@ -323,10 +323,10 @@ pub fn mkdir(p: &CString, _mode: io::FilePermission) -> IoResult<()> {
     })
 }
 
-pub fn readdir(p: &CString) -> IoResult<~[Path]> {
-    use rt::global_heap::malloc_raw;
+pub fn readdir(p: &CString) -> IoResult<Vec<Path>> {
+    use std::rt::global_heap::malloc_raw;
 
-    fn prune(root: &CString, dirs: ~[Path]) -> ~[Path] {
+    fn prune(root: &CString, dirs: Vec<Path>) -> Vec<Path> {
         let root = unsafe { CString::new(root.with_ref(|p| p), false) };
         let root = Path::new(root);
 
@@ -346,7 +346,7 @@ pub fn readdir(p: &CString) -> IoResult<~[Path]> {
         let wfd_ptr = malloc_raw(rust_list_dir_wfd_size() as uint);
         let find_handle = libc::FindFirstFileW(path_ptr, wfd_ptr as libc::HANDLE);
         if find_handle as libc::c_int != libc::INVALID_HANDLE_VALUE {
-            let mut paths = ~[];
+            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);
diff --git a/src/libnative/io/mod.rs b/src/libnative/io/mod.rs
index ffca0dbe3dc..cc432555abb 100644
--- a/src/libnative/io/mod.rs
+++ b/src/libnative/io/mod.rs
@@ -217,7 +217,7 @@ impl rtio::IoFactory for IoFactory {
     fn fs_rename(&mut self, path: &CString, to: &CString) -> IoResult<()> {
         file::rename(path, to)
     }
-    fn fs_readdir(&mut self, path: &CString, _flags: c_int) -> IoResult<~[Path]> {
+    fn fs_readdir(&mut self, path: &CString, _flags: c_int) -> IoResult<Vec<Path>> {
         file::readdir(path)
     }
     fn fs_lstat(&mut self, path: &CString) -> IoResult<io::FileStat> {
diff --git a/src/libnative/io/p b/src/libnative/io/p
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/src/libnative/io/p
+++ /dev/null
diff --git a/src/libnative/io/timer_other.rs b/src/libnative/io/timer_other.rs
index 13f1ea6319a..569b4cbb258 100644
--- a/src/libnative/io/timer_other.rs
+++ b/src/libnative/io/timer_other.rs
@@ -102,11 +102,11 @@ fn helper(input: libc::c_int, messages: Receiver<Req>) {
     // active timers are those which are able to be selected upon (and it's a
     // sorted list, and dead timers are those which have expired, but ownership
     // hasn't yet been transferred back to the timer itself.
-    let mut active: ~[~Inner] = ~[];
-    let mut dead = ~[];
+    let mut active: Vec<~Inner> = vec![];
+    let mut dead = vec![];
 
     // inserts a timer into an array of timers (sorted by firing time)
-    fn insert(t: ~Inner, active: &mut ~[~Inner]) {
+    fn insert(t: ~Inner, active: &mut Vec<~Inner>) {
         match active.iter().position(|tm| tm.target > t.target) {
             Some(pos) => { active.insert(pos, t); }
             None => { active.push(t); }
@@ -114,7 +114,7 @@ fn helper(input: libc::c_int, messages: Receiver<Req>) {
     }
 
     // signals the first requests in the queue, possible re-enqueueing it.
-    fn signal(active: &mut ~[~Inner], dead: &mut ~[(uint, ~Inner)]) {
+    fn signal(active: &mut Vec<~Inner>, dead: &mut Vec<(uint, ~Inner)>) {
         let mut timer = match active.shift() {
             Some(timer) => timer, None => return
         };
@@ -137,7 +137,7 @@ fn helper(input: libc::c_int, messages: Receiver<Req>) {
             let now = now();
             // If this request has already expired, then signal it and go
             // through another iteration
-            if active[0].target <= now {
+            if active.get(0).target <= now {
                 signal(&mut active, &mut dead);
                 continue;
             }
@@ -145,7 +145,7 @@ fn helper(input: libc::c_int, messages: Receiver<Req>) {
             // The actual timeout listed in the requests array is an
             // absolute date, so here we translate the absolute time to a
             // relative time.
-            let tm = active[0].target - now;
+            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
diff --git a/src/libnative/io/timer_timerfd.rs b/src/libnative/io/timer_timerfd.rs
index 25dbdc1e1a5..d37a39fc30e 100644
--- a/src/libnative/io/timer_timerfd.rs
+++ b/src/libnative/io/timer_timerfd.rs
@@ -76,7 +76,7 @@ fn helper(input: libc::c_int, messages: Receiver<Req>) {
 
     add(efd, input);
     let events: [imp::epoll_event, ..16] = unsafe { mem::init() };
-    let mut list: ~[(libc::c_int, Sender<()>, bool)] = ~[];
+    let mut list: Vec<(libc::c_int, Sender<()>, bool)> = vec![];
     'outer: loop {
         let n = match unsafe {
             imp::epoll_wait(efd, events.as_ptr(),
@@ -104,9 +104,9 @@ fn helper(input: libc::c_int, messages: Receiver<Req>) {
                 //      times?
                 let _ = FileDesc::new(fd, false).inner_read(bits).unwrap();
                 let (remove, i) = {
-                    match list.bsearch(|&(f, _, _)| f.cmp(&fd)) {
+                    match list.as_slice().bsearch(|&(f, _, _)| f.cmp(&fd)) {
                         Some(i) => {
-                            let (_, ref c, oneshot) = list[i];
+                            let (_, ref c, oneshot) = *list.get(i);
                             (!c.try_send(()) || oneshot, i)
                         }
                         None => fail!("fd not active: {}", fd),
@@ -128,9 +128,9 @@ fn helper(input: libc::c_int, messages: Receiver<Req>) {
 
                     // If we haven't previously seen the file descriptor, then
                     // we need to add it to the epoll set.
-                    match list.bsearch(|&(f, _, _)| f.cmp(&fd)) {
+                    match list.as_slice().bsearch(|&(f, _, _)| f.cmp(&fd)) {
                         Some(i) => {
-                            drop(mem::replace(&mut list[i], (fd, chan, one)));
+                            drop(mem::replace(list.get_mut(i), (fd, chan, one)));
                         }
                         None => {
                             match list.iter().position(|&(f, _, _)| f >= fd) {
@@ -150,7 +150,7 @@ fn helper(input: libc::c_int, messages: Receiver<Req>) {
                 }
 
                 Data(RemoveTimer(fd, chan)) => {
-                    match list.bsearch(|&(f, _, _)| f.cmp(&fd)) {
+                    match list.as_slice().bsearch(|&(f, _, _)| f.cmp(&fd)) {
                         Some(i) => {
                             drop(list.remove(i));
                             del(efd, fd);
diff --git a/src/libnative/io/timer_win32.rs b/src/libnative/io/timer_win32.rs
index 278a5a73a36..8b7592783da 100644
--- a/src/libnative/io/timer_win32.rs
+++ b/src/libnative/io/timer_win32.rs
@@ -40,8 +40,8 @@ pub enum Req {
 }
 
 fn helper(input: libc::HANDLE, messages: Receiver<Req>) {
-    let mut objs = ~[input];
-    let mut chans = ~[];
+    let mut objs = vec![input];
+    let mut chans = vec![];
 
     'outer: loop {
         let idx = unsafe {
@@ -78,7 +78,7 @@ fn helper(input: libc::HANDLE, messages: Receiver<Req>) {
             }
         } else {
             let remove = {
-                match &chans[idx as uint - 1] {
+                match chans.get(idx as uint - 1) {
                     &(ref c, oneshot) => !c.try_send(()) || oneshot
                 }
             };