about summary refs log tree commit diff
path: root/src/libextra
diff options
context:
space:
mode:
authorDaniel Micay <danielmicay@gmail.com>2013-09-16 21:18:07 -0400
committerDaniel Micay <danielmicay@gmail.com>2013-09-16 22:19:23 -0400
commit4e161a4d401224507513bfbf33b22f0b72f8ba81 (patch)
tree59cd25a1d2132de130ddacc5ca2d25d39a511195 /src/libextra
parentbc89ade401e637fcb7d4d1d0b7f356ca359b0e7d (diff)
downloadrust-4e161a4d401224507513bfbf33b22f0b72f8ba81.tar.gz
rust-4e161a4d401224507513bfbf33b22f0b72f8ba81.zip
switch Drop to `&mut self`
Diffstat (limited to 'src/libextra')
-rw-r--r--src/libextra/arc.rs2
-rw-r--r--src/libextra/arena.rs2
-rw-r--r--src/libextra/c_vec.rs2
-rw-r--r--src/libextra/dlist.rs13
-rw-r--r--src/libextra/future.rs2
-rw-r--r--src/libextra/rc.rs4
-rw-r--r--src/libextra/task_pool.rs2
-rw-r--r--src/libextra/workcache.rs2
8 files changed, 13 insertions, 16 deletions
diff --git a/src/libextra/arc.rs b/src/libextra/arc.rs
index 3fbfae52c63..ca8000c984d 100644
--- a/src/libextra/arc.rs
+++ b/src/libextra/arc.rs
@@ -313,7 +313,7 @@ struct PoisonOnFail {
 }
 
 impl Drop for PoisonOnFail {
-    fn drop(&self) {
+    fn drop(&mut self) {
         unsafe {
             /* assert!(!*self.failed);
                -- might be false in case of cond.wait() */
diff --git a/src/libextra/arena.rs b/src/libextra/arena.rs
index e24e747d61a..63c8e2010b0 100644
--- a/src/libextra/arena.rs
+++ b/src/libextra/arena.rs
@@ -93,7 +93,7 @@ fn chunk(size: uint, is_pod: bool) -> Chunk {
 
 #[unsafe_destructor]
 impl Drop for Arena {
-    fn drop(&self) {
+    fn drop(&mut self) {
         unsafe {
             destroy_chunk(&self.head);
             do self.chunks.each |chunk| {
diff --git a/src/libextra/c_vec.rs b/src/libextra/c_vec.rs
index 6ae67e7c794..30bce3a8170 100644
--- a/src/libextra/c_vec.rs
+++ b/src/libextra/c_vec.rs
@@ -56,7 +56,7 @@ struct DtorRes {
 
 #[unsafe_destructor]
 impl Drop for DtorRes {
-    fn drop(&self) {
+    fn drop(&mut self) {
         match self.dtor {
             option::None => (),
             option::Some(f) => f()
diff --git a/src/libextra/dlist.rs b/src/libextra/dlist.rs
index ac296ad527e..da5d5d00e80 100644
--- a/src/libextra/dlist.rs
+++ b/src/libextra/dlist.rs
@@ -415,14 +415,11 @@ impl<T: Ord> DList<T> {
 
 #[unsafe_destructor]
 impl<T> Drop for DList<T> {
-    fn drop(&self) {
-        let mut_self = unsafe {
-            cast::transmute_mut(self)
-        };
+    fn drop(&mut self) {
         // Dissolve the dlist in backwards direction
         // Just dropping the list_head can lead to stack exhaustion
         // when length is >> 1_000_000
-        let mut tail = mut_self.list_tail;
+        let mut tail = self.list_tail;
         loop {
             match tail.resolve() {
                 None => break,
@@ -432,9 +429,9 @@ impl<T> Drop for DList<T> {
                 }
             }
         }
-        mut_self.length = 0;
-        mut_self.list_head = None;
-        mut_self.list_tail = Rawlink::none();
+        self.length = 0;
+        self.list_head = None;
+        self.list_tail = Rawlink::none();
     }
 }
 
diff --git a/src/libextra/future.rs b/src/libextra/future.rs
index ce56a3dcaa6..74a551c6f6d 100644
--- a/src/libextra/future.rs
+++ b/src/libextra/future.rs
@@ -43,7 +43,7 @@ pub struct Future<A> {
 // over ~fn's that have pipes and so forth within!
 #[unsafe_destructor]
 impl<A> Drop for Future<A> {
-    fn drop(&self) {}
+    fn drop(&mut self) {}
 }
 
 enum FutureState<A> {
diff --git a/src/libextra/rc.rs b/src/libextra/rc.rs
index 86fbbd4c3cc..fa7cd9025eb 100644
--- a/src/libextra/rc.rs
+++ b/src/libextra/rc.rs
@@ -73,7 +73,7 @@ impl<T> Rc<T> {
 
 #[unsafe_destructor]
 impl<T> Drop for Rc<T> {
-    fn drop(&self) {
+    fn drop(&mut self) {
         unsafe {
             if self.ptr.is_not_null() {
                 (*self.ptr).count -= 1;
@@ -218,7 +218,7 @@ impl<T> RcMut<T> {
 
 #[unsafe_destructor]
 impl<T> Drop for RcMut<T> {
-    fn drop(&self) {
+    fn drop(&mut self) {
         unsafe {
             if self.ptr.is_not_null() {
                 (*self.ptr).count -= 1;
diff --git a/src/libextra/task_pool.rs b/src/libextra/task_pool.rs
index f1bf9e81c72..46244c15a83 100644
--- a/src/libextra/task_pool.rs
+++ b/src/libextra/task_pool.rs
@@ -34,7 +34,7 @@ pub struct TaskPool<T> {
 
 #[unsafe_destructor]
 impl<T> Drop for TaskPool<T> {
-    fn drop(&self) {
+    fn drop(&mut self) {
         for channel in self.channels.iter() {
             channel.send(Quit);
         }
diff --git a/src/libextra/workcache.rs b/src/libextra/workcache.rs
index 2b2ecb79294..4d3b5ae035e 100644
--- a/src/libextra/workcache.rs
+++ b/src/libextra/workcache.rs
@@ -201,7 +201,7 @@ impl Database {
 // FIXME #4330: use &mut self here
 #[unsafe_destructor]
 impl Drop for Database {
-    fn drop(&self) {
+    fn drop(&mut self) {
         if self.db_dirty {
             self.save();
         }