switch Drop to &mut self

This commit is contained in:
Daniel Micay 2013-09-16 21:18:07 -04:00
parent bc89ade401
commit 4e161a4d40
129 changed files with 192 additions and 203 deletions

View file

@ -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() */

View file

@ -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| {

View file

@ -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()

View file

@ -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();
}
}

View file

@ -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> {

View file

@ -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;

View file

@ -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);
}

View file

@ -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();
}