From e22d2bc4bc4ed84c72148bdd00c8da0eb4238c45 Mon Sep 17 00:00:00 2001 From: Erick Tryzelaar Date: Tue, 22 Jan 2013 07:51:00 -0800 Subject: [PATCH] core: convert io::Res over to the Drop trait --- src/libcore/io.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/libcore/io.rs b/src/libcore/io.rs index ffe4379b5bc..4b828dd4bc7 100644 --- a/src/libcore/io.rs +++ b/src/libcore/io.rs @@ -1108,10 +1108,13 @@ pub mod fsync { // Artifacts that need to fsync on destruction pub struct Res { arg: Arg, - drop { + } + + impl Res: Drop { + fn finalize(&self) { match self.arg.opt_level { - option::None => (), - option::Some(level) => { + None => (), + Some(level) => { // fail hard if not succesful assert((self.arg.fsync_fn)(self.arg.val, level) != -1); }