0
0
mirror of https://github.com/rust-lang/rust.git synced 2024-11-29 10:05:55 +01:00

core: Remove use of deprecated drop

This commit is contained in:
Erick Tryzelaar 2013-04-30 18:03:09 -07:00
parent 89f419370c
commit 5d79f94a2f
2 changed files with 6 additions and 4 deletions

View File

@ -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");

View File

@ -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<T:Owned,Tbuffer:Owned>(p: RecvPacketBuffered<T, Tbuffer>)
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<T:Owned,Tbuffer:Owned>(p: RecvPacketBuffered<T, Tbuffer>)
}
}
}
};
}
let _drop_state = DropState { p: &p.header };