From ddbd1aa883b0325f09492113a483c9c888e7576a Mon Sep 17 00:00:00 2001 From: Luqman Aden Date: Sat, 1 Jun 2013 18:20:48 -0400 Subject: [PATCH 1/2] Add test for #6861 --- .../run-pass/unit-like-struct-drop-run.rs | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/test/run-pass/unit-like-struct-drop-run.rs diff --git a/src/test/run-pass/unit-like-struct-drop-run.rs b/src/test/run-pass/unit-like-struct-drop-run.rs new file mode 100644 index 0000000000000..4af56db4dd525 --- /dev/null +++ b/src/test/run-pass/unit-like-struct-drop-run.rs @@ -0,0 +1,28 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Make sure the destructor is run for unit-like structs. + +use std::task; + +struct Foo; + +impl Drop for Foo { + fn finalize(&self) { + fail!("This failure should happen."); + } +} + +fn main() { + let x = do task::try { + let _b = Foo; + }; + assert_eq!(x, Err(())); +} From 101e3872feed1645dabd37c921b26d5e8c40b5b9 Mon Sep 17 00:00:00 2001 From: Luqman Aden Date: Sat, 1 Jun 2013 22:35:55 -0400 Subject: [PATCH 2/2] Mark run-pass/unit-like-struct-drop-run.rs as xfast-fail. --- src/test/run-pass/unit-like-struct-drop-run.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/run-pass/unit-like-struct-drop-run.rs b/src/test/run-pass/unit-like-struct-drop-run.rs index 4af56db4dd525..b19a0aa1e98a9 100644 --- a/src/test/run-pass/unit-like-struct-drop-run.rs +++ b/src/test/run-pass/unit-like-struct-drop-run.rs @@ -9,6 +9,7 @@ // except according to those terms. // Make sure the destructor is run for unit-like structs. +// xfail-fast use std::task;