From 5d79f94a2f74a0502f665c5eb432aa7231666392 Mon Sep 17 00:00:00 2001 From: Erick Tryzelaar Date: Tue, 30 Apr 2013 18:03:09 -0700 Subject: [PATCH] core: Remove use of deprecated `drop` --- src/libcore/core.rc | 1 - src/libcore/pipes.rs | 9 ++++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/libcore/core.rc b/src/libcore/core.rc index f9a56f613d5..7ccf5cb6a91 100644 --- a/src/libcore/core.rc +++ b/src/libcore/core.rc @@ -63,7 +63,6 @@ they contained the following prologue: #[warn(vecs_implicitly_copyable)]; #[deny(non_camel_case_types)]; #[allow(deprecated_mutable_fields)]; -#[allow(deprecated_drop)]; // Make core testable by not duplicating lang items. See #2912 #[cfg(test)] extern mod realcore(name = "core", vers = "0.7-pre"); diff --git a/src/libcore/pipes.rs b/src/libcore/pipes.rs index 95b24d20a4b..82dc598c750 100644 --- a/src/libcore/pipes.rs +++ b/src/libcore/pipes.rs @@ -86,6 +86,7 @@ use cast::{forget, transmute, transmute_copy}; use either::{Either, Left, Right}; use kinds::Owned; use libc; +use ops::Drop; use option::{None, Option, Some}; use unstable::intrinsics; use ptr; @@ -395,11 +396,13 @@ pub fn try_recv(p: RecvPacketBuffered) let p_ = p.unwrap(); let p = unsafe { &*p_ }; - #[unsafe_destructor] struct DropState<'self> { p: &'self PacketHeader, + } - drop { + #[unsafe_destructor] + impl<'self> Drop for DropState<'self> { + fn finalize(&self) { unsafe { if task::failing() { self.p.state = Terminated; @@ -411,7 +414,7 @@ pub fn try_recv(p: RecvPacketBuffered) } } } - }; + } let _drop_state = DropState { p: &p.header };