auto merge of #7269 : luqmana/rust/drop, r=thestinger
Finally rename finalize to drop. Closes #4332.
This commit is contained in:
commit
22408d9ad5
127 changed files with 155 additions and 155 deletions
|
@ -183,7 +183,7 @@ impl<T: Owned> Unique<T> {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl<T: Owned> Drop for Unique<T> {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
unsafe {
|
||||
let x = intrinsics::init(); // dummy value to swap in
|
||||
// moving the object out is needed to call the destructor
|
||||
|
|
|
@ -2010,7 +2010,7 @@ types by the compiler, and may not be overridden:
|
|||
> iterations of the language, and often still are.
|
||||
|
||||
Additionally, the `Drop` trait is used to define destructors. This
|
||||
trait defines one method called `finalize`, which is automatically
|
||||
trait defines one method called `drop`, which is automatically
|
||||
called when a value of the type that implements this trait is
|
||||
destroyed, either because the value went out of scope or because the
|
||||
garbage collector reclaimed it.
|
||||
|
@ -2021,7 +2021,7 @@ struct TimeBomb {
|
|||
}
|
||||
|
||||
impl Drop for TimeBomb {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
for self.explosivity.times {
|
||||
println("blam!");
|
||||
}
|
||||
|
@ -2029,7 +2029,7 @@ impl Drop for TimeBomb {
|
|||
}
|
||||
~~~
|
||||
|
||||
It is illegal to call `finalize` directly. Only code inserted by the compiler
|
||||
It is illegal to call `drop` directly. Only code inserted by the compiler
|
||||
may call it.
|
||||
|
||||
## Declaring and implementing traits
|
||||
|
|
|
@ -15,7 +15,7 @@ syn keyword rustOperator as
|
|||
|
||||
syn match rustAssert "\<assert\(\w\)*!"
|
||||
syn match rustFail "\<fail\(\w\)*!"
|
||||
syn keyword rustKeyword break copy do drop extern
|
||||
syn keyword rustKeyword break copy do extern
|
||||
syn keyword rustKeyword for if impl let log
|
||||
syn keyword rustKeyword copy do extern
|
||||
syn keyword rustKeyword for impl let log
|
||||
|
|
|
@ -247,7 +247,7 @@ struct PoisonOnFail {
|
|||
}
|
||||
|
||||
impl Drop for PoisonOnFail {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
unsafe {
|
||||
/* assert!(!*self.failed);
|
||||
-- might be false in case of cond.wait() */
|
||||
|
|
|
@ -77,7 +77,7 @@ pub struct Arena {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl Drop for Arena {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
unsafe {
|
||||
destroy_chunk(&self.head);
|
||||
for self.chunks.each |chunk| {
|
||||
|
|
|
@ -57,7 +57,7 @@ struct DtorRes {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl Drop for DtorRes {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
match self.dtor {
|
||||
option::None => (),
|
||||
option::Some(f) => f()
|
||||
|
|
|
@ -44,7 +44,7 @@ pub struct Future<A> {
|
|||
// over ~fn's that have pipes and so forth within!
|
||||
#[unsafe_destructor]
|
||||
impl<A> Drop for Future<A> {
|
||||
fn finalize(&self) {}
|
||||
fn drop(&self) {}
|
||||
}
|
||||
|
||||
priv enum FutureState<A> {
|
||||
|
|
|
@ -57,7 +57,7 @@ pub struct TcpSocket {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl Drop for TcpSocket {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
tear_down_socket_data(self.socket_data)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ impl<T> Rc<T> {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl<T> Drop for Rc<T> {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
unsafe {
|
||||
if self.ptr.is_not_null() {
|
||||
(*self.ptr).count -= 1;
|
||||
|
@ -220,7 +220,7 @@ impl<T> RcMut<T> {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl<T> Drop for RcMut<T> {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
unsafe {
|
||||
if self.ptr.is_not_null() {
|
||||
(*self.ptr).count -= 1;
|
||||
|
|
|
@ -1207,7 +1207,7 @@ mod big_tests {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl<'self> Drop for LVal<'self> {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
let x = unsafe { local_data::local_data_get(self.key) };
|
||||
match x {
|
||||
Some(@y) => {
|
||||
|
|
|
@ -176,7 +176,7 @@ struct SemReleaseGeneric<'self, Q> { sem: &'self Sem<Q> }
|
|||
#[doc(hidden)]
|
||||
#[unsafe_destructor]
|
||||
impl<'self, Q:Owned> Drop for SemReleaseGeneric<'self, Q> {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
self.sem.release();
|
||||
}
|
||||
}
|
||||
|
@ -219,7 +219,7 @@ pub struct Condvar<'self> {
|
|||
}
|
||||
|
||||
#[unsafe_destructor]
|
||||
impl<'self> Drop for Condvar<'self> { fn finalize(&self) {} }
|
||||
impl<'self> Drop for Condvar<'self> { fn drop(&self) {} }
|
||||
|
||||
impl<'self> Condvar<'self> {
|
||||
/**
|
||||
|
@ -295,7 +295,7 @@ impl<'self> Condvar<'self> {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl<'self> Drop for CondvarReacquire<'self> {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
unsafe {
|
||||
// Needs to succeed, instead of itself dying.
|
||||
do task::unkillable {
|
||||
|
@ -689,7 +689,7 @@ struct RWlockReleaseRead<'self> {
|
|||
#[doc(hidden)]
|
||||
#[unsafe_destructor]
|
||||
impl<'self> Drop for RWlockReleaseRead<'self> {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
unsafe {
|
||||
do task::unkillable {
|
||||
let state = &mut *self.lock.state.get();
|
||||
|
@ -726,7 +726,7 @@ struct RWlockReleaseDowngrade<'self> {
|
|||
#[doc(hidden)]
|
||||
#[unsafe_destructor]
|
||||
impl<'self> Drop for RWlockReleaseDowngrade<'self> {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
unsafe {
|
||||
do task::unkillable {
|
||||
let writer_or_last_reader;
|
||||
|
@ -769,12 +769,12 @@ fn RWlockReleaseDowngrade<'r>(lock: &'r RWlock)
|
|||
/// The "write permission" token used for rwlock.write_downgrade().
|
||||
pub struct RWlockWriteMode<'self> { priv lock: &'self RWlock }
|
||||
#[unsafe_destructor]
|
||||
impl<'self> Drop for RWlockWriteMode<'self> { fn finalize(&self) {} }
|
||||
impl<'self> Drop for RWlockWriteMode<'self> { fn drop(&self) {} }
|
||||
|
||||
/// The "read permission" token used for rwlock.write_downgrade().
|
||||
pub struct RWlockReadMode<'self> { priv lock: &'self RWlock }
|
||||
#[unsafe_destructor]
|
||||
impl<'self> Drop for RWlockReadMode<'self> { fn finalize(&self) {} }
|
||||
impl<'self> Drop for RWlockReadMode<'self> { fn drop(&self) {} }
|
||||
|
||||
impl<'self> RWlockWriteMode<'self> {
|
||||
/// Access the pre-downgrade rwlock in write mode.
|
||||
|
@ -1105,7 +1105,7 @@ mod tests {
|
|||
}
|
||||
|
||||
impl Drop for SendOnFailure {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
self.c.send(());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ pub struct TaskPool<T> {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl<T> Drop for TaskPool<T> {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
for self.channels.iter().advance |channel| {
|
||||
channel.send(Quit);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ pub struct PassManager {
|
|||
}
|
||||
|
||||
impl Drop for PassManager {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
unsafe {
|
||||
llvm::LLVMDisposePassManager(self.llpm);
|
||||
}
|
||||
|
|
|
@ -2216,7 +2216,7 @@ pub struct target_data_res {
|
|||
}
|
||||
|
||||
impl Drop for target_data_res {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
unsafe {
|
||||
llvm::LLVMDisposeTargetData(self.TD);
|
||||
}
|
||||
|
@ -2253,7 +2253,7 @@ pub struct pass_manager_res {
|
|||
}
|
||||
|
||||
impl Drop for pass_manager_res {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
unsafe {
|
||||
llvm::LLVMDisposePassManager(self.PM);
|
||||
}
|
||||
|
@ -2289,7 +2289,7 @@ pub struct object_file_res {
|
|||
}
|
||||
|
||||
impl Drop for object_file_res {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
unsafe {
|
||||
llvm::LLVMDisposeObjectFile(self.ObjectFile);
|
||||
}
|
||||
|
@ -2326,7 +2326,7 @@ pub struct section_iter_res {
|
|||
}
|
||||
|
||||
impl Drop for section_iter_res {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
unsafe {
|
||||
llvm::LLVMDisposeSectionIterator(self.SI);
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ pub struct _InsnCtxt { _x: () }
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl Drop for _InsnCtxt {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
unsafe {
|
||||
do local_data::local_data_modify(task_local_insn_key) |c| {
|
||||
do c.map_consume |@ctx| {
|
||||
|
|
|
@ -110,7 +110,7 @@ pub struct BuilderRef_res {
|
|||
}
|
||||
|
||||
impl Drop for BuilderRef_res {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
unsafe {
|
||||
llvm::LLVMDisposeBuilder(self.B);
|
||||
}
|
||||
|
|
|
@ -241,7 +241,7 @@ impl CrateContext {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl Drop for CrateContext {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
unsafe {
|
||||
unset_task_llcx();
|
||||
}
|
||||
|
|
|
@ -328,7 +328,7 @@ pub fn monitor(f: ~fn(diagnostic::Emitter)) {
|
|||
}
|
||||
|
||||
impl Drop for finally {
|
||||
fn finalize(&self) { self.ch.send(done); }
|
||||
fn drop(&self) { self.ch.send(done); }
|
||||
}
|
||||
|
||||
let _finally = finally { ch: ch };
|
||||
|
|
|
@ -41,7 +41,7 @@ pub struct _indenter {
|
|||
}
|
||||
|
||||
impl Drop for _indenter {
|
||||
fn finalize(&self) { debug!("<<"); }
|
||||
fn drop(&self) { debug!("<<"); }
|
||||
}
|
||||
|
||||
pub fn _indenter(_i: ()) -> _indenter {
|
||||
|
|
|
@ -128,7 +128,7 @@ struct Bored {
|
|||
}
|
||||
|
||||
impl Drop for Bored {
|
||||
fn finalize(&self) { }
|
||||
fn drop(&self) { }
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -90,7 +90,7 @@ struct Guard<'self, T, U> {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl<'self, T, U> Drop for Guard<'self, T, U> {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
unsafe {
|
||||
debug!("Guard: popping handler from TLS");
|
||||
let curr = local_data_pop(self.cond.key);
|
||||
|
|
|
@ -989,7 +989,7 @@ impl FILERes {
|
|||
}
|
||||
|
||||
impl Drop for FILERes {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
unsafe {
|
||||
libc::fclose(self.f);
|
||||
}
|
||||
|
@ -1234,7 +1234,7 @@ impl FdRes {
|
|||
}
|
||||
|
||||
impl Drop for FdRes {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
unsafe {
|
||||
libc::close(self.fd);
|
||||
}
|
||||
|
@ -1772,7 +1772,7 @@ pub mod fsync {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl<T:Copy> Drop for Res<T> {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
match self.arg.opt_level {
|
||||
None => (),
|
||||
Some(level) => {
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
#[lang="drop"]
|
||||
pub trait Drop {
|
||||
fn finalize(&self); // FIXME(#4332): Rename to "drop"? --pcwalton
|
||||
fn drop(&self);
|
||||
}
|
||||
|
||||
#[lang="add"]
|
||||
|
|
|
@ -416,7 +416,7 @@ fn test_unwrap_resource() {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl ::ops::Drop for R {
|
||||
fn finalize(&self) { *(self.i) += 1; }
|
||||
fn drop(&self) { *(self.i) += 1; }
|
||||
}
|
||||
|
||||
fn R(i: @mut int) -> R {
|
||||
|
|
|
@ -309,7 +309,7 @@ struct BufferResource<T> {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl<T> Drop for BufferResource<T> {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
unsafe {
|
||||
// FIXME(#4330) Need self by value to get mutability.
|
||||
let this: &mut BufferResource<T> = transmute_mut(self);
|
||||
|
@ -672,7 +672,7 @@ pub struct SendPacketBuffered<T, Tbuffer> {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl<T:Owned,Tbuffer:Owned> Drop for SendPacketBuffered<T,Tbuffer> {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
unsafe {
|
||||
let this: &mut SendPacketBuffered<T,Tbuffer> = transmute(self);
|
||||
if this.p != None {
|
||||
|
@ -730,7 +730,7 @@ pub struct RecvPacketBuffered<T, Tbuffer> {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl<T:Owned,Tbuffer:Owned> Drop for RecvPacketBuffered<T,Tbuffer> {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
unsafe {
|
||||
let this: &mut RecvPacketBuffered<T,Tbuffer> = transmute(self);
|
||||
if this.p != None {
|
||||
|
|
|
@ -222,7 +222,7 @@ impl<T> Peekable<T> for PortOne<T> {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl<T> Drop for ChanOneHack<T> {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
if self.suppress_finalize { return }
|
||||
|
||||
unsafe {
|
||||
|
@ -249,7 +249,7 @@ impl<T> Drop for ChanOneHack<T> {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl<T> Drop for PortOneHack<T> {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
if self.suppress_finalize { return }
|
||||
|
||||
unsafe {
|
||||
|
|
|
@ -57,7 +57,7 @@ impl LocalHeap {
|
|||
}
|
||||
|
||||
impl Drop for LocalHeap {
|
||||
fn finalize(&self) {
|
||||
fn drop(&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 finalize(&self) {
|
||||
fn drop(&self) {
|
||||
assert!(self.refcount() > 0);
|
||||
|
||||
unsafe {
|
||||
|
|
|
@ -49,7 +49,7 @@ impl StackSegment {
|
|||
}
|
||||
|
||||
impl Drop for StackSegment {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
unsafe {
|
||||
// XXX: Using the FFI to call a C macro. Slow
|
||||
rust_valgrind_stack_deregister(self.valgrind_id);
|
||||
|
|
|
@ -103,7 +103,7 @@ impl Task {
|
|||
}
|
||||
|
||||
impl Drop for Task {
|
||||
fn finalize(&self) { assert!(self.destroyed) }
|
||||
fn drop(&self) { assert!(self.destroyed) }
|
||||
}
|
||||
|
||||
// Just a sanity check to make sure we are catching a Rust-thrown exception
|
||||
|
|
|
@ -33,7 +33,7 @@ impl Thread {
|
|||
}
|
||||
|
||||
impl Drop for Thread {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
unsafe { rust_raw_thread_join_delete(self.raw_thread) }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ impl UvEventLoop {
|
|||
}
|
||||
|
||||
impl Drop for UvEventLoop {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
// XXX: Need mutable finalizer
|
||||
let this = unsafe {
|
||||
transmute::<&UvEventLoop, &mut UvEventLoop>(self)
|
||||
|
@ -200,7 +200,7 @@ impl UvTcpListener {
|
|||
}
|
||||
|
||||
impl Drop for UvTcpListener {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
let watcher = self.watcher();
|
||||
let scheduler = Local::take::<Scheduler>();
|
||||
do scheduler.deschedule_running_task_and_then |task| {
|
||||
|
@ -261,7 +261,7 @@ impl UvTcpStream {
|
|||
}
|
||||
|
||||
impl Drop for UvTcpStream {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
rtdebug!("closing tcp stream");
|
||||
let watcher = self.watcher();
|
||||
let scheduler = Local::take::<Scheduler>();
|
||||
|
|
|
@ -42,7 +42,7 @@ impl UvEventLoop {
|
|||
}
|
||||
|
||||
impl Drop for UvEventLoop {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
// XXX: Need mutable finalizer
|
||||
let this = unsafe {
|
||||
transmute::<&UvEventLoop, &mut UvEventLoop>(self)
|
||||
|
@ -164,7 +164,7 @@ impl UvTcpListener {
|
|||
}
|
||||
|
||||
impl Drop for UvTcpListener {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
// XXX: Again, this never gets called. Use .close() instead
|
||||
//self.watcher().as_stream().close(||());
|
||||
}
|
||||
|
@ -230,7 +230,7 @@ impl UvStream {
|
|||
}
|
||||
|
||||
impl Drop for UvStream {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
rtdebug!("closing stream");
|
||||
//self.watcher().close(||());
|
||||
}
|
||||
|
|
|
@ -428,7 +428,7 @@ impl Process {
|
|||
}
|
||||
|
||||
impl Drop for Process {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
// FIXME(#4330) Need self by value to get mutability.
|
||||
let mut_self: &mut Process = unsafe { cast::transmute(self) };
|
||||
|
||||
|
|
|
@ -317,7 +317,7 @@ struct TCB {
|
|||
|
||||
impl Drop for TCB {
|
||||
// Runs on task exit.
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
unsafe {
|
||||
// FIXME(#4330) Need self by value to get mutability.
|
||||
let this: &mut TCB = transmute(self);
|
||||
|
@ -372,7 +372,7 @@ struct AutoNotify {
|
|||
}
|
||||
|
||||
impl Drop for AutoNotify {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
let result = if self.failed { Failure } else { Success };
|
||||
self.notify_chan.send(result);
|
||||
}
|
||||
|
|
|
@ -276,7 +276,7 @@ impl<T> AtomicOption<T> {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl<T> Drop for AtomicOption<T> {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
// This will ensure that the contained data is
|
||||
// destroyed, unless it's null.
|
||||
unsafe {
|
||||
|
|
|
@ -25,7 +25,7 @@ use result::*;
|
|||
pub struct DynamicLibrary { priv handle: *libc::c_void }
|
||||
|
||||
impl Drop for DynamicLibrary {
|
||||
fn finalize(&self) {
|
||||
fn drop(&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 finalize(&self) {
|
||||
fn drop(&self) {
|
||||
(self.dtor)();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -147,7 +147,7 @@ struct GlobalState {
|
|||
}
|
||||
|
||||
impl Drop for GlobalState {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
for self.map.each_value |v| {
|
||||
match v {
|
||||
&(_, ref dtor) => (*dtor)()
|
||||
|
|
|
@ -75,7 +75,7 @@ impl<T: Owned> Clone for UnsafeAtomicRcBox<T> {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl<T> Drop for UnsafeAtomicRcBox<T>{
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
unsafe {
|
||||
do task::unkillable {
|
||||
let mut data: ~AtomicRcBoxData<T> = cast::transmute(self.data);
|
||||
|
@ -102,7 +102,7 @@ struct LittleLock {
|
|||
}
|
||||
|
||||
impl Drop for LittleLock {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
unsafe {
|
||||
rust_destroy_little_lock(self.l);
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ impl NonCopyable {
|
|||
}
|
||||
|
||||
impl Drop for NonCopyable {
|
||||
fn finalize(&self) { }
|
||||
fn drop(&self) { }
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -266,7 +266,7 @@ pub struct Parser {
|
|||
#[unsafe_destructor]
|
||||
impl Drop for Parser {
|
||||
/* do not copy the parser; its state is tied to outside state */
|
||||
fn finalize(&self) {}
|
||||
fn drop(&self) {}
|
||||
}
|
||||
|
||||
impl Parser {
|
||||
|
|
|
@ -21,7 +21,7 @@ struct arc_destruct<T> {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl<T:Const> Drop for arc_destruct<T> {
|
||||
fn finalize(&self) {}
|
||||
fn drop(&self) {}
|
||||
}
|
||||
|
||||
fn arc_destruct<T:Const>(data: int) -> arc_destruct<T> {
|
||||
|
@ -45,7 +45,7 @@ struct context_res {
|
|||
}
|
||||
|
||||
impl Drop for context_res {
|
||||
fn finalize(&self) {}
|
||||
fn drop(&self) {}
|
||||
}
|
||||
|
||||
fn context_res() -> context_res {
|
||||
|
|
|
@ -19,7 +19,7 @@ pub mod socket {
|
|||
}
|
||||
|
||||
impl Drop for socket_handle {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
/* c::close(self.sockfd); */
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ pub struct rsrc {
|
|||
}
|
||||
|
||||
impl Drop for rsrc {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
foo(self.x);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ pub struct S {
|
|||
}
|
||||
|
||||
impl Drop for S {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
println("goodbye");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ struct r {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl Drop for r {
|
||||
fn finalize(&self) {}
|
||||
fn drop(&self) {}
|
||||
}
|
||||
|
||||
fn r(l: @nillist) -> r {
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
struct X { x: () }
|
||||
|
||||
impl Drop for X {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
error!("destructor runs");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
struct X { x: (), }
|
||||
|
||||
impl Drop for X {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
error!("destructor runs");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
struct X { x: (), }
|
||||
|
||||
impl Drop for X {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
error!("destructor runs");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
struct X { x: (), }
|
||||
|
||||
impl Drop for X {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
error!("destructor runs");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
struct X { x: (), }
|
||||
|
||||
impl Drop for X {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
error!("destructor runs");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
struct X { x: (), }
|
||||
|
||||
impl Drop for X {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
error!("destructor runs");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
struct X { x: (), }
|
||||
|
||||
impl Drop for X {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
error!("destructor runs");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
struct r;
|
||||
|
||||
impl Drop for r {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
true
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ struct defer<'self> {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl<'self> Drop for defer<'self> {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
unsafe {
|
||||
error!("%?", self.x);
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ struct foo {
|
|||
}
|
||||
|
||||
impl Drop for foo {
|
||||
fn finalize(&self) {}
|
||||
fn drop(&self) {}
|
||||
}
|
||||
|
||||
fn foo(i:int) -> foo {
|
||||
|
|
|
@ -14,7 +14,7 @@ struct X {
|
|||
}
|
||||
|
||||
impl Drop for X {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
error!("value: %s", self.x);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ struct X {
|
|||
}
|
||||
|
||||
impl Drop for X {
|
||||
fn finalize(&self) {
|
||||
fn drop(&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 finalize(&self) {
|
||||
fn drop(&self) {
|
||||
println("kaboom");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,12 +13,12 @@ struct Foo {
|
|||
}
|
||||
|
||||
impl Drop for Foo {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
println("kaboom");
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let x = Foo { x: 3 };
|
||||
x.finalize(); //~ ERROR explicit call to destructor
|
||||
x.drop(); //~ ERROR explicit call to destructor
|
||||
}
|
||||
|
|
|
@ -17,14 +17,14 @@ trait Bar : Drop {
|
|||
}
|
||||
|
||||
impl Drop for Foo {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
println("kaboom");
|
||||
}
|
||||
}
|
||||
|
||||
impl Bar for Foo {
|
||||
fn blah(&self) {
|
||||
self.finalize(); //~ ERROR explicit call to destructor
|
||||
self.drop(); //~ ERROR explicit call to destructor
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ struct foo {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl Drop for foo {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
unsafe {
|
||||
println("Goodbye, World!");
|
||||
*self.x += 1;
|
||||
|
|
|
@ -13,7 +13,7 @@ struct C {
|
|||
}
|
||||
|
||||
impl Drop for C {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
error!("dropping: %?", self.x);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ fn foo<T>() {
|
|||
}
|
||||
|
||||
impl<T> Drop for foo<T> {
|
||||
fn finalize(&self) {}
|
||||
fn drop(&self) {}
|
||||
}
|
||||
}
|
||||
fn main() { }
|
||||
|
|
|
@ -3,7 +3,7 @@ struct Foo {
|
|||
}
|
||||
|
||||
impl Drop for Foo { //~ ERROR cannot implement a destructor on a struct that is not Owned
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
*self.f = 10;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ fn main() {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl Drop for foo {
|
||||
fn finalize(&self) {}
|
||||
fn drop(&self) {}
|
||||
}
|
||||
|
||||
fn foo(x: Port<()>) -> foo {
|
||||
|
|
|
@ -15,7 +15,7 @@ struct bar {
|
|||
}
|
||||
|
||||
impl Drop for bar {
|
||||
fn finalize(&self) {}
|
||||
fn drop(&self) {}
|
||||
}
|
||||
|
||||
fn bar(x:int) -> bar {
|
||||
|
|
|
@ -14,7 +14,7 @@ struct r {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl Drop for r {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
unsafe {
|
||||
*(self.i) = *(self.i) + 1;
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ struct Foo {
|
|||
}
|
||||
|
||||
impl Drop for Foo {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
println("Goodbye!");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ struct Bar {
|
|||
}
|
||||
|
||||
impl Drop for Bar {
|
||||
fn finalize(&self) {}
|
||||
fn drop(&self) {}
|
||||
}
|
||||
|
||||
impl Foo for Bar {
|
||||
|
|
|
@ -13,7 +13,7 @@ struct r {
|
|||
}
|
||||
|
||||
impl Drop for r {
|
||||
fn finalize(&self) {}
|
||||
fn drop(&self) {}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -14,7 +14,7 @@ struct r {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl Drop for r {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
unsafe {
|
||||
*(self.i) = *(self.i) + 1;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ struct S {
|
|||
}
|
||||
|
||||
impl Drop for S {
|
||||
fn finalize(&self) {}
|
||||
fn drop(&self) {}
|
||||
}
|
||||
|
||||
impl S {
|
||||
|
|
|
@ -17,7 +17,7 @@ struct r {
|
|||
fn r(i:int) -> r { r { i: i } }
|
||||
|
||||
impl Drop for r {
|
||||
fn finalize(&self) {}
|
||||
fn drop(&self) {}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -15,7 +15,7 @@ struct R {
|
|||
}
|
||||
|
||||
impl Drop for R {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
let _y = R { b: self.b };
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ struct and_then_get_big_again {
|
|||
}
|
||||
|
||||
impl Drop for and_then_get_big_again {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
fn getbig(i: int) {
|
||||
if i != 0 {
|
||||
getbig(i - 1);
|
||||
|
|
|
@ -30,7 +30,7 @@ struct and_then_get_big_again {
|
|||
}
|
||||
|
||||
impl Drop for and_then_get_big_again {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
fn getbig(i: int) {
|
||||
if i != 0 {
|
||||
getbig(i - 1);
|
||||
|
|
|
@ -30,7 +30,7 @@ struct and_then_get_big_again {
|
|||
}
|
||||
|
||||
impl Drop for and_then_get_big_again {
|
||||
fn finalize(&self) {}
|
||||
fn drop(&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 finalize(&self) {
|
||||
fn drop(&self) {
|
||||
os::set_exit_status(50);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ struct r {
|
|||
}
|
||||
|
||||
impl Drop for r {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
unsafe {
|
||||
if !*(self.recursed) {
|
||||
*(self.recursed) = true;
|
||||
|
|
|
@ -21,7 +21,7 @@ struct r {
|
|||
}
|
||||
|
||||
impl Drop for r {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
unsafe {
|
||||
let _v2: ~int = cast::transmute(self.v);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ struct r {
|
|||
}
|
||||
|
||||
impl Drop for r {
|
||||
fn finalize(&self) { fail!("squirrel") }
|
||||
fn drop(&self) { fail!("squirrel") }
|
||||
}
|
||||
|
||||
fn r(i: int) -> r { r { i: i } }
|
||||
|
|
|
@ -16,7 +16,7 @@ struct r {
|
|||
}
|
||||
|
||||
impl Drop for r {
|
||||
fn finalize(&self) { fail!("wombat") }
|
||||
fn drop(&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 finalize(&self) {
|
||||
fn drop(&self) {
|
||||
fail!("quux");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ struct Test<T> {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl<T> Drop for Test<T> {
|
||||
fn finalize(&self) { }
|
||||
fn drop(&self) { }
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -13,7 +13,7 @@ struct noncopyable {
|
|||
}
|
||||
|
||||
impl Drop for noncopyable {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
error!("dropped");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ struct cat {
|
|||
|
||||
impl Drop for cat {
|
||||
#[cat_dropper]
|
||||
fn finalize(&self) { error!("%s landed on hir feet" , self . name); }
|
||||
fn drop(&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 finalize(&self) {
|
||||
fn drop(&self) {
|
||||
error!("%s landed on hir feet", self.name);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ struct cat {
|
|||
}
|
||||
|
||||
impl Drop for cat {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
(self.done)(self.meows);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ struct S<T> {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl<T> ::std::ops::Drop for S<T> {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
println("bye");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ struct Foo {
|
|||
}
|
||||
|
||||
impl Drop for Foo {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
println("bye");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ struct Box { x: r }
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl Drop for r {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
unsafe {
|
||||
*(self.i) = *(self.i) + 1;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ struct socket {
|
|||
}
|
||||
|
||||
impl Drop for socket {
|
||||
fn finalize(&self) {}
|
||||
fn drop(&self) {}
|
||||
}
|
||||
|
||||
impl socket {
|
||||
|
|
|
@ -16,7 +16,7 @@ struct Font {
|
|||
}
|
||||
|
||||
impl Drop for Font {
|
||||
fn finalize(&self) {}
|
||||
fn drop(&self) {}
|
||||
}
|
||||
|
||||
fn Font() -> Font {
|
||||
|
|
|
@ -160,7 +160,7 @@ pub mod pipes {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl<T:Owned> Drop for send_packet<T> {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
unsafe {
|
||||
if self.p != None {
|
||||
let self_p: &mut Option<*packet<T>> =
|
||||
|
@ -190,7 +190,7 @@ pub mod pipes {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl<T:Owned> Drop for recv_packet<T> {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
unsafe {
|
||||
if self.p != None {
|
||||
let self_p: &mut Option<*packet<T>> =
|
||||
|
|
|
@ -15,7 +15,7 @@ struct defer {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl Drop for defer {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
*self.b = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ struct defer {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl Drop for defer {
|
||||
fn finalize(&self) {
|
||||
fn drop(&self) {
|
||||
*self.b = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ struct Kitty {
|
|||
}
|
||||
|
||||
impl Drop for Kitty {
|
||||
fn finalize(&self) {}
|
||||
fn drop(&self) {}
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
struct thing { x: int, }
|
||||
|
||||
impl Drop for thing {
|
||||
fn finalize(&self) {}
|
||||
fn drop(&self) {}
|
||||
}
|
||||
|
||||
fn thing() -> thing {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue