Skip to content

Commit

Permalink
Tag a bunch of destructors that need mutable self with FIXME for #4330.
Browse files Browse the repository at this point in the history
Close #4943.
  • Loading branch information
bblum committed Jun 10, 2013
1 parent d25fae0 commit 8081aea
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/libstd/pipes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/rt/rc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions src/libstd/task/spawn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions src/libstd/unstable/atomics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

5 comments on commit 8081aea

@bors
Copy link
Contributor

@bors bors commented on 8081aea Jun 11, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from graydon
at bblum@8081aea

@bors
Copy link
Contributor

@bors bors commented on 8081aea Jun 11, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging bblum/rust/bug_triage = 8081aea into auto

@bors
Copy link
Contributor

@bors bors commented on 8081aea Jun 11, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bblum/rust/bug_triage = 8081aea merged ok, testing candidate = d1d8559

@bors
Copy link
Contributor

@bors bors commented on 8081aea Jun 11, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on 8081aea Jun 11, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding incoming to auto = d1d8559

Please sign in to comment.