Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/libextra/workcache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ impl Database {
}
}

// FIXME #4330: use &mut self here
#[unsafe_destructor]
impl Drop for Database {
fn drop(&mut self) {
Expand Down
9 changes: 3 additions & 6 deletions src/libstd/rt/rc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,14 @@ impl<T> Drop for RC<T> {
assert!(self.refcount() > 0);

unsafe {
// FIXME(#4330) Need self by value to get mutability.
let this: &mut RC<T> = cast::transmute_mut(self);

match *this.get_mut_state() {
match *self.get_mut_state() {
(ref mut count, _) => {
*count = *count - 1
}
}

if this.refcount() == 0 {
let _: ~(uint, T) = cast::transmute(this.p);
if self.refcount() == 0 {
let _: ~(uint, T) = cast::transmute(self.p);
}
}
}
Expand Down
18 changes: 4 additions & 14 deletions src/libstd/rt/uv/uvio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,7 @@ impl UvEventLoop {

impl Drop for UvEventLoop {
fn drop(&mut self) {
// XXX: Need mutable finalizer
let this = unsafe {
transmute::<&UvEventLoop, &mut UvEventLoop>(self)
};
this.uvio.uv_loop().close();
self.uvio.uv_loop().close();
}
}

Expand Down Expand Up @@ -648,9 +644,7 @@ impl UvTcpListener {

impl Drop for UvTcpListener {
fn drop(&mut self) {
// XXX need mutable finalizer
let self_ = unsafe { transmute::<&UvTcpListener, &mut UvTcpListener>(self) };
do self_.home_for_io_with_sched |self_, scheduler| {
do self.home_for_io_with_sched |self_, scheduler| {
do scheduler.deschedule_running_task_and_then |_, task| {
let task = Cell::new(task);
do self_.watcher.as_stream().close {
Expand Down Expand Up @@ -763,9 +757,7 @@ impl HomingIO for UvTcpStream {

impl Drop for UvTcpStream {
fn drop(&mut self) {
// XXX need mutable finalizer
let this = unsafe { transmute::<&UvTcpStream, &mut UvTcpStream>(self) };
do this.home_for_io_with_sched |self_, scheduler| {
do self.home_for_io_with_sched |self_, scheduler| {
do scheduler.deschedule_running_task_and_then |_, task| {
let task_cell = Cell::new(task);
do self_.watcher.as_stream().close {
Expand Down Expand Up @@ -922,9 +914,7 @@ impl HomingIO for UvUdpSocket {

impl Drop for UvUdpSocket {
fn drop(&mut self) {
// XXX need mutable finalizer
let this = unsafe { transmute::<&UvUdpSocket, &mut UvUdpSocket>(self) };
do this.home_for_io_with_sched |self_, scheduler| {
do self.home_for_io_with_sched |self_, scheduler| {
do scheduler.deschedule_running_task_and_then |_, task| {
let task_cell = Cell::new(task);
do self_.watcher.close {
Expand Down
8 changes: 1 addition & 7 deletions src/libstd/unstable/atomics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,13 +339,7 @@ impl<T> AtomicOption<T> {
#[unsafe_destructor]
impl<T> Drop for AtomicOption<T> {
fn drop(&mut self) {
// 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);
}
let _ = self.take(SeqCst);
}
}

Expand Down