diff --git a/src/libextra/workcache.rs b/src/libextra/workcache.rs index 4d3b5ae035edc..24ab8360e8fab 100644 --- a/src/libextra/workcache.rs +++ b/src/libextra/workcache.rs @@ -198,7 +198,6 @@ impl Database { } } -// FIXME #4330: use &mut self here #[unsafe_destructor] impl Drop for Database { fn drop(&mut self) { diff --git a/src/libstd/rt/rc.rs b/src/libstd/rt/rc.rs index 0a6890f627bbb..2ba00c3a2fbac 100644 --- a/src/libstd/rt/rc.rs +++ b/src/libstd/rt/rc.rs @@ -78,17 +78,14 @@ impl Drop for RC { assert!(self.refcount() > 0); unsafe { - // FIXME(#4330) Need self by value to get mutability. - let this: &mut RC = 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); } } } diff --git a/src/libstd/rt/uv/uvio.rs b/src/libstd/rt/uv/uvio.rs index f3b97441e8e25..8c827430f2552 100644 --- a/src/libstd/rt/uv/uvio.rs +++ b/src/libstd/rt/uv/uvio.rs @@ -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(); } } @@ -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 { @@ -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 { @@ -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 { diff --git a/src/libstd/unstable/atomics.rs b/src/libstd/unstable/atomics.rs index a32b52db1cc0a..e8835462a80e2 100644 --- a/src/libstd/unstable/atomics.rs +++ b/src/libstd/unstable/atomics.rs @@ -339,13 +339,7 @@ impl AtomicOption { #[unsafe_destructor] impl Drop for AtomicOption { 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 = cast::transmute(self); - let _ = this.take(SeqCst); - } + let _ = self.take(SeqCst); } }