about summary refs log tree commit diff
path: root/src/libstd/rt
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2013-07-02 17:36:58 -0700
committerBrian Anderson <banderson@mozilla.com>2013-07-03 14:49:13 -0700
commit1098d6980b13dc00e3f20deae987423e3bcae9ce (patch)
tree4d6cfd62f1d0d3298d4144aebd6c81c91edea9dc /src/libstd/rt
parentf8a4d09f7efb618ca3f8b70374e158504cb33cb0 (diff)
parentab34864a304fa364dc91bf16988e272e93de8d62 (diff)
downloadrust-1098d6980b13dc00e3f20deae987423e3bcae9ce.tar.gz
rust-1098d6980b13dc00e3f20deae987423e3bcae9ce.zip
Merge remote-tracking branch 'mozilla/master'
Conflicts:
	src/libextra/test.rs
	src/libstd/at_vec.rs
	src/libstd/cleanup.rs
	src/libstd/rt/comm.rs
	src/libstd/rt/global_heap.rs
	src/libstd/task/spawn.rs
	src/libstd/unstable/lang.rs
	src/libstd/vec.rs
	src/rt/rustrt.def.in
	src/test/run-pass/extern-pub.rs
Diffstat (limited to 'src/libstd/rt')
-rw-r--r--src/libstd/rt/comm.rs30
-rw-r--r--src/libstd/rt/global_heap.rs173
-rw-r--r--src/libstd/rt/io/extensions.rs11
-rw-r--r--src/libstd/rt/io/mem.rs2
-rw-r--r--src/libstd/rt/join_latch.rs7
-rw-r--r--src/libstd/rt/local_heap.rs2
-rw-r--r--src/libstd/rt/message_queue.rs4
-rw-r--r--src/libstd/rt/mod.rs1
-rw-r--r--src/libstd/rt/rc.rs2
-rw-r--r--src/libstd/rt/sched.rs5
-rw-r--r--src/libstd/rt/stack.rs2
-rw-r--r--src/libstd/rt/task.rs2
-rw-r--r--src/libstd/rt/thread.rs2
-rw-r--r--src/libstd/rt/thread_local_storage.rs4
-rw-r--r--src/libstd/rt/uv/net.rs3
-rw-r--r--src/libstd/rt/uv/uvio.rs8
-rw-r--r--src/libstd/rt/uvio.rs7
-rw-r--r--src/libstd/rt/work_queue.rs4
18 files changed, 148 insertions, 121 deletions
diff --git a/src/libstd/rt/comm.rs b/src/libstd/rt/comm.rs
index 7608bc89e02..fba61711297 100644
--- a/src/libstd/rt/comm.rs
+++ b/src/libstd/rt/comm.rs
@@ -19,9 +19,9 @@ use option::*;
 use cast;
 use util;
 use ops::Drop;
-use kinds::Owned;
-use rt::sched::{Scheduler};
 use rt::task::Task;
+use kinds::Send;
+use rt::sched::Scheduler;
 use rt::local::Local;
 use unstable::atomics::{AtomicUint, AtomicOption, SeqCst};
 use unstable::sync::UnsafeAtomicRcBox;
@@ -71,7 +71,7 @@ pub struct PortOneHack<T> {
     suppress_finalize: bool
 }
 
-pub fn oneshot<T: Owned>() -> (PortOne<T>, ChanOne<T>) {
+pub fn oneshot<T: Send>() -> (PortOne<T>, ChanOne<T>) {
     let packet: ~Packet<T> = ~Packet {
         state: AtomicUint::new(STATE_BOTH),
         payload: None
@@ -242,7 +242,7 @@ impl<T> Peekable<T> for PortOne<T> {
 
 #[unsafe_destructor]
 impl<T> Drop for ChanOneHack<T> {
-    fn finalize(&self) {
+    fn drop(&self) {
         if self.suppress_finalize { return }
 
         unsafe {
@@ -269,7 +269,7 @@ impl<T> Drop for ChanOneHack<T> {
 
 #[unsafe_destructor]
 impl<T> Drop for PortOneHack<T> {
-    fn finalize(&self) {
+    fn drop(&self) {
         if self.suppress_finalize { return }
 
         unsafe {
@@ -330,20 +330,20 @@ pub struct Port<T> {
     next: Cell<StreamPortOne<T>>
 }
 
-pub fn stream<T: Owned>() -> (Port<T>, Chan<T>) {
+pub fn stream<T: Send>() -> (Port<T>, Chan<T>) {
     let (pone, cone) = oneshot();
     let port = Port { next: Cell::new(pone) };
     let chan = Chan { next: Cell::new(cone) };
     return (port, chan);
 }
 
-impl<T: Owned> GenericChan<T> for Chan<T> {
+impl<T: Send> GenericChan<T> for Chan<T> {
     fn send(&self, val: T) {
         self.try_send(val);
     }
 }
 
-impl<T: Owned> GenericSmartChan<T> for Chan<T> {
+impl<T: Send> GenericSmartChan<T> for Chan<T> {
     fn try_send(&self, val: T) -> bool {
         let (next_pone, next_cone) = oneshot();
         let cone = self.next.take();
@@ -393,13 +393,13 @@ impl<T> SharedChan<T> {
     }
 }
 
-impl<T: Owned> GenericChan<T> for SharedChan<T> {
+impl<T: Send> GenericChan<T> for SharedChan<T> {
     fn send(&self, val: T) {
         self.try_send(val);
     }
 }
 
-impl<T: Owned> GenericSmartChan<T> for SharedChan<T> {
+impl<T: Send> GenericSmartChan<T> for SharedChan<T> {
     fn try_send(&self, val: T) -> bool {
         unsafe {
             let (next_pone, next_cone) = oneshot();
@@ -433,7 +433,7 @@ impl<T> SharedPort<T> {
     }
 }
 
-impl<T: Owned> GenericPort<T> for SharedPort<T> {
+impl<T: Send> GenericPort<T> for SharedPort<T> {
     fn recv(&self) -> T {
         match self.try_recv() {
             Some(val) => val,
@@ -475,12 +475,12 @@ impl<T> Clone for SharedPort<T> {
 // XXX: Need better name
 type MegaPipe<T> = (SharedPort<T>, SharedChan<T>);
 
-pub fn megapipe<T: Owned>() -> MegaPipe<T> {
+pub fn megapipe<T: Send>() -> MegaPipe<T> {
     let (port, chan) = stream();
     (SharedPort::new(port), SharedChan::new(chan))
 }
 
-impl<T: Owned> GenericChan<T> for MegaPipe<T> {
+impl<T: Send> GenericChan<T> for MegaPipe<T> {
     fn send(&self, val: T) {
         match *self {
             (_, ref c) => c.send(val)
@@ -488,7 +488,7 @@ impl<T: Owned> GenericChan<T> for MegaPipe<T> {
     }
 }
 
-impl<T: Owned> GenericSmartChan<T> for MegaPipe<T> {
+impl<T: Send> GenericSmartChan<T> for MegaPipe<T> {
     fn try_send(&self, val: T) -> bool {
         match *self {
             (_, ref c) => c.try_send(val)
@@ -496,7 +496,7 @@ impl<T: Owned> GenericSmartChan<T> for MegaPipe<T> {
     }
 }
 
-impl<T: Owned> GenericPort<T> for MegaPipe<T> {
+impl<T: Send> GenericPort<T> for MegaPipe<T> {
     fn recv(&self) -> T {
         match *self {
             (ref p, _) => p.recv()
diff --git a/src/libstd/rt/global_heap.rs b/src/libstd/rt/global_heap.rs
index e89df2b1c93..4b475d74397 100644
--- a/src/libstd/rt/global_heap.rs
+++ b/src/libstd/rt/global_heap.rs
@@ -8,104 +8,129 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use sys::{TypeDesc, size_of};
-use libc::{c_void, size_t, uintptr_t};
-use c_malloc = libc::malloc;
-use c_free = libc::free;
+use libc::{c_void, c_char, size_t, uintptr_t, free, malloc, realloc};
 use managed::raw::{BoxHeaderRepr, BoxRepr};
-use cast::transmute;
-use unstable::intrinsics::{atomic_xadd,atomic_xsub, atomic_load};
-use ptr::null;
-use intrinsic::TyDesc;
+use unstable::intrinsics::TyDesc;
+use sys::size_of;
 
-pub unsafe fn malloc(td: *TypeDesc, size: uint) -> *c_void {
-    assert!(td.is_not_null());
-
-    let total_size = get_box_size(size, (*td).align);
-    let p = c_malloc(total_size as size_t);
-    assert!(p.is_not_null());
-
-    // FIXME #3475: Converting between our two different tydesc types
-    let td: *TyDesc = transmute(td);
-
-    let box: &mut BoxRepr = transmute(p);
-    box.header.ref_count = -1; // Exchange values not ref counted
-    box.header.type_desc = td;
-    box.header.prev = null();
-    box.header.next = null();
+extern {
+    #[rust_stack]
+    fn abort();
+}
 
-    inc_count();
+#[inline]
+fn get_box_size(body_size: uint, body_align: uint) -> uint {
+    let header_size = size_of::<BoxHeaderRepr>();
+    // FIXME (#2699): This alignment calculation is suspicious. Is it right?
+    let total_size = align_to(header_size, body_align) + body_size;
+    total_size
+}
 
-    return transmute(box);
+// Rounds |size| to the nearest |alignment|. Invariant: |alignment| is a power
+// of two.
+#[inline]
+fn align_to(size: uint, align: uint) -> uint {
+    assert!(align != 0);
+    (size + align - 1) & !(align - 1)
 }
-/**
-Thin wrapper around libc::malloc, none of the box header
-stuff in exchange_alloc::malloc
-*/
+
+/// A wrapper around libc::malloc, aborting on out-of-memory
+#[inline]
 pub unsafe fn malloc_raw(size: uint) -> *c_void {
-    let p = c_malloc(size as size_t);
+    let p = malloc(size as size_t);
     if p.is_null() {
-        fail!("Failure in malloc_raw: result ptr is null");
+        // we need a non-allocating way to print an error here
+        abort();
     }
-    inc_count();
     p
 }
 
-pub unsafe fn free(ptr: *c_void) {
-    assert!(ptr.is_not_null());
-    dec_count();
-    c_free(ptr);
+/// A wrapper around libc::realloc, aborting on out-of-memory
+#[inline]
+pub unsafe fn realloc_raw(ptr: *mut c_void, size: uint) -> *mut c_void {
+    let p = realloc(ptr, size as size_t);
+    if p.is_null() {
+        // we need a non-allocating way to print an error here
+        abort();
+    }
+    p
 }
-///Thin wrapper around libc::free, as with exchange_alloc::malloc_raw
-pub unsafe fn free_raw(ptr: *c_void) {
-    assert!(ptr.is_not_null());
-    dec_count();
-    c_free(ptr);
+
+// FIXME #4942: Make these signatures agree with exchange_alloc's signatures
+#[cfg(stage0, not(test))]
+#[lang="exchange_malloc"]
+#[inline]
+pub unsafe fn exchange_malloc_(td: *c_char, size: uintptr_t) -> *c_char {
+    exchange_malloc(td, size)
 }
 
-fn inc_count() {
-    unsafe {
-        let exchange_count = &mut *exchange_count_ptr();
-        atomic_xadd(exchange_count, 1);
-    }
+#[cfg(stage0)]
+#[inline]
+pub unsafe fn exchange_malloc(td: *c_char, size: uintptr_t) -> *c_char {
+    let td = td as *TyDesc;
+    let size = size as uint;
+
+    assert!(td.is_not_null());
+
+    let total_size = get_box_size(size, (*td).align);
+    let p = malloc_raw(total_size as uint);
+
+    let box: *mut BoxRepr = p as *mut BoxRepr;
+    (*box).header.ref_count = -1;
+    (*box).header.type_desc = td;
+
+    box as *c_char
 }
 
-fn dec_count() {
-    unsafe {
-        let exchange_count = &mut *exchange_count_ptr();
-        atomic_xsub(exchange_count, 1);
-    }
+// FIXME #4942: Make these signatures agree with exchange_alloc's signatures
+#[cfg(not(stage0), not(test))]
+#[lang="exchange_malloc"]
+#[inline]
+pub unsafe fn exchange_malloc_(align: u32, size: uintptr_t) -> *c_char {
+    exchange_malloc(align, size)
 }
 
-pub fn cleanup() {
-    unsafe {
-        let count_ptr = exchange_count_ptr();
-        let allocations = atomic_load(&*count_ptr);
-        if allocations != 0 {
-            rtabort!("exchange heap not empty on exit - %i dangling allocations", allocations);
-        }
-    }
+#[cfg(not(stage0))]
+#[inline]
+pub unsafe fn exchange_malloc(align: u32, size: uintptr_t) -> *c_char {
+    let total_size = get_box_size(size as uint, align as uint);
+    malloc_raw(total_size as uint) as *c_char
 }
 
-fn get_box_size(body_size: uint, body_align: uint) -> uint {
-    let header_size = size_of::<BoxHeaderRepr>();
-    // FIXME (#2699): This alignment calculation is suspicious. Is it right?
-    let total_size = align_to(header_size, body_align) + body_size;
-    return total_size;
+// FIXME: #7496
+#[cfg(not(test))]
+#[lang="closure_exchange_malloc"]
+#[inline]
+pub unsafe fn closure_exchange_malloc_(td: *c_char, size: uintptr_t) -> *c_char {
+    closure_exchange_malloc(td, size)
 }
 
-// Rounds |size| to the nearest |alignment|. Invariant: |alignment| is a power
-// of two.
-fn align_to(size: uint, align: uint) -> uint {
-    assert!(align != 0);
-    (size + align - 1) & !(align - 1)
+#[inline]
+pub unsafe fn closure_exchange_malloc(td: *c_char, size: uintptr_t) -> *c_char {
+    let td = td as *TyDesc;
+    let size = size as uint;
+
+    assert!(td.is_not_null());
+
+    let total_size = get_box_size(size, (*td).align);
+    let p = malloc_raw(total_size as uint);
+
+    let box: *mut BoxRepr = p as *mut BoxRepr;
+    (*box).header.type_desc = td;
+
+    box as *c_char
 }
 
-fn exchange_count_ptr() -> *mut int {
-    // XXX: Need mutable globals
-    unsafe { transmute(&rust_exchange_count) }
+// NB: Calls to free CANNOT be allowed to fail, as throwing an exception from
+// inside a landing pad may corrupt the state of the exception handler.
+#[cfg(not(test))]
+#[lang="exchange_free"]
+#[inline]
+pub unsafe fn exchange_free_(ptr: *c_char) {
+    exchange_free(ptr)
 }
 
-extern {
-    static rust_exchange_count: uintptr_t;
+#[inline]
+pub unsafe fn exchange_free(ptr: *c_char) {
+    free(ptr as *c_void);
 }
diff --git a/src/libstd/rt/io/extensions.rs b/src/libstd/rt/io/extensions.rs
index 55861f127bb..c6654e9dabe 100644
--- a/src/libstd/rt/io/extensions.rs
+++ b/src/libstd/rt/io/extensions.rs
@@ -292,13 +292,13 @@ impl<T: Reader> ReaderUtil for T {
             let start_len = buf.len();
             let mut total_read = 0;
 
-            vec::reserve_at_least(buf, start_len + len);
+            buf.reserve_at_least(start_len + len);
             vec::raw::set_len(buf, start_len + len);
 
             do (|| {
                 while total_read < len {
                     let len = buf.len();
-                    let slice = vec::mut_slice(*buf, start_len + total_read, len);
+                    let slice = buf.mut_slice(start_len + total_read, len);
                     match self.read(slice) {
                         Some(nread) => {
                             total_read += nread;
@@ -343,7 +343,9 @@ impl<T: Reader> ReaderByteConversions for T {
     fn read_le_uint_n(&mut self, nbytes: uint) -> u64 {
         assert!(nbytes > 0 && nbytes <= 8);
 
-        let mut (val, pos, i) = (0u64, 0, nbytes);
+        let mut val = 0u64;
+        let mut pos = 0;
+        let mut i = nbytes;
         while i > 0 {
             val += (self.read_u8() as u64) << pos;
             pos += 8;
@@ -359,7 +361,8 @@ impl<T: Reader> ReaderByteConversions for T {
     fn read_be_uint_n(&mut self, nbytes: uint) -> u64 {
         assert!(nbytes > 0 && nbytes <= 8);
 
-        let mut (val, i) = (0u64, nbytes);
+        let mut val = 0u64;
+        let mut i = nbytes;
         while i > 0 {
             i -= 1;
             val += (self.read_u8() as u64) << i * 8;
diff --git a/src/libstd/rt/io/mem.rs b/src/libstd/rt/io/mem.rs
index bd9cff76e57..c93945a6a9a 100644
--- a/src/libstd/rt/io/mem.rs
+++ b/src/libstd/rt/io/mem.rs
@@ -86,7 +86,7 @@ impl Reader for MemReader {
         let write_len = min(buf.len(), self.buf.len() - self.pos);
         {
             let input = self.buf.slice(self.pos, self.pos + write_len);
-            let output = vec::mut_slice(buf, 0, write_len);
+            let output = buf.mut_slice(0, write_len);
             assert_eq!(input.len(), output.len());
             vec::bytes::copy_memory(output, input, write_len);
         }
diff --git a/src/libstd/rt/join_latch.rs b/src/libstd/rt/join_latch.rs
index 79c0d5da9a4..8073c4a75b8 100644
--- a/src/libstd/rt/join_latch.rs
+++ b/src/libstd/rt/join_latch.rs
@@ -321,7 +321,7 @@ impl JoinLatch {
 }
 
 impl Drop for JoinLatch {
-    fn finalize(&self) {
+    fn drop(&self) {
         rtdebug!("DESTROYING %x", self.id());
         rtassert!(self.closed);
     }
@@ -333,7 +333,6 @@ mod test {
     use cell::Cell;
     use container::Container;
     use iter::Times;
-    use old_iter::BaseIter;
     use rt::test::*;
     use rand;
     use rand::RngUtil;
@@ -552,7 +551,7 @@ mod test {
                     rtdebug!("depth: %u", depth);
                     let mut remaining_orders = remaining_orders;
                     let mut num = 0;
-                    for my_orders.each |&order| {
+                    for my_orders.iter().advance |&order| {
                         let child_latch = latch.new_child();
                         let child_latch = Cell::new(child_latch);
                         let (child_orders, remaining) = split_orders(remaining_orders);
@@ -592,7 +591,7 @@ mod test {
             orders: ~[Order]
         }
         fn next(latch: &mut JoinLatch, orders: ~[Order]) {
-            for orders.each |order| {
+            for orders.iter().advance |order| {
                 let suborders = copy order.orders;
                 let child_latch = Cell::new(latch.new_child());
                 let succeed = order.succeed;
diff --git a/src/libstd/rt/local_heap.rs b/src/libstd/rt/local_heap.rs
index f62c9fb2c66..c909bdb6285 100644
--- a/src/libstd/rt/local_heap.rs
+++ b/src/libstd/rt/local_heap.rs
@@ -76,7 +76,7 @@ impl LocalHeap {
 }
 
 impl Drop for LocalHeap {
-    fn finalize(&self) {
+    fn drop(&self) {
         unsafe {
             rust_delete_boxed_region(self.boxed_region);
             rust_delete_memory_region(self.memory_region);
diff --git a/src/libstd/rt/message_queue.rs b/src/libstd/rt/message_queue.rs
index 734be808797..6ef07577415 100644
--- a/src/libstd/rt/message_queue.rs
+++ b/src/libstd/rt/message_queue.rs
@@ -12,7 +12,7 @@
 //! single consumer.
 
 use container::Container;
-use kinds::Owned;
+use kinds::Send;
 use vec::OwnedVector;
 use cell::Cell;
 use option::*;
@@ -24,7 +24,7 @@ pub struct MessageQueue<T> {
     priv queue: ~Exclusive<~[T]>
 }
 
-impl<T: Owned> MessageQueue<T> {
+impl<T: Send> MessageQueue<T> {
     pub fn new() -> MessageQueue<T> {
         MessageQueue {
             queue: ~exclusive(~[])
diff --git a/src/libstd/rt/mod.rs b/src/libstd/rt/mod.rs
index aae194ae548..b70549c266a 100644
--- a/src/libstd/rt/mod.rs
+++ b/src/libstd/rt/mod.rs
@@ -209,7 +209,6 @@ pub fn init(argc: int, argv: **u8, crate_map: *u8) {
 /// One-time runtime cleanup.
 pub fn cleanup() {
     args::cleanup();
-    global_heap::cleanup();
 }
 
 /// Execute the main function in a scheduler.
diff --git a/src/libstd/rt/rc.rs b/src/libstd/rt/rc.rs
index 2977d081508..18a5dd4a114 100644
--- a/src/libstd/rt/rc.rs
+++ b/src/libstd/rt/rc.rs
@@ -74,7 +74,7 @@ impl<T> RC<T> {
 
 #[unsafe_destructor]
 impl<T> Drop for RC<T> {
-    fn finalize(&self) {
+    fn drop(&self) {
         assert!(self.refcount() > 0);
 
         unsafe {
diff --git a/src/libstd/rt/sched.rs b/src/libstd/rt/sched.rs
index 7d8c673636e..6e9aef77730 100644
--- a/src/libstd/rt/sched.rs
+++ b/src/libstd/rt/sched.rs
@@ -1074,7 +1074,8 @@ mod test {
             let n_tasks = 10;
             let token = 2000;
 
-            let mut (p, ch1) = stream();
+            let (p, ch1) = stream();
+            let mut p = p;
             ch1.send((token, end_chan));
             let mut i = 2;
             while i <= n_tasks {
@@ -1127,7 +1128,7 @@ mod test {
             struct S { field: () }
 
             impl Drop for S {
-                fn finalize(&self) {
+                fn drop(&self) {
                     let _foo = @0;
                 }
             }
diff --git a/src/libstd/rt/stack.rs b/src/libstd/rt/stack.rs
index b0e87a62c8b..fbb516b2df4 100644
--- a/src/libstd/rt/stack.rs
+++ b/src/libstd/rt/stack.rs
@@ -49,7 +49,7 @@ impl StackSegment {
 }
 
 impl Drop for StackSegment {
-    fn finalize(&self) {
+    fn drop(&self) {
         unsafe {
             // XXX: Using the FFI to call a C macro. Slow
             rust_valgrind_stack_deregister(self.valgrind_id);
diff --git a/src/libstd/rt/task.rs b/src/libstd/rt/task.rs
index b2e4f0d4716..b4f4c1b3e35 100644
--- a/src/libstd/rt/task.rs
+++ b/src/libstd/rt/task.rs
@@ -219,7 +219,7 @@ impl Task {
 }
 
 impl Drop for Task {
-    fn finalize(&self) { assert!(self.destroyed) }
+    fn drop(&self) { assert!(self.destroyed) }
 }
 
 // Coroutines represent nothing more than a context and a stack
diff --git a/src/libstd/rt/thread.rs b/src/libstd/rt/thread.rs
index bc290191310..98d08c060e0 100644
--- a/src/libstd/rt/thread.rs
+++ b/src/libstd/rt/thread.rs
@@ -33,7 +33,7 @@ impl Thread {
 }
 
 impl Drop for Thread {
-    fn finalize(&self) {
+    fn drop(&self) {
         unsafe { rust_raw_thread_join_delete(self.raw_thread) }
     }
 }
diff --git a/src/libstd/rt/thread_local_storage.rs b/src/libstd/rt/thread_local_storage.rs
index 7187d2db41c..5041b559ecb 100644
--- a/src/libstd/rt/thread_local_storage.rs
+++ b/src/libstd/rt/thread_local_storage.rs
@@ -60,13 +60,13 @@ pub type Key = DWORD;
 #[cfg(windows)]
 pub unsafe fn create(key: &mut Key) {
     static TLS_OUT_OF_INDEXES: DWORD = 0xFFFFFFFF;
-    *key = unsafe { TlsAlloc() };
+    *key = TlsAlloc();
     assert!(*key != TLS_OUT_OF_INDEXES);
 }
 
 #[cfg(windows)]
 pub unsafe fn set(key: Key, value: *mut c_void) {
-    unsafe { assert!(0 != TlsSetValue(key, value)) }
+    assert!(0 != TlsSetValue(key, value))
 }
 
 #[cfg(windows)]
diff --git a/src/libstd/rt/uv/net.rs b/src/libstd/rt/uv/net.rs
index 4571747cebf..ada9aee35a7 100644
--- a/src/libstd/rt/uv/net.rs
+++ b/src/libstd/rt/uv/net.rs
@@ -389,7 +389,8 @@ mod test {
                     if status.is_none() {
                         rtdebug!("got %d bytes", nread);
                         let buf = buf.unwrap();
-                        for buf.slice(0, nread as uint).each |byte| {
+                        let r = buf.slice(0, nread as uint);
+                        for r.iter().advance |byte| {
                             assert!(*byte == count as u8);
                             rtdebug!("%u", *byte as uint);
                             count += 1;
diff --git a/src/libstd/rt/uv/uvio.rs b/src/libstd/rt/uv/uvio.rs
index b1708e70733..69d14dbf9a1 100644
--- a/src/libstd/rt/uv/uvio.rs
+++ b/src/libstd/rt/uv/uvio.rs
@@ -47,7 +47,7 @@ impl UvEventLoop {
 }
 
 impl Drop for UvEventLoop {
-    fn finalize(&self) {
+    fn drop(&self) {
         // XXX: Need mutable finalizer
         let this = unsafe {
             transmute::<&UvEventLoop, &mut UvEventLoop>(self)
@@ -139,7 +139,7 @@ impl RemoteCallback for UvRemoteCallback {
 }
 
 impl Drop for UvRemoteCallback {
-    fn finalize(&self) {
+    fn drop(&self) {
         unsafe {
             let this: &mut UvRemoteCallback = cast::transmute_mut(self);
             do this.exit_flag.with |should_exit| {
@@ -285,7 +285,7 @@ impl UvTcpListener {
 }
 
 impl Drop for UvTcpListener {
-    fn finalize(&self) {
+    fn drop(&self) {
         let watcher = self.watcher();
         let scheduler = Local::take::<Scheduler>();
         do scheduler.deschedule_running_task_and_then |_, task| {
@@ -346,7 +346,7 @@ impl UvTcpStream {
 }
 
 impl Drop for UvTcpStream {
-    fn finalize(&self) {
+    fn drop(&self) {
         rtdebug!("closing tcp stream");
         let watcher = self.watcher();
         let scheduler = Local::take::<Scheduler>();
diff --git a/src/libstd/rt/uvio.rs b/src/libstd/rt/uvio.rs
index 070ccf7fb44..0187ad3abf5 100644
--- a/src/libstd/rt/uvio.rs
+++ b/src/libstd/rt/uvio.rs
@@ -15,7 +15,6 @@ use super::io::net::ip::IpAddr;
 use super::uv::*;
 use super::rtio::*;
 use ops::Drop;
-use old_iter::CopyableIter;
 use cell::Cell;
 use cast::transmute;
 use super::sched::{Scheduler, local_sched};
@@ -43,7 +42,7 @@ impl UvEventLoop {
 }
 
 impl Drop for UvEventLoop {
-    fn finalize(&self) {
+    fn drop(&self) {
         // XXX: Need mutable finalizer
         let this = unsafe {
             transmute::<&UvEventLoop, &mut UvEventLoop>(self)
@@ -165,7 +164,7 @@ impl UvTcpListener {
 }
 
 impl Drop for UvTcpListener {
-    fn finalize(&self) {
+    fn drop(&self) {
         // XXX: Again, this never gets called. Use .close() instead
         //self.watcher().as_stream().close(||());
     }
@@ -231,7 +230,7 @@ impl UvStream {
 }
 
 impl Drop for UvStream {
-    fn finalize(&self) {
+    fn drop(&self) {
         rtdebug!("closing stream");
         //self.watcher().close(||());
     }
diff --git a/src/libstd/rt/work_queue.rs b/src/libstd/rt/work_queue.rs
index cfffc55a58c..00d27744268 100644
--- a/src/libstd/rt/work_queue.rs
+++ b/src/libstd/rt/work_queue.rs
@@ -13,7 +13,7 @@ use option::*;
 use vec::OwnedVector;
 use unstable::sync::{Exclusive, exclusive};
 use cell::Cell;
-use kinds::Owned;
+use kinds::Send;
 use clone::Clone;
 
 pub struct WorkQueue<T> {
@@ -21,7 +21,7 @@ pub struct WorkQueue<T> {
     priv queue: ~Exclusive<~[T]>
 }
 
-impl<T: Owned> WorkQueue<T> {
+impl<T: Send> WorkQueue<T> {
     pub fn new() -> WorkQueue<T> {
         WorkQueue {
             queue: ~exclusive(~[])