Skip to content

Commit 8081aea

Browse files
committed
Tag a bunch of destructors that need mutable self with FIXME for rust-lang#4330. Close rust-lang#4943.
1 parent d25fae0 commit 8081aea

File tree

5 files changed

+5
-2
lines changed

5 files changed

+5
-2
lines changed

Diff for: src/libstd/pipes.rs

+1
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@ struct BufferResource<T> {
315315
impl<T> Drop for BufferResource<T> {
316316
fn finalize(&self) {
317317
unsafe {
318+
// FIXME(#4330) Need self by value to get mutability.
318319
let this: &mut BufferResource<T> = transmute(self);
319320

320321
let mut b = move_it!(this.buffer);

Diff for: src/libstd/rt/rc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ impl<T> Drop for RC<T> {
7878
assert!(self.refcount() > 0);
7979

8080
unsafe {
81-
// XXX: Mutable finalizer
81+
// FIXME(#4330) Need self by value to get mutability.
8282
let this: &mut RC<T> = cast::transmute_mut(self);
8383

8484
match *this.get_mut_state() {

Diff for: src/libstd/run.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ impl Process {
429429

430430
impl Drop for Process {
431431
fn finalize(&self) {
432-
// FIXME #4943: transmute is bad.
432+
// FIXME(#4330) Need self by value to get mutability.
433433
let mut_self: &mut Process = unsafe { cast::transmute(self) };
434434

435435
mut_self.finish();

Diff for: src/libstd/task/spawn.rs

+1
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@ impl Drop for TCB {
323323
// Runs on task exit.
324324
fn finalize(&self) {
325325
unsafe {
326+
// FIXME(#4330) Need self by value to get mutability.
326327
let this: &mut TCB = transmute(self);
327328

328329
// If we are failing, the whole taskgroup needs to die.

Diff for: src/libstd/unstable/atomics.rs

+1
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ impl<T> Drop for AtomicOption<T> {
275275
// This will ensure that the contained data is
276276
// destroyed, unless it's null.
277277
unsafe {
278+
// FIXME(#4330) Need self by value to get mutability.
278279
let this : &mut AtomicOption<T> = cast::transmute(self);
279280
let _ = this.take(SeqCst);
280281
}

0 commit comments

Comments
 (0)