From 8081aea3b86d9e25746ff03acabe53c3644b600c Mon Sep 17 00:00:00 2001 From: Ben Blum Date: Mon, 10 Jun 2013 18:18:04 -0400 Subject: [PATCH] Tag a bunch of destructors that need mutable self with FIXME for #4330. Close #4943. --- src/libstd/pipes.rs | 1 + src/libstd/rt/rc.rs | 2 +- src/libstd/run.rs | 2 +- src/libstd/task/spawn.rs | 1 + src/libstd/unstable/atomics.rs | 1 + 5 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/libstd/pipes.rs b/src/libstd/pipes.rs index 1137540ae70..012ad0ed80d 100644 --- a/src/libstd/pipes.rs +++ b/src/libstd/pipes.rs @@ -315,6 +315,7 @@ struct BufferResource { impl Drop for BufferResource { fn finalize(&self) { unsafe { + // FIXME(#4330) Need self by value to get mutability. let this: &mut BufferResource = transmute(self); let mut b = move_it!(this.buffer); diff --git a/src/libstd/rt/rc.rs b/src/libstd/rt/rc.rs index 1c0c8c14fdf..2977d081508 100644 --- a/src/libstd/rt/rc.rs +++ b/src/libstd/rt/rc.rs @@ -78,7 +78,7 @@ impl Drop for RC { assert!(self.refcount() > 0); unsafe { - // XXX: Mutable finalizer + // FIXME(#4330) Need self by value to get mutability. let this: &mut RC = cast::transmute_mut(self); match *this.get_mut_state() { diff --git a/src/libstd/run.rs b/src/libstd/run.rs index 41bc573f10d..85015c9bc5e 100644 --- a/src/libstd/run.rs +++ b/src/libstd/run.rs @@ -429,7 +429,7 @@ impl Process { impl Drop for Process { fn finalize(&self) { - // FIXME #4943: transmute is bad. + // FIXME(#4330) Need self by value to get mutability. let mut_self: &mut Process = unsafe { cast::transmute(self) }; mut_self.finish(); diff --git a/src/libstd/task/spawn.rs b/src/libstd/task/spawn.rs index 87e9296657f..bc409e06633 100644 --- a/src/libstd/task/spawn.rs +++ b/src/libstd/task/spawn.rs @@ -323,6 +323,7 @@ impl Drop for TCB { // Runs on task exit. fn finalize(&self) { unsafe { + // FIXME(#4330) Need self by value to get mutability. let this: &mut TCB = transmute(self); // If we are failing, the whole taskgroup needs to die. diff --git a/src/libstd/unstable/atomics.rs b/src/libstd/unstable/atomics.rs index 58d0c01f990..856f4e6e3c1 100644 --- a/src/libstd/unstable/atomics.rs +++ b/src/libstd/unstable/atomics.rs @@ -275,6 +275,7 @@ impl Drop for AtomicOption { // This will ensure that the contained data is // destroyed, unless it's null. unsafe { + // FIXME(#4330) Need self by value to get mutability. let this : &mut AtomicOption = cast::transmute(self); let _ = this.take(SeqCst); }