switch Drop to &mut self
This commit is contained in:
parent
bc89ade401
commit
4e161a4d40
129 changed files with 192 additions and 203 deletions
|
@ -321,7 +321,7 @@ impl<T: Send> Unique<T> {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl<T: Send> Drop for Unique<T> {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
#[fixed_stack_segment];
|
||||
#[inline(never)];
|
||||
|
||||
|
|
|
@ -1898,7 +1898,7 @@ struct TimeBomb {
|
|||
}
|
||||
|
||||
impl Drop for TimeBomb {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
for _ in range(0, self.explosivity) {
|
||||
println("blam!");
|
||||
}
|
||||
|
|
|
@ -313,7 +313,7 @@ struct PoisonOnFail {
|
|||
}
|
||||
|
||||
impl Drop for PoisonOnFail {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
/* assert!(!*self.failed);
|
||||
-- might be false in case of cond.wait() */
|
||||
|
|
|
@ -93,7 +93,7 @@ fn chunk(size: uint, is_pod: bool) -> Chunk {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl Drop for Arena {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
destroy_chunk(&self.head);
|
||||
do self.chunks.each |chunk| {
|
||||
|
|
|
@ -56,7 +56,7 @@ struct DtorRes {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl Drop for DtorRes {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
match self.dtor {
|
||||
option::None => (),
|
||||
option::Some(f) => f()
|
||||
|
|
|
@ -415,14 +415,11 @@ impl<T: Ord> DList<T> {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl<T> Drop for DList<T> {
|
||||
fn drop(&self) {
|
||||
let mut_self = unsafe {
|
||||
cast::transmute_mut(self)
|
||||
};
|
||||
fn drop(&mut self) {
|
||||
// Dissolve the dlist in backwards direction
|
||||
// Just dropping the list_head can lead to stack exhaustion
|
||||
// when length is >> 1_000_000
|
||||
let mut tail = mut_self.list_tail;
|
||||
let mut tail = self.list_tail;
|
||||
loop {
|
||||
match tail.resolve() {
|
||||
None => break,
|
||||
|
@ -432,9 +429,9 @@ impl<T> Drop for DList<T> {
|
|||
}
|
||||
}
|
||||
}
|
||||
mut_self.length = 0;
|
||||
mut_self.list_head = None;
|
||||
mut_self.list_tail = Rawlink::none();
|
||||
self.length = 0;
|
||||
self.list_head = None;
|
||||
self.list_tail = Rawlink::none();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ pub struct Future<A> {
|
|||
// over ~fn's that have pipes and so forth within!
|
||||
#[unsafe_destructor]
|
||||
impl<A> Drop for Future<A> {
|
||||
fn drop(&self) {}
|
||||
fn drop(&mut self) {}
|
||||
}
|
||||
|
||||
enum FutureState<A> {
|
||||
|
|
|
@ -73,7 +73,7 @@ impl<T> Rc<T> {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl<T> Drop for Rc<T> {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if self.ptr.is_not_null() {
|
||||
(*self.ptr).count -= 1;
|
||||
|
@ -218,7 +218,7 @@ impl<T> RcMut<T> {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl<T> Drop for RcMut<T> {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if self.ptr.is_not_null() {
|
||||
(*self.ptr).count -= 1;
|
||||
|
|
|
@ -34,7 +34,7 @@ pub struct TaskPool<T> {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl<T> Drop for TaskPool<T> {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
for channel in self.channels.iter() {
|
||||
channel.send(Quit);
|
||||
}
|
||||
|
|
|
@ -201,7 +201,7 @@ impl Database {
|
|||
// FIXME #4330: use &mut self here
|
||||
#[unsafe_destructor]
|
||||
impl Drop for Database {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
if self.db_dirty {
|
||||
self.save();
|
||||
}
|
||||
|
|
|
@ -105,7 +105,7 @@ pub mod jit {
|
|||
impl Engine for LLVMJITData {}
|
||||
|
||||
impl Drop for LLVMJITData {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
llvm::LLVMDisposeExecutionEngine(self.ee);
|
||||
llvm::LLVMContextDispose(self.llcx);
|
||||
|
|
|
@ -2325,7 +2325,7 @@ pub struct target_data_res {
|
|||
}
|
||||
|
||||
impl Drop for target_data_res {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
llvm::LLVMDisposeTargetData(self.TD);
|
||||
}
|
||||
|
@ -2361,7 +2361,7 @@ pub struct pass_manager_res {
|
|||
}
|
||||
|
||||
impl Drop for pass_manager_res {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
llvm::LLVMDisposePassManager(self.PM);
|
||||
}
|
||||
|
@ -2397,7 +2397,7 @@ pub struct object_file_res {
|
|||
}
|
||||
|
||||
impl Drop for object_file_res {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
llvm::LLVMDisposeObjectFile(self.ObjectFile);
|
||||
}
|
||||
|
@ -2434,7 +2434,7 @@ pub struct section_iter_res {
|
|||
}
|
||||
|
||||
impl Drop for section_iter_res {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
llvm::LLVMDisposeSectionIterator(self.SI);
|
||||
}
|
||||
|
|
|
@ -109,7 +109,7 @@ pub struct _InsnCtxt { _x: () }
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl Drop for _InsnCtxt {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
do local_data::modify(task_local_insn_key) |c| {
|
||||
do c.map_move |ctx| {
|
||||
let mut ctx = (*ctx).clone();
|
||||
|
@ -159,7 +159,7 @@ impl<'self> StatRecorder<'self> {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl<'self> Drop for StatRecorder<'self> {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
if self.ccx.sess.trans_stats() {
|
||||
let end = time::precise_time_ns();
|
||||
let elapsed = ((end - self.start) / 1_000_000) as uint;
|
||||
|
|
|
@ -111,7 +111,7 @@ pub struct BuilderRef_res {
|
|||
}
|
||||
|
||||
impl Drop for BuilderRef_res {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
llvm::LLVMDisposeBuilder(self.B);
|
||||
}
|
||||
|
|
|
@ -273,7 +273,7 @@ impl CrateContext {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl Drop for CrateContext {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
unset_task_llcx();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -342,7 +342,7 @@ pub fn monitor(f: ~fn(diagnostic::Emitter)) {
|
|||
}
|
||||
|
||||
impl Drop for finally {
|
||||
fn drop(&self) { self.ch.send(done); }
|
||||
fn drop(&mut self) { self.ch.send(done); }
|
||||
}
|
||||
|
||||
let _finally = finally { ch: ch };
|
||||
|
|
|
@ -40,7 +40,7 @@ pub struct _indenter {
|
|||
}
|
||||
|
||||
impl Drop for _indenter {
|
||||
fn drop(&self) { debug!("<<"); }
|
||||
fn drop(&mut self) { debug!("<<"); }
|
||||
}
|
||||
|
||||
pub fn _indenter(_i: ()) -> _indenter {
|
||||
|
|
|
@ -127,7 +127,7 @@ struct Bored {
|
|||
}
|
||||
|
||||
impl Drop for Bored {
|
||||
fn drop(&self) { }
|
||||
fn drop(&mut self) { }
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -127,7 +127,7 @@ impl CString {
|
|||
}
|
||||
|
||||
impl Drop for CString {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
#[fixed_stack_segment]; #[inline(never)];
|
||||
if self.owns_buffer_ {
|
||||
unsafe {
|
||||
|
|
|
@ -87,7 +87,7 @@ struct Guard<'self, T, U> {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl<'self, T, U> Drop for Guard<'self, T, U> {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
debug!("Guard: popping handler from TLS");
|
||||
let curr = local_data::pop(self.cond.key);
|
||||
match curr {
|
||||
|
|
|
@ -1021,7 +1021,7 @@ impl FILERes {
|
|||
}
|
||||
|
||||
impl Drop for FILERes {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
#[fixed_stack_segment]; #[inline(never)];
|
||||
|
||||
unsafe {
|
||||
|
@ -1302,7 +1302,7 @@ impl FdRes {
|
|||
}
|
||||
|
||||
impl Drop for FdRes {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
#[fixed_stack_segment]; #[inline(never)];
|
||||
|
||||
unsafe {
|
||||
|
@ -1832,7 +1832,7 @@ pub mod fsync {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl<T> Drop for Res<T> {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
match self.arg.opt_level {
|
||||
None => (),
|
||||
Some(level) => {
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
#[lang="drop"]
|
||||
pub trait Drop {
|
||||
fn drop(&self);
|
||||
fn drop(&mut self);
|
||||
}
|
||||
|
||||
#[lang="add"]
|
||||
|
@ -95,7 +95,7 @@ mod bench {
|
|||
}
|
||||
|
||||
impl Drop for HasDtor {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105,4 +105,4 @@ mod bench {
|
|||
HasDtor { x : 10 };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -573,7 +573,7 @@ mod tests {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl ::ops::Drop for R {
|
||||
fn drop(&self) { *(self.i) += 1; }
|
||||
fn drop(&mut self) { *(self.i) += 1; }
|
||||
}
|
||||
|
||||
fn R(i: @mut int) -> R {
|
||||
|
|
|
@ -1481,7 +1481,7 @@ impl MemoryMap {
|
|||
|
||||
#[cfg(unix)]
|
||||
impl Drop for MemoryMap {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
#[fixed_stack_segment]; #[inline(never)];
|
||||
|
||||
unsafe {
|
||||
|
@ -1607,7 +1607,7 @@ impl MemoryMap {
|
|||
|
||||
#[cfg(windows)]
|
||||
impl Drop for MemoryMap {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
#[fixed_stack_segment]; #[inline(never)];
|
||||
|
||||
use libc::types::os::arch::extra::{LPCVOID, HANDLE};
|
||||
|
|
|
@ -363,7 +363,7 @@ impl<T> Peekable<T> for PortOne<T> {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl<T> Drop for ChanOne<T> {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
if self.suppress_finalize { return }
|
||||
|
||||
unsafe {
|
||||
|
@ -391,7 +391,7 @@ impl<T> Drop for ChanOne<T> {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl<T> Drop for PortOne<T> {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
if self.suppress_finalize { return }
|
||||
|
||||
unsafe {
|
||||
|
|
|
@ -235,7 +235,7 @@ pub struct Death {
|
|||
impl Drop for KillFlag {
|
||||
// Letting a KillFlag with a task inside get dropped would leak the task.
|
||||
// We could free it here, but the task should get awoken by hand somehow.
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
match self.load(Relaxed) {
|
||||
KILL_RUNNING | KILL_KILLED => { },
|
||||
_ => rtabort!("can't drop kill flag with a blocked task inside!"),
|
||||
|
@ -685,7 +685,7 @@ impl Death {
|
|||
}
|
||||
|
||||
impl Drop for Death {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
// Mustn't be in an atomic or unkillable section at task death.
|
||||
rtassert!(self.unkillable == 0);
|
||||
rtassert!(self.wont_sleep == 0);
|
||||
|
|
|
@ -78,7 +78,7 @@ impl LocalHeap {
|
|||
|
||||
impl Drop for LocalHeap {
|
||||
#[fixed_stack_segment] #[inline(never)]
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
rust_delete_boxed_region(self.boxed_region);
|
||||
rust_delete_memory_region(self.memory_region);
|
||||
|
|
|
@ -74,7 +74,7 @@ impl<T> RC<T> {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl<T> Drop for RC<T> {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
assert!(self.refcount() > 0);
|
||||
|
||||
unsafe {
|
||||
|
|
|
@ -1200,15 +1200,15 @@ mod test {
|
|||
struct S { field: () }
|
||||
|
||||
impl Drop for S {
|
||||
fn drop(&self) {
|
||||
let _foo = @0;
|
||||
fn drop(&mut self) {
|
||||
let _foo = @0;
|
||||
}
|
||||
}
|
||||
|
||||
let s = S { field: () };
|
||||
|
||||
do spawntask {
|
||||
let _ss = &s;
|
||||
let _ss = &s;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ impl StackSegment {
|
|||
}
|
||||
|
||||
impl Drop for StackSegment {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
#[fixed_stack_segment]; #[inline(never)];
|
||||
|
||||
unsafe {
|
||||
|
|
|
@ -328,7 +328,7 @@ impl Task {
|
|||
}
|
||||
|
||||
impl Drop for Task {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
rtdebug!("called drop for a task: %u", borrow::to_uint(self));
|
||||
rtassert!(self.destroyed)
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ impl Thread {
|
|||
}
|
||||
|
||||
impl Drop for Thread {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
#[fixed_stack_segment]; #[inline(never)];
|
||||
|
||||
assert!(self.joined);
|
||||
|
|
|
@ -187,7 +187,7 @@ impl UvEventLoop {
|
|||
}
|
||||
|
||||
impl Drop for UvEventLoop {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
// XXX: Need mutable finalizer
|
||||
let this = unsafe {
|
||||
transmute::<&UvEventLoop, &mut UvEventLoop>(self)
|
||||
|
@ -351,7 +351,7 @@ impl RemoteCallback for UvRemoteCallback {
|
|||
}
|
||||
|
||||
impl Drop for UvRemoteCallback {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
let this: &mut UvRemoteCallback = cast::transmute_mut(self);
|
||||
do this.exit_flag.with |should_exit| {
|
||||
|
@ -647,7 +647,7 @@ impl UvTcpListener {
|
|||
}
|
||||
|
||||
impl Drop for UvTcpListener {
|
||||
fn drop(&self) {
|
||||
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| {
|
||||
|
@ -762,7 +762,7 @@ impl HomingIO for UvTcpStream {
|
|||
}
|
||||
|
||||
impl Drop for UvTcpStream {
|
||||
fn drop(&self) {
|
||||
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| {
|
||||
|
@ -921,7 +921,7 @@ impl HomingIO for UvUdpSocket {
|
|||
}
|
||||
|
||||
impl Drop for UvUdpSocket {
|
||||
fn drop(&self) {
|
||||
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| {
|
||||
|
@ -1139,7 +1139,7 @@ impl UvTimer {
|
|||
}
|
||||
|
||||
impl Drop for UvTimer {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
let self_ = unsafe { transmute::<&UvTimer, &mut UvTimer>(self) };
|
||||
do self_.home_for_io_with_sched |self_, scheduler| {
|
||||
rtdebug!("closing UvTimer");
|
||||
|
@ -1253,7 +1253,7 @@ impl UvFileStream {
|
|||
}
|
||||
|
||||
impl Drop for UvFileStream {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
let self_ = unsafe { transmute::<&UvFileStream, &mut UvFileStream>(self) };
|
||||
if self.close_on_drop {
|
||||
do self_.home_for_io_with_sched |self_, scheduler| {
|
||||
|
|
|
@ -436,12 +436,9 @@ impl Process {
|
|||
}
|
||||
|
||||
impl Drop for Process {
|
||||
fn drop(&self) {
|
||||
// FIXME(#4330) Need self by value to get mutability.
|
||||
let mut_self: &mut Process = unsafe { cast::transmute(self) };
|
||||
|
||||
mut_self.finish();
|
||||
mut_self.close_outputs();
|
||||
fn drop(&mut self) {
|
||||
self.finish();
|
||||
self.close_outputs();
|
||||
free_handle(self.handle);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -319,40 +319,35 @@ pub struct Taskgroup {
|
|||
|
||||
impl Drop for Taskgroup {
|
||||
// Runs on task exit.
|
||||
fn drop(&self) {
|
||||
unsafe {
|
||||
// FIXME(#4330) Need self by value to get mutability.
|
||||
let this: &mut Taskgroup = transmute(self);
|
||||
|
||||
// If we are failing, the whole taskgroup needs to die.
|
||||
do RuntimeGlue::with_task_handle_and_failing |me, failing| {
|
||||
if failing {
|
||||
for x in this.notifier.mut_iter() {
|
||||
x.failed = true;
|
||||
}
|
||||
// Take everybody down with us. After this point, every
|
||||
// other task in the group will see 'tg' as none, which
|
||||
// indicates the whole taskgroup is failing (and forbids
|
||||
// new spawns from succeeding).
|
||||
let tg = do access_group(&self.tasks) |tg| { tg.take() };
|
||||
// It's safe to send kill signals outside the lock, because
|
||||
// we have a refcount on all kill-handles in the group.
|
||||
kill_taskgroup(tg, me);
|
||||
} else {
|
||||
// Remove ourselves from the group(s).
|
||||
do access_group(&self.tasks) |tg| {
|
||||
leave_taskgroup(tg, me, true);
|
||||
}
|
||||
fn drop(&mut self) {
|
||||
// If we are failing, the whole taskgroup needs to die.
|
||||
do RuntimeGlue::with_task_handle_and_failing |me, failing| {
|
||||
if failing {
|
||||
for x in self.notifier.mut_iter() {
|
||||
x.failed = true;
|
||||
}
|
||||
// Take everybody down with us. After this point, every
|
||||
// other task in the group will see 'tg' as none, which
|
||||
// indicates the whole taskgroup is failing (and forbids
|
||||
// new spawns from succeeding).
|
||||
let tg = do access_group(&self.tasks) |tg| { tg.take() };
|
||||
// It's safe to send kill signals outside the lock, because
|
||||
// we have a refcount on all kill-handles in the group.
|
||||
kill_taskgroup(tg, me);
|
||||
} else {
|
||||
// Remove ourselves from the group(s).
|
||||
do access_group(&self.tasks) |tg| {
|
||||
leave_taskgroup(tg, me, true);
|
||||
}
|
||||
// It doesn't matter whether this happens before or after dealing
|
||||
// with our own taskgroup, so long as both happen before we die.
|
||||
// We remove ourself from every ancestor we can, so no cleanup; no
|
||||
// break.
|
||||
do each_ancestor(&mut this.ancestors, |_| {}) |ancestor_group| {
|
||||
leave_taskgroup(ancestor_group, me, false);
|
||||
true
|
||||
};
|
||||
}
|
||||
// It doesn't matter whether this happens before or after dealing
|
||||
// with our own taskgroup, so long as both happen before we die.
|
||||
// We remove ourself from every ancestor we can, so no cleanup; no
|
||||
// break.
|
||||
do each_ancestor(&mut self.ancestors, |_| {}) |ancestor_group| {
|
||||
leave_taskgroup(ancestor_group, me, false);
|
||||
true
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -377,7 +372,7 @@ struct AutoNotify {
|
|||
}
|
||||
|
||||
impl Drop for AutoNotify {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
let result = if self.failed { Failure } else { Success };
|
||||
self.notify_chan.send(result);
|
||||
}
|
||||
|
|
|
@ -338,7 +338,7 @@ impl<T> AtomicOption<T> {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl<T> Drop for AtomicOption<T> {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
// This will ensure that the contained data is
|
||||
// destroyed, unless it's null.
|
||||
unsafe {
|
||||
|
|
|
@ -26,7 +26,7 @@ use result::*;
|
|||
pub struct DynamicLibrary { priv handle: *libc::c_void }
|
||||
|
||||
impl Drop for DynamicLibrary {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
match do dl::check_for_errors_in {
|
||||
unsafe {
|
||||
dl::close(self.handle)
|
||||
|
|
|
@ -64,7 +64,7 @@ struct Finallyalizer<'self> {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl<'self> Drop for Finallyalizer<'self> {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
(self.dtor)();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -220,7 +220,7 @@ impl<T: Send> Clone for UnsafeArc<T> {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl<T> Drop for UnsafeArc<T>{
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
// Happens when destructing an unwrapper's handle and from `#[unsafe_no_drop_flag]`
|
||||
if self.data.is_null() {
|
||||
|
@ -308,7 +308,7 @@ pub struct LittleLock {
|
|||
}
|
||||
|
||||
impl Drop for LittleLock {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
rust_destroy_little_lock(self.l);
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ impl NonCopyable {
|
|||
}
|
||||
|
||||
impl Drop for NonCopyable {
|
||||
fn drop(&self) { }
|
||||
fn drop(&mut self) { }
|
||||
}
|
||||
|
||||
/// A type with no inhabitants
|
||||
|
@ -188,7 +188,7 @@ mod tests {
|
|||
struct Foo { five: int }
|
||||
|
||||
impl Drop for Foo {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
assert_eq!(self.five, 5);
|
||||
unsafe {
|
||||
did_run = true;
|
||||
|
|
|
@ -341,7 +341,7 @@ pub struct Parser {
|
|||
#[unsafe_destructor]
|
||||
impl Drop for Parser {
|
||||
/* do not copy the parser; its state is tied to outside state */
|
||||
fn drop(&self) {}
|
||||
fn drop(&mut self) {}
|
||||
}
|
||||
|
||||
fn is_plain_ident_or_underscore(t: &token::Token) -> bool {
|
||||
|
|
|
@ -21,7 +21,7 @@ struct arc_destruct<T> {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl<T:Freeze> Drop for arc_destruct<T> {
|
||||
fn drop(&self) {}
|
||||
fn drop(&mut self) {}
|
||||
}
|
||||
|
||||
fn arc_destruct<T:Freeze>(data: int) -> arc_destruct<T> {
|
||||
|
@ -43,7 +43,7 @@ struct context_res {
|
|||
}
|
||||
|
||||
impl Drop for context_res {
|
||||
fn drop(&self) {}
|
||||
fn drop(&mut self) {}
|
||||
}
|
||||
|
||||
fn context_res() -> context_res {
|
||||
|
|
|
@ -19,7 +19,7 @@ pub mod socket {
|
|||
}
|
||||
|
||||
impl Drop for socket_handle {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
/* c::close(self.sockfd); */
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ pub struct rsrc {
|
|||
}
|
||||
|
||||
impl Drop for rsrc {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
foo(self.x);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ pub struct S {
|
|||
}
|
||||
|
||||
impl Drop for S {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
println("goodbye");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ struct r {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl Drop for r {
|
||||
fn drop(&self) {}
|
||||
fn drop(&mut self) {}
|
||||
}
|
||||
|
||||
fn r(l: @nillist) -> r {
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
struct X { x: () }
|
||||
|
||||
impl Drop for X {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
error!("destructor runs");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
struct X { x: (), }
|
||||
|
||||
impl Drop for X {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
error!("destructor runs");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
struct X { x: (), }
|
||||
|
||||
impl Drop for X {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
error!("destructor runs");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
struct X { x: (), }
|
||||
|
||||
impl Drop for X {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
error!("destructor runs");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
struct X { x: (), }
|
||||
|
||||
impl Drop for X {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
error!("destructor runs");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
struct r;
|
||||
|
||||
impl Drop for r {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
true
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ struct defer<'self> {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl<'self> Drop for defer<'self> {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
error!("%?", self.x);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
struct S {f:~str}
|
||||
impl Drop for S {
|
||||
fn drop(&self) { println(self.f); }
|
||||
fn drop(&mut self) { println(self.f); }
|
||||
}
|
||||
|
||||
fn move_in_match() {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
struct S(~str);
|
||||
impl Drop for S {
|
||||
fn drop(&self) { println(**self); }
|
||||
fn drop(&mut self) { println(**self); }
|
||||
}
|
||||
|
||||
fn move_in_match() {
|
||||
|
|
|
@ -13,7 +13,7 @@ struct foo {
|
|||
}
|
||||
|
||||
impl Drop for foo {
|
||||
fn drop(&self) {}
|
||||
fn drop(&mut self) {}
|
||||
}
|
||||
|
||||
fn foo(i:int) -> foo {
|
||||
|
|
|
@ -13,7 +13,7 @@ struct X {
|
|||
}
|
||||
|
||||
impl Drop for X {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
error!("value: %s", self.x);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ struct X {
|
|||
}
|
||||
|
||||
impl Drop for X {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
error!("value: %s", self.x);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ type Foo = @[u8];
|
|||
|
||||
impl Drop for Foo { //~ ERROR the Drop trait may only be implemented
|
||||
//~^ ERROR cannot provide an extension implementation
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
println("kaboom");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ struct Foo {
|
|||
}
|
||||
|
||||
impl Drop for Foo {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
println("kaboom");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ trait Bar : Drop {
|
|||
}
|
||||
|
||||
impl Drop for Foo {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
println("kaboom");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ use extra::arc::*;
|
|||
struct A { y: Arc<int>, x: Arc<int> }
|
||||
|
||||
impl Drop for A {
|
||||
fn drop(&self) { println(fmt!("x=%?", self.x.get())); }
|
||||
fn drop(&mut self) { println(fmt!("x=%?", self.x.get())); }
|
||||
}
|
||||
fn main() {
|
||||
let a = A { y: Arc::new(1), x: Arc::new(2) };
|
||||
|
|
|
@ -18,7 +18,7 @@ struct foo {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl Drop for foo {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
println("Goodbye, World!");
|
||||
*self.x += 1;
|
||||
|
|
|
@ -13,7 +13,7 @@ struct C {
|
|||
}
|
||||
|
||||
impl Drop for C {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
error!("dropping: %?", self.x);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ fn foo<T>() {
|
|||
}
|
||||
|
||||
impl<T> Drop for foo<T> {
|
||||
fn drop(&self) {}
|
||||
fn drop(&mut self) {}
|
||||
}
|
||||
}
|
||||
fn main() { }
|
||||
|
|
|
@ -3,7 +3,7 @@ struct Foo {
|
|||
}
|
||||
|
||||
impl Drop for Foo { //~ ERROR cannot implement a destructor on a structure that does not satisfy Send
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
*self.f = 10;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ fn main() {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl Drop for foo {
|
||||
fn drop(&self) {}
|
||||
fn drop(&mut self) {}
|
||||
}
|
||||
|
||||
fn foo(x: Port<()>) -> foo {
|
||||
|
|
|
@ -15,7 +15,7 @@ struct bar {
|
|||
}
|
||||
|
||||
impl Drop for bar {
|
||||
fn drop(&self) {}
|
||||
fn drop(&mut self) {}
|
||||
}
|
||||
|
||||
fn bar(x:int) -> bar {
|
||||
|
|
|
@ -14,7 +14,7 @@ struct r {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl Drop for r {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
*(self.i) = *(self.i) + 1;
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ struct Foo {
|
|||
}
|
||||
|
||||
impl Drop for Foo {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
println("Goodbye!");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ struct Bar {
|
|||
}
|
||||
|
||||
impl Drop for Bar {
|
||||
fn drop(&self) {}
|
||||
fn drop(&mut self) {}
|
||||
}
|
||||
|
||||
impl Foo for Bar {
|
||||
|
|
|
@ -13,7 +13,7 @@ struct r {
|
|||
}
|
||||
|
||||
impl Drop for r {
|
||||
fn drop(&self) {}
|
||||
fn drop(&mut self) {}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -14,7 +14,7 @@ struct r {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl Drop for r {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
*(self.i) = *(self.i) + 1;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ struct S {
|
|||
}
|
||||
|
||||
impl Drop for S {
|
||||
fn drop(&self) {}
|
||||
fn drop(&mut self) {}
|
||||
}
|
||||
|
||||
impl S {
|
||||
|
|
|
@ -17,7 +17,7 @@ struct r {
|
|||
fn r(i:int) -> r { r { i: i } }
|
||||
|
||||
impl Drop for r {
|
||||
fn drop(&self) {}
|
||||
fn drop(&mut self) {}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -42,7 +42,7 @@ struct StructWithDestructor {
|
|||
}
|
||||
|
||||
impl Drop for StructWithDestructor {
|
||||
fn drop(&self) {}
|
||||
fn drop(&mut self) {}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -78,7 +78,7 @@ struct StructWithDrop {
|
|||
}
|
||||
|
||||
impl Drop for StructWithDrop {
|
||||
fn drop(&self) {()}
|
||||
fn drop(&mut self) {()}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -49,7 +49,7 @@ struct Packed {
|
|||
}
|
||||
|
||||
impl Drop for Packed {
|
||||
fn drop(&self) {}
|
||||
fn drop(&mut self) {}
|
||||
}
|
||||
|
||||
#[packed]
|
||||
|
@ -74,7 +74,7 @@ struct Unpacked {
|
|||
}
|
||||
|
||||
impl Drop for Unpacked {
|
||||
fn drop(&self) {}
|
||||
fn drop(&mut self) {}
|
||||
}
|
||||
|
||||
#[packed]
|
||||
|
@ -94,7 +94,7 @@ struct PackedInPackedWithDrop {
|
|||
}
|
||||
|
||||
impl Drop for PackedInPackedWithDrop {
|
||||
fn drop(&self) {}
|
||||
fn drop(&mut self) {}
|
||||
}
|
||||
|
||||
struct PackedInUnpackedWithDrop {
|
||||
|
@ -105,7 +105,7 @@ struct PackedInUnpackedWithDrop {
|
|||
}
|
||||
|
||||
impl Drop for PackedInUnpackedWithDrop {
|
||||
fn drop(&self) {}
|
||||
fn drop(&mut self) {}
|
||||
}
|
||||
|
||||
#[packed]
|
||||
|
@ -117,7 +117,7 @@ struct UnpackedInPackedWithDrop {
|
|||
}
|
||||
|
||||
impl Drop for UnpackedInPackedWithDrop {
|
||||
fn drop(&self) {}
|
||||
fn drop(&mut self) {}
|
||||
}
|
||||
|
||||
struct DeeplyNested {
|
||||
|
|
|
@ -37,7 +37,7 @@ struct WithDestructor {
|
|||
}
|
||||
|
||||
impl Drop for WithDestructor {
|
||||
fn drop(&self) {}
|
||||
fn drop(&mut self) {}
|
||||
}
|
||||
|
||||
struct NoDestructorGuarded {
|
||||
|
@ -55,7 +55,7 @@ struct NestedInner {
|
|||
}
|
||||
|
||||
impl Drop for NestedInner {
|
||||
fn drop(&self) {}
|
||||
fn drop(&mut self) {}
|
||||
}
|
||||
|
||||
struct NestedOuter {
|
||||
|
|
|
@ -15,7 +15,7 @@ struct R {
|
|||
}
|
||||
|
||||
impl Drop for R {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
let _y = R { b: self.b };
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ struct and_then_get_big_again {
|
|||
}
|
||||
|
||||
impl Drop for and_then_get_big_again {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
fn getbig(i: int) {
|
||||
if i != 0 {
|
||||
getbig(i - 1);
|
||||
|
|
|
@ -31,7 +31,7 @@ struct and_then_get_big_again {
|
|||
}
|
||||
|
||||
impl Drop for and_then_get_big_again {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
fn getbig(i: int) {
|
||||
if i != 0 {
|
||||
getbig(i - 1);
|
||||
|
|
|
@ -31,7 +31,7 @@ struct and_then_get_big_again {
|
|||
}
|
||||
|
||||
impl Drop for and_then_get_big_again {
|
||||
fn drop(&self) {}
|
||||
fn drop(&mut self) {}
|
||||
}
|
||||
|
||||
fn and_then_get_big_again(x:int) -> and_then_get_big_again {
|
||||
|
|
|
@ -21,7 +21,7 @@ struct r {
|
|||
// failed has no effect and the process exits with the
|
||||
// runtime's exit code
|
||||
impl Drop for r {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
os::set_exit_status(50);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ struct r {
|
|||
}
|
||||
|
||||
impl Drop for r {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if !*(self.recursed) {
|
||||
*(self.recursed) = true;
|
||||
|
|
|
@ -21,7 +21,7 @@ struct r {
|
|||
}
|
||||
|
||||
impl Drop for r {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
let _v2: ~int = cast::transmute(self.v);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ struct r {
|
|||
}
|
||||
|
||||
impl Drop for r {
|
||||
fn drop(&self) { fail!("squirrel") }
|
||||
fn drop(&mut self) { fail!("squirrel") }
|
||||
}
|
||||
|
||||
fn r(i: int) -> r { r { i: i } }
|
||||
|
|
|
@ -16,7 +16,7 @@ struct r {
|
|||
}
|
||||
|
||||
impl Drop for r {
|
||||
fn drop(&self) { fail!("wombat") }
|
||||
fn drop(&mut self) { fail!("wombat") }
|
||||
}
|
||||
|
||||
fn r(i: int) -> r { r { i: i } }
|
||||
|
|
|
@ -19,7 +19,7 @@ fn faily_box(i: @int) -> faily_box { faily_box { i: i } }
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl Drop for faily_box {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
fail!("quux");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ struct Test<T> {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl<T> Drop for Test<T> {
|
||||
fn drop(&self) { }
|
||||
fn drop(&mut self) { }
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -13,7 +13,7 @@ struct noncopyable {
|
|||
}
|
||||
|
||||
impl Drop for noncopyable {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
error!("dropped");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ struct cat {
|
|||
|
||||
impl Drop for cat {
|
||||
#[cat_dropper]
|
||||
fn drop(&self) { error!("%s landed on hir feet" , self . name); }
|
||||
fn drop(&mut self) { error!("%s landed on hir feet" , self . name); }
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ impl Drop for cat {
|
|||
/**
|
||||
Actually, cats don't always land on their feet when you drop them.
|
||||
*/
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
error!("%s landed on hir feet", self.name);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ struct cat {
|
|||
}
|
||||
|
||||
impl Drop for cat {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
(self.done)(self.meows);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ struct S<T> {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl<T> ::std::ops::Drop for S<T> {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
println("bye");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ struct Foo {
|
|||
}
|
||||
|
||||
impl Drop for Foo {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
println("bye");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ struct Box { x: r }
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl Drop for r {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
*(self.i) = *(self.i) + 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ struct socket {
|
|||
}
|
||||
|
||||
impl Drop for socket {
|
||||
fn drop(&self) {}
|
||||
fn drop(&mut self) {}
|
||||
}
|
||||
|
||||
impl socket {
|
||||
|
|
|
@ -16,7 +16,7 @@ struct Font {
|
|||
}
|
||||
|
||||
impl Drop for Font {
|
||||
fn drop(&self) {}
|
||||
fn drop(&mut self) {}
|
||||
}
|
||||
|
||||
fn Font() -> Font {
|
||||
|
|
|
@ -161,7 +161,7 @@ pub mod pipes {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl<T:Send> Drop for send_packet<T> {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if self.p != None {
|
||||
let self_p: &mut Option<*packet<T>> =
|
||||
|
@ -191,7 +191,7 @@ pub mod pipes {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl<T:Send> Drop for recv_packet<T> {
|
||||
fn drop(&self) {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
if self.p != None {
|
||||
let self_p: &mut Option<*packet<T>> =
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue