Permalink
Browse files

switch Drop to `&mut self`

  • Loading branch information...
1 parent bc89ade commit 4e161a4d401224507513bfbf33b22f0b72f8ba81 @thestinger thestinger committed Sep 17, 2013
Showing with 192 additions and 203 deletions.
  1. +1 −1 doc/tutorial-ffi.md
  2. +1 −1 doc/tutorial.md
  3. +1 −1 src/libextra/arc.rs
  4. +1 −1 src/libextra/arena.rs
  5. +1 −1 src/libextra/c_vec.rs
  6. +5 −8 src/libextra/dlist.rs
  7. +1 −1 src/libextra/future.rs
  8. +2 −2 src/libextra/rc.rs
  9. +1 −1 src/libextra/task_pool.rs
  10. +1 −1 src/libextra/workcache.rs
  11. +1 −1 src/librustc/back/link.rs
  12. +4 −4 src/librustc/lib/llvm.rs
  13. +2 −2 src/librustc/middle/trans/base.rs
  14. +1 −1 src/librustc/middle/trans/common.rs
  15. +1 −1 src/librustc/middle/trans/context.rs
  16. +1 −1 src/librustc/rustc.rs
  17. +1 −1 src/librustc/util/common.rs
  18. +1 −1 src/librustdoc/demo.rs
  19. +1 −1 src/libstd/c_str.rs
  20. +1 −1 src/libstd/condition.rs
  21. +3 −3 src/libstd/io.rs
  22. +3 −3 src/libstd/ops.rs
  23. +1 −1 src/libstd/option.rs
  24. +2 −2 src/libstd/os.rs
  25. +2 −2 src/libstd/rt/comm.rs
  26. +2 −2 src/libstd/rt/kill.rs
  27. +1 −1 src/libstd/rt/local_heap.rs
  28. +1 −1 src/libstd/rt/rc.rs
  29. +3 −3 src/libstd/rt/sched.rs
  30. +1 −1 src/libstd/rt/stack.rs
  31. +1 −1 src/libstd/rt/task.rs
  32. +1 −1 src/libstd/rt/thread.rs
  33. +7 −7 src/libstd/rt/uv/uvio.rs
  34. +3 −6 src/libstd/run.rs
  35. +28 −33 src/libstd/task/spawn.rs
  36. +1 −1 src/libstd/unstable/atomics.rs
  37. +1 −1 src/libstd/unstable/dynamic_lib.rs
  38. +1 −1 src/libstd/unstable/finally.rs
  39. +2 −2 src/libstd/unstable/sync.rs
  40. +2 −2 src/libstd/util.rs
  41. +1 −1 src/libsyntax/parse/parser.rs
  42. +2 −2 src/test/auxiliary/issue-2526.rs
  43. +1 −1 src/test/auxiliary/issue-3012-1.rs
  44. +1 −1 src/test/auxiliary/issue2170lib.rs
  45. +1 −1 src/test/auxiliary/moves_based_on_type_lib.rs
  46. +1 −1 src/test/bench/task-perf-alloc-unwind.rs
  47. +1 −1 src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-1.rs
  48. +1 −1 src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-2.rs
  49. +1 −1 src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-3.rs
  50. +1 −1 src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-4.rs
  51. +1 −1 src/test/compile-fail/bind-by-move-no-sub-bindings.rs
  52. +1 −1 src/test/compile-fail/block-must-not-have-result-res.rs
  53. +1 −1 src/test/compile-fail/borrowck-borrowed-uniq-rvalue-2.rs
  54. +1 −1 src/test/compile-fail/borrowck-move-out-of-struct-with-dtor.rs
  55. +1 −1 src/test/compile-fail/borrowck-move-out-of-tuple-struct-with-dtor.rs
  56. +1 −1 src/test/compile-fail/copy-a-resource.rs
  57. +1 −1 src/test/compile-fail/disallowed-deconstructing-destructing-struct-let.rs
  58. +1 −1 src/test/compile-fail/disallowed-deconstructing-destructing-struct-match.rs
  59. +1 −1 src/test/compile-fail/drop-on-non-struct.rs
  60. +1 −1 src/test/compile-fail/explicit-call-to-dtor.rs
  61. +1 −1 src/test/compile-fail/explicit-call-to-supertrait-dtor.rs
  62. +1 −1 src/test/compile-fail/functional-struct-update-noncopyable.rs
  63. +1 −1 src/test/compile-fail/issue-2548.rs
  64. +1 −1 src/test/compile-fail/issue-2823.rs
  65. +1 −1 src/test/compile-fail/issue-3214.rs
  66. +1 −1 src/test/compile-fail/kindck-destructor-owned.rs
  67. +1 −1 src/test/compile-fail/no-send-res-ports.rs
  68. +1 −1 src/test/compile-fail/noncopyable-class.rs
  69. +1 −1 src/test/compile-fail/pinned-deep-copy.rs
  70. +1 −1 src/test/compile-fail/repeat-to-run-dtor-twice.rs
  71. +1 −1 src/test/compile-fail/unique-object-noncopyable.rs
  72. +1 −1 src/test/compile-fail/unique-pinned-nocopy.rs
  73. +1 −1 src/test/compile-fail/unique-vec-res.rs
  74. +1 −1 src/test/compile-fail/use-after-move-self-based-on-type.rs
  75. +1 −1 src/test/compile-fail/vec-res-add.rs
  76. +1 −1 src/test/debug-info/boxed-struct.rs
  77. +1 −1 src/test/debug-info/c-style-enum-in-composite.rs
  78. +5 −5 src/test/debug-info/packed-struct-with-destructor.rs
  79. +2 −2 src/test/debug-info/struct-with-destructor.rs
  80. +1 −1 src/test/run-fail/issue-2061.rs
  81. +1 −1 src/test/run-fail/morestack2.rs
  82. +1 −1 src/test/run-fail/morestack3.rs
  83. +1 −1 src/test/run-fail/morestack4.rs
  84. +1 −1 src/test/run-fail/rt-set-exit-status-fail2.rs
  85. +1 −1 src/test/run-fail/too-much-recursion-unwinding.rs
  86. +1 −1 src/test/run-fail/unwind-box-res.rs
  87. +1 −1 src/test/run-fail/unwind-resource-fail.rs
  88. +1 −1 src/test/run-fail/unwind-resource-fail2.rs
  89. +1 −1 src/test/run-fail/unwind-resource-fail3.rs
  90. +1 −1 src/test/run-pass/attr-no-drop-flag-size.rs
  91. +1 −1 src/test/run-pass/borrowck-unary-move-2.rs
  92. +1 −1 src/test/run-pass/class-attributes-1.rs
  93. +1 −1 src/test/run-pass/class-attributes-2.rs
  94. +1 −1 src/test/run-pass/class-dtor.rs
  95. +1 −1 src/test/run-pass/drop-trait-generic.rs
  96. +1 −1 src/test/run-pass/drop-trait.rs
  97. +1 −1 src/test/run-pass/init-res-into-things.rs
  98. +1 −1 src/test/run-pass/issue-2487-a.rs
  99. +1 −1 src/test/run-pass/issue-2708.rs
  100. +2 −2 src/test/run-pass/issue-2718.rs
  101. +1 −1 src/test/run-pass/issue-2735-2.rs
  102. +1 −1 src/test/run-pass/issue-2735-3.rs
  103. +1 −1 src/test/run-pass/issue-2895.rs
  104. +1 −1 src/test/run-pass/issue-3220.rs
  105. +1 −1 src/test/run-pass/issue-3563-3.rs
  106. +1 −1 src/test/run-pass/issue-4252.rs
  107. +1 −1 src/test/run-pass/issue-4735.rs
  108. +1 −1 src/test/run-pass/issue-6341.rs
  109. +1 −1 src/test/run-pass/issue-6344-let.rs
  110. +1 −1 src/test/run-pass/issue-6344-match.rs
  111. +1 −1 src/test/run-pass/issue-979.rs
  112. +1 −1 src/test/run-pass/newtype-struct-drop-run.rs
  113. +1 −1 src/test/run-pass/newtype-struct-with-dtor.rs
  114. +1 −1 src/test/run-pass/option-unwrap.rs
  115. +1 −1 src/test/run-pass/resource-assign-is-not-copy.rs
  116. +2 −2 src/test/run-pass/resource-cycle.rs
  117. +1 −1 src/test/run-pass/resource-cycle2.rs
  118. +1 −1 src/test/run-pass/resource-cycle3.rs
  119. +1 −1 src/test/run-pass/resource-destruct.rs
  120. +1 −1 src/test/run-pass/resource-in-struct.rs
  121. +1 −1 src/test/run-pass/send-resource.rs
  122. +1 −1 src/test/run-pass/struct-literal-dtor.rs
  123. +1 −1 src/test/run-pass/task-killjoin-rsrc.rs
  124. +1 −1 src/test/run-pass/type-param-constraints.rs
  125. +1 −1 src/test/run-pass/unique-pinned-nocopy-2.rs
  126. +1 −1 src/test/run-pass/unit-like-struct-drop-run.rs
  127. +1 −1 src/test/run-pass/unwind-resource.rs
  128. +1 −1 src/test/run-pass/unwind-resource2.rs
  129. +1 −1 src/test/run-pass/vec-slice-drop.rs
View
@@ -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)];
View
@@ -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!");
}
View
@@ -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() */
View
@@ -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| {
View
@@ -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()
View
@@ -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();
}
}
View
@@ -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> {
View
@@ -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);
View
@@ -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();
}
}
View
@@ -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 {
View
@@ -127,7 +127,7 @@ struct Bored {
}
impl Drop for Bored {
- fn drop(&self) { }
+ fn drop(&mut self) { }
}
/**
View
@@ -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 {
View
@@ -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 {
View
@@ -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) => {
View
@@ -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 };
}
}
-}
+}
View
@@ -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 {
View
@@ -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};
View
@@ -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 {
View
@@ -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);
View
@@ -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 {
View
@@ -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;
}
}
}
Oops, something went wrong.

5 comments on commit 4e161a4

Contributor

bors replied Sep 17, 2013

merging thestinger/rust/drop = 4e161a4 into auto

Contributor

bors replied Sep 17, 2013

thestinger/rust/drop = 4e161a4 merged ok, testing candidate = 29cdf58

Contributor

bors replied Sep 17, 2013

fast-forwarding master to auto = 29cdf58

Please sign in to comment.