From ebf6341d1dfe57a7ad6f7f87501b018ffe24bba8 Mon Sep 17 00:00:00 2001 From: Simonas Kazlauskas Date: Sat, 30 Jan 2016 19:32:50 +0200 Subject: Translation part of drop panic recovery With this commit we now finally execute all the leftover drops once some drop panics for some reason! --- src/test/run-fail/mir_drop_panics.rs | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/test/run-fail/mir_drop_panics.rs (limited to 'src/test') diff --git a/src/test/run-fail/mir_drop_panics.rs b/src/test/run-fail/mir_drop_panics.rs new file mode 100644 index 00000000000..9868ff4c241 --- /dev/null +++ b/src/test/run-fail/mir_drop_panics.rs @@ -0,0 +1,34 @@ +// Copyright 2016 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. +#![feature(rustc_attrs)] +// error-pattern:panic 1 +// error-pattern:drop 2 +use std::io::{self, Write}; + +struct Droppable(u32); +impl Drop for Droppable { + fn drop(&mut self) { + if self.0 == 1 { + panic!("panic 1"); + } else { + write!(io::stderr(), "drop {}", self.0); + } + } +} + +#[rustc_mir] +fn mir() { + let x = Droppable(2); + let y = Droppable(1); +} + +fn main() { + mir(); +} -- cgit 1.4.1-3-g733a5 From caf62ef9846edfd41177b883181c5c045ca69859 Mon Sep 17 00:00:00 2001 From: Simonas Kazlauskas Date: Sat, 6 Feb 2016 02:31:19 +0200 Subject: Ignore a test on MSVC The MSVC SEH is still not implemented, so we go ahead and ignore it. --- src/test/run-fail/mir_drop_panics.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/test') diff --git a/src/test/run-fail/mir_drop_panics.rs b/src/test/run-fail/mir_drop_panics.rs index 9868ff4c241..df20700e016 100644 --- a/src/test/run-fail/mir_drop_panics.rs +++ b/src/test/run-fail/mir_drop_panics.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. #![feature(rustc_attrs)] + +// ignore-msvc: FIXME(#30941) // error-pattern:panic 1 // error-pattern:drop 2 use std::io::{self, Write}; -- cgit 1.4.1-3-g733a5