diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2013-04-26 14:04:39 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2013-04-29 14:30:56 -0700 |
| commit | 876483dcf4bdcd0001cc25812060bc04cf367f60 (patch) | |
| tree | a1e5c6db1359979b0eb3b595740f541f55b8c104 /src/libcore/rt | |
| parent | f30f54e9d062bdb5b3cb10dd7185470280c1c278 (diff) | |
| download | rust-876483dcf4bdcd0001cc25812060bc04cf367f60.tar.gz rust-876483dcf4bdcd0001cc25812060bc04cf367f60.zip | |
test: Fix tests.
Diffstat (limited to 'src/libcore/rt')
| -rw-r--r-- | src/libcore/rt/thread.rs | 8 | ||||
| -rw-r--r-- | src/libcore/rt/uv/mod.rs | 16 |
2 files changed, 13 insertions, 11 deletions
diff --git a/src/libcore/rt/thread.rs b/src/libcore/rt/thread.rs index 910e445f47b..0f1ae09bd94 100644 --- a/src/libcore/rt/thread.rs +++ b/src/libcore/rt/thread.rs @@ -21,10 +21,10 @@ pub struct Thread { pub impl Thread { fn start(main: ~fn()) -> Thread { - fn substart(main: &fn()) -> *raw_thread { - unsafe { rust_raw_thread_start(&main) } + fn substart(main: &~fn()) -> *raw_thread { + unsafe { rust_raw_thread_start(main) } } - let raw = substart(main); + let raw = substart(&main); Thread { main: main, raw_thread: raw @@ -39,6 +39,6 @@ impl Drop for Thread { } extern { - pub unsafe fn rust_raw_thread_start(f: &(&fn())) -> *raw_thread; + pub unsafe fn rust_raw_thread_start(f: &(~fn())) -> *raw_thread; pub unsafe fn rust_raw_thread_join_delete(thread: *raw_thread); } diff --git a/src/libcore/rt/uv/mod.rs b/src/libcore/rt/uv/mod.rs index 4cbc8d70569..cb7925abdcd 100644 --- a/src/libcore/rt/uv/mod.rs +++ b/src/libcore/rt/uv/mod.rs @@ -366,14 +366,15 @@ pub fn slice_to_uv_buf(v: &[u8]) -> Buf { /// Transmute an owned vector to a Buf pub fn vec_to_uv_buf(v: ~[u8]) -> Buf { - let data = unsafe { malloc(v.len() as size_t) } as *u8; - assert!(data.is_not_null()); - do vec::as_imm_buf(v) |b, l| { - let data = data as *mut u8; - unsafe { ptr::copy_memory(data, b, l) } + unsafe { + let data = malloc(v.len() as size_t) as *u8; + assert!(data.is_not_null()); + do vec::as_imm_buf(v) |b, l| { + let data = data as *mut u8; + ptr::copy_memory(data, b, l) + } + uvll::buf_init(data, v.len()) } - let buf = unsafe { uvll::buf_init(data, v.len()) }; - return buf; } /// Transmute a Buf that was once a ~[u8] back to ~[u8] @@ -384,6 +385,7 @@ pub fn vec_from_uv_buf(buf: Buf) -> Option<~[u8]> { return Some(v); } else { // No buffer + rtdebug!("No buffer!"); return None; } } |
