Tag a bunch of destructors that need mutable self with FIXME for #4330. Close #4943.

This commit is contained in:
Ben Blum 2013-06-10 18:18:04 -04:00
parent d25fae0e10
commit 8081aea3b8
5 changed files with 5 additions and 2 deletions

View File

@ -315,6 +315,7 @@ struct BufferResource<T> {
impl<T> Drop for BufferResource<T> {
fn finalize(&self) {
unsafe {
// FIXME(#4330) Need self by value to get mutability.
let this: &mut BufferResource<T> = transmute(self);
let mut b = move_it!(this.buffer);

View File

@ -78,7 +78,7 @@ impl<T> Drop for RC<T> {
assert!(self.refcount() > 0);
unsafe {
// XXX: Mutable finalizer
// FIXME(#4330) Need self by value to get mutability.
let this: &mut RC<T> = cast::transmute_mut(self);
match *this.get_mut_state() {

View File

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

View File

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

View File

@ -275,6 +275,7 @@ impl<T> Drop for AtomicOption<T> {
// 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<T> = cast::transmute(self);
let _ = this.take(SeqCst);
}