about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorAriel Ben-Yehuda <ariel.byd@gmail.com>2017-03-08 23:19:09 +0200
committerAriel Ben-Yehuda <ariel.byd@gmail.com>2017-03-18 02:53:07 +0200
commite1f3c67cb4e2eb1595040888e897e48c64afb4be (patch)
treef38485646242ae94da7c68a6e3dd35921d0343f6 /src/test
parenta5e3c3d5b85e415ad2094f476d9f1ac29a48e413 (diff)
downloadrust-e1f3c67cb4e2eb1595040888e897e48c64afb4be.tar.gz
rust-e1f3c67cb4e2eb1595040888e897e48c64afb4be.zip
translate closure shims using MIR
Diffstat (limited to 'src/test')
-rw-r--r--src/test/run-pass/issue-29948.rs17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/test/run-pass/issue-29948.rs b/src/test/run-pass/issue-29948.rs
index ec2b53313fa..281dde15bd3 100644
--- a/src/test/run-pass/issue-29948.rs
+++ b/src/test/run-pass/issue-29948.rs
@@ -8,6 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use std::panic;
+
+impl<'a> panic::UnwindSafe for Foo<'a> {}
+impl<'a> panic::RefUnwindSafe for Foo<'a> {}
+
 struct Foo<'a>(&'a mut bool);
 
 impl<'a> Drop for Foo<'a> {
@@ -28,5 +33,15 @@ fn main() {
         f(x);
     }
     assert!(ran_drop);
-}
 
+    let mut ran_drop = false;
+    {
+        let x = Foo(&mut ran_drop);
+        let result = panic::catch_unwind(move || {
+            let x = move || { let _ = x; panic!() };
+            f(x);
+        });
+        assert!(result.is_err());
+    }
+    assert!(ran_drop);
+}