Skip to content

Commit e83b75f

Browse files
committed
---
yaml --- r: 111595 b: refs/heads/master c: b536d2b h: refs/heads/master i: 111593: 5c0c2e3 111591: 3f4b165 v: v3
1 parent 98cdd39 commit e83b75f

File tree

18 files changed

+115
-107
lines changed

18 files changed

+115
-107
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 3485d90728fe8dc076c6362211bf1f62830c97d8
2+
refs/heads/master: b536d2bb763d478dbf96c035dbd5b68b5ff639b9
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: b5dd3f05fe95168b5569d0f519636149479eb6ac
55
refs/heads/try: 38201d7c6bf0c32b0e5bdc8ecd63976ebc1b3a4c

trunk/src/compiletest/compiletest.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,7 @@ pub fn test_opts(config: &config) -> test::TestOpts {
267267
ratchet_metrics: config.ratchet_metrics.clone(),
268268
ratchet_noise_percent: config.ratchet_noise_percent.clone(),
269269
save_metrics: config.save_metrics.clone(),
270-
test_shard: config.test_shard.clone(),
271-
nocapture: false,
270+
test_shard: config.test_shard.clone()
272271
}
273272
}
274273

trunk/src/compiletest/runtest.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -955,7 +955,6 @@ fn fatal(err: ~str) -> ! { error(err); fail!(); }
955955
fn fatal_ProcRes(err: ~str, proc_res: &ProcRes) -> ! {
956956
print!("\n\
957957
error: {}\n\
958-
status: {}\n\
959958
command: {}\n\
960959
stdout:\n\
961960
------------------------------------------\n\
@@ -966,8 +965,7 @@ stderr:\n\
966965
{}\n\
967966
------------------------------------------\n\
968967
\n",
969-
err, proc_res.status, proc_res.cmdline, proc_res.stdout,
970-
proc_res.stderr);
968+
err, proc_res.cmdline, proc_res.stdout, proc_res.stderr);
971969
fail!();
972970
}
973971

trunk/src/librustuv/async.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
use std::cast;
12+
use libc::c_int;
1213
use std::rt::rtio::{Callback, RemoteCallback};
1314
use std::unstable::sync::Exclusive;
1415

@@ -53,7 +54,8 @@ impl UvHandle<uvll::uv_async_t> for AsyncWatcher {
5354
}
5455
}
5556

56-
extern fn async_cb(handle: *uvll::uv_async_t) {
57+
extern fn async_cb(handle: *uvll::uv_async_t, status: c_int) {
58+
assert!(status == 0);
5759
let payload: &mut Payload = unsafe {
5860
cast::transmute(uvll::get_data_for_uv_handle(handle))
5961
};

trunk/src/librustuv/file.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use std::c_str::CString;
1212
use std::c_str;
1313
use std::cast::transmute;
1414
use std::cast;
15-
use libc::{c_int, c_char, c_void, ssize_t};
15+
use libc::{c_int, c_char, c_void, size_t, ssize_t};
1616
use libc;
1717
use std::rt::task::BlockedTask;
1818
use std::io::{FileStat, IoError};
@@ -86,12 +86,14 @@ impl FsRequest {
8686
} else {
8787
offset + written as i64
8888
};
89-
let uvbuf = uvll::uv_buf_t {
90-
base: buf.slice_from(written as uint).as_ptr(),
91-
len: (buf.len() - written) as uvll::uv_buf_len_t,
92-
};
9389
match execute(|req, cb| unsafe {
94-
uvll::uv_fs_write(loop_.handle, req, fd, &uvbuf, 1, offset, cb)
90+
uvll::uv_fs_write(loop_.handle,
91+
req,
92+
fd,
93+
buf.as_ptr().offset(written as int) as *c_void,
94+
(buf.len() - written) as size_t,
95+
offset,
96+
cb)
9597
}).map(|req| req.get_result()) {
9698
Err(e) => return Err(e),
9799
Ok(n) => { written += n as uint; }
@@ -104,11 +106,9 @@ impl FsRequest {
104106
-> Result<int, UvError>
105107
{
106108
execute(|req, cb| unsafe {
107-
let uvbuf = uvll::uv_buf_t {
108-
base: buf.as_ptr(),
109-
len: buf.len() as uvll::uv_buf_len_t,
110-
};
111-
uvll::uv_fs_read(loop_.handle, req, fd, &uvbuf, 1, offset, cb)
109+
uvll::uv_fs_read(loop_.handle, req,
110+
fd, buf.as_ptr() as *c_void,
111+
buf.len() as size_t, offset, cb)
112112
}).map(|req| {
113113
req.get_result() as int
114114
})

trunk/src/librustuv/idle.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
use std::cast;
12-
use libc::c_void;
12+
use libc::{c_int, c_void};
1313

1414
use uvll;
1515
use super::{Loop, UvHandle};
@@ -46,7 +46,8 @@ impl IdleWatcher {
4646
assert_eq!(uvll::uv_idle_start(handle, onetime_cb), 0)
4747
}
4848

49-
extern fn onetime_cb(handle: *uvll::uv_idle_t) {
49+
extern fn onetime_cb(handle: *uvll::uv_idle_t, status: c_int) {
50+
assert_eq!(status, 0);
5051
unsafe {
5152
let data = uvll::get_data_for_uv_handle(handle);
5253
let f: ~proc() = cast::transmute(data);
@@ -81,7 +82,8 @@ impl UvHandle<uvll::uv_idle_t> for IdleWatcher {
8182
fn uv_handle(&self) -> *uvll::uv_idle_t { self.handle }
8283
}
8384

84-
extern fn idle_cb(handle: *uvll::uv_idle_t) {
85+
extern fn idle_cb(handle: *uvll::uv_idle_t, status: c_int) {
86+
assert_eq!(status, 0);
8587
let idle: &mut IdleWatcher = unsafe { UvHandle::from_uv_handle(&handle) };
8688
idle.callback.call();
8789
}

trunk/src/librustuv/net.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,9 +255,10 @@ impl TcpWatcher {
255255
n => Err(UvError(n))
256256
};
257257

258-
extern fn timer_cb(handle: *uvll::uv_timer_t) {
258+
extern fn timer_cb(handle: *uvll::uv_timer_t, status: c_int) {
259259
// Don't close the corresponding tcp request, just wake up the task
260260
// and let RAII take care of the pending watcher.
261+
assert_eq!(status, 0);
261262
let cx: &mut Ctx = unsafe {
262263
&mut *(uvll::get_data_for_uv_handle(handle) as *mut Ctx)
263264
};
@@ -598,7 +599,8 @@ impl rtio::RtioTcpAcceptor for TcpAcceptor {
598599
self.timeout_tx = Some(tx);
599600
self.timeout_rx = Some(rx);
600601

601-
extern fn timer_cb(timer: *uvll::uv_timer_t) {
602+
extern fn timer_cb(timer: *uvll::uv_timer_t, status: c_int) {
603+
assert_eq!(status, 0);
602604
let acceptor: &mut TcpAcceptor = unsafe {
603605
&mut *(uvll::get_data_for_uv_handle(timer) as *mut TcpAcceptor)
604606
};

trunk/src/librustuv/queue.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#![allow(dead_code)]
2222

2323
use std::cast;
24-
use libc::c_void;
24+
use libc::{c_void, c_int};
2525
use std::rt::task::BlockedTask;
2626
use std::unstable::mutex::NativeMutex;
2727
use std::sync::arc::UnsafeArc;
@@ -55,7 +55,8 @@ pub struct Queue {
5555
queue: UnsafeArc<State>,
5656
}
5757

58-
extern fn async_cb(handle: *uvll::uv_async_t) {
58+
extern fn async_cb(handle: *uvll::uv_async_t, status: c_int) {
59+
assert_eq!(status, 0);
5960
let pool: &mut QueuePool = unsafe {
6061
cast::transmute(uvll::get_data_for_uv_handle(handle))
6162
};

trunk/src/librustuv/timer.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
use libc::c_int;
1112
use std::mem;
1213
use std::rt::rtio::RtioTimer;
1314
use std::rt::task::BlockedTask;
@@ -136,8 +137,9 @@ impl RtioTimer for TimerWatcher {
136137
}
137138
}
138139

139-
extern fn timer_cb(handle: *uvll::uv_timer_t) {
140+
extern fn timer_cb(handle: *uvll::uv_timer_t, status: c_int) {
140141
let _f = ForbidSwitch::new("timer callback can't switch");
142+
assert_eq!(status, 0);
141143
let timer: &mut TimerWatcher = unsafe { UvHandle::from_uv_handle(&handle) };
142144

143145
match timer.action.take_unwrap() {

trunk/src/librustuv/tty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ impl TtyWatcher {
4040
// - https://github.com/joyent/libuv/issues/982
4141
// - https://github.com/joyent/libuv/issues/988
4242
let guess = unsafe { uvll::guess_handle(fd) };
43-
if guess != uvll::UV_TTY as libc::c_int {
43+
if readable && guess != uvll::UV_TTY as libc::c_int {
4444
return Err(UvError(uvll::EBADF));
4545
}
4646

trunk/src/librustuv/uvio.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use libc::{O_CREAT, O_APPEND, O_TRUNC, O_RDWR, O_RDONLY, O_WRONLY, S_IRUSR,
2323
use libc;
2424
use std::path::Path;
2525
use std::rt::rtio;
26-
use std::rt::rtio::{IoFactory, EventLoop};
26+
use std::rt::rtio::IoFactory;
2727
use ai = std::io::net::addrinfo;
2828

2929
#[cfg(test)] use std::unstable::run_in_bare_thread;
@@ -69,20 +69,14 @@ impl Drop for UvEventLoop {
6969
// the loop is free'd (use-after-free). We also must free the uv handle
7070
// after the loop has been closed because during the closing of the loop
7171
// the handle is required to be used apparently.
72-
//
73-
// Lastly, after we've closed the pool of handles we pump the event loop
74-
// one last time to run any closing callbacks to make sure the loop
75-
// shuts down cleanly.
7672
let handle = self.uvio.handle_pool.get_ref().handle();
7773
drop(self.uvio.handle_pool.take());
78-
self.run();
79-
8074
self.uvio.loop_.close();
8175
unsafe { uvll::free_handle(handle) }
8276
}
8377
}
8478

85-
impl EventLoop for UvEventLoop {
79+
impl rtio::EventLoop for UvEventLoop {
8680
fn run(&mut self) {
8781
self.uvio.loop_.run();
8882
}
@@ -116,6 +110,7 @@ impl EventLoop for UvEventLoop {
116110

117111
#[test]
118112
fn test_callback_run_once() {
113+
use std::rt::rtio::EventLoop;
119114
run_in_bare_thread(proc() {
120115
let mut event_loop = UvEventLoop::new();
121116
let mut count = 0;

trunk/src/librustuv/uvll.rs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,8 @@ impl uv_stat_t {
212212
}
213213
}
214214

215-
pub type uv_idle_cb = extern "C" fn(handle: *uv_idle_t);
215+
pub type uv_idle_cb = extern "C" fn(handle: *uv_idle_t,
216+
status: c_int);
216217
pub type uv_alloc_cb = extern "C" fn(stream: *uv_stream_t,
217218
suggested_size: size_t,
218219
buf: *mut uv_buf_t);
@@ -229,12 +230,14 @@ pub type uv_udp_recv_cb = extern "C" fn(handle: *uv_udp_t,
229230
pub type uv_close_cb = extern "C" fn(handle: *uv_handle_t);
230231
pub type uv_walk_cb = extern "C" fn(handle: *uv_handle_t,
231232
arg: *c_void);
232-
pub type uv_async_cb = extern "C" fn(handle: *uv_async_t);
233+
pub type uv_async_cb = extern "C" fn(handle: *uv_async_t,
234+
status: c_int);
233235
pub type uv_connect_cb = extern "C" fn(handle: *uv_connect_t,
234236
status: c_int);
235237
pub type uv_connection_cb = extern "C" fn(handle: *uv_connection_t,
236238
status: c_int);
237-
pub type uv_timer_cb = extern "C" fn(handle: *uv_timer_t);
239+
pub type uv_timer_cb = extern "C" fn(handle: *uv_timer_t,
240+
status: c_int);
238241
pub type uv_write_cb = extern "C" fn(handle: *uv_write_t,
239242
status: c_int);
240243
pub type uv_getaddrinfo_cb = extern "C" fn(req: *uv_getaddrinfo_t,
@@ -594,12 +597,10 @@ extern {
594597
flags: c_int, mode: c_int, cb: uv_fs_cb) -> c_int;
595598
pub fn uv_fs_unlink(loop_ptr: *uv_loop_t, req: *uv_fs_t, path: *c_char,
596599
cb: uv_fs_cb) -> c_int;
597-
pub fn uv_fs_write(l: *uv_loop_t, req: *uv_fs_t, fd: c_int,
598-
bufs: *uv_buf_t, nbufs: c_uint,
599-
offset: i64, cb: uv_fs_cb) -> c_int;
600-
pub fn uv_fs_read(l: *uv_loop_t, req: *uv_fs_t, fd: c_int,
601-
bufs: *uv_buf_t, nbufs: c_uint,
602-
offset: i64, cb: uv_fs_cb) -> c_int;
600+
pub fn uv_fs_write(l: *uv_loop_t, req: *uv_fs_t, fd: c_int, buf: *c_void,
601+
len: size_t, offset: i64, cb: uv_fs_cb) -> c_int;
602+
pub fn uv_fs_read(l: *uv_loop_t, req: *uv_fs_t, fd: c_int, buf: *c_void,
603+
len: size_t, offset: i64, cb: uv_fs_cb) -> c_int;
603604
pub fn uv_fs_close(l: *uv_loop_t, req: *uv_fs_t, fd: c_int,
604605
cb: uv_fs_cb) -> c_int;
605606
pub fn uv_fs_stat(l: *uv_loop_t, req: *uv_fs_t, path: *c_char,

trunk/src/libstd/hash/sip.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ mod tests {
364364
use option::{Some, None};
365365
use str::{Str,StrSlice};
366366
use strbuf::StrBuf;
367-
use slice::{Vector, ImmutableVector};
367+
use slice::{Vector, ImmutableVector, OwnedVector};
368368
use self::test::Bencher;
369369

370370
use super::super::Hash;

trunk/src/libstd/io/fs.rs

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,8 @@ pub fn readdir(path: &Path) -> IoResult<Vec<Path>> {
491491

492492
/// Returns an iterator which will recursively walk the directory structure
493493
/// rooted at `path`. The path given will not be iterated over, and this will
494-
/// perform iteration in a top-down order.
494+
/// perform iteration in some top-down order. The contents of unreadable
495+
/// subdirectories are ignored.
495496
pub fn walk_dir(path: &Path) -> IoResult<Directories> {
496497
Ok(Directories { stack: try!(readdir(path)) })
497498
}
@@ -503,7 +504,7 @@ pub struct Directories {
503504

504505
impl Iterator<Path> for Directories {
505506
fn next(&mut self) -> Option<Path> {
506-
match self.stack.shift() {
507+
match self.stack.pop() {
507508
Some(path) => {
508509
if path.is_dir() {
509510
match readdir(&path) {
@@ -970,6 +971,32 @@ mod test {
970971
check!(rmdir(dir));
971972
})
972973

974+
iotest!(fn file_test_walk_dir() {
975+
let tmpdir = tmpdir();
976+
let dir = &tmpdir.join("walk_dir");
977+
check!(mkdir(dir, io::UserRWX));
978+
979+
let dir1 = &dir.join("01/02/03");
980+
check!(mkdir_recursive(dir1, io::UserRWX));
981+
check!(File::create(&dir1.join("04")));
982+
983+
let dir2 = &dir.join("11/12/13");
984+
check!(mkdir_recursive(dir2, io::UserRWX));
985+
check!(File::create(&dir2.join("14")));
986+
987+
let mut files = check!(walk_dir(dir));
988+
let mut cur = [0u8, .. 2];
989+
for f in files {
990+
let stem = f.filestem_str().unwrap();
991+
let root = stem[0] - ('0' as u8);
992+
let name = stem[1] - ('0' as u8);
993+
assert!(cur[root as uint] < name);
994+
cur[root as uint] = name;
995+
}
996+
997+
check!(rmdir_recursive(dir));
998+
})
999+
9731000
iotest!(fn recursive_mkdir() {
9741001
let tmpdir = tmpdir();
9751002
let dir = tmpdir.join("d1/d2");

trunk/src/libstd/rt/args.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ mod imp {
6767
use clone::Clone;
6868
use option::{Option, Some, None};
6969
use iter::Iterator;
70+
use str::StrSlice;
7071
use unstable::mutex::{StaticNativeMutex, NATIVE_MUTEX_INIT};
7172
use mem;
72-
#[cfg(not(test))] use str::StrSlice;
7373
#[cfg(not(test))] use ptr::RawPtr;
7474

7575
static mut global_args_ptr: uint = 0;

0 commit comments

Comments
 (0)