summaryrefslogtreecommitdiffstats
path: root/tests/run-make/longjmp-across-rust/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/run-make/longjmp-across-rust/main.rs')
-rw-r--r--tests/run-make/longjmp-across-rust/main.rs29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/run-make/longjmp-across-rust/main.rs b/tests/run-make/longjmp-across-rust/main.rs
new file mode 100644
index 000000000..cc1d5b126
--- /dev/null
+++ b/tests/run-make/longjmp-across-rust/main.rs
@@ -0,0 +1,29 @@
+#[link(name = "foo", kind = "static")]
+extern "C" {
+ fn test_start(f: extern "C" fn());
+ fn test_end();
+}
+
+fn main() {
+ unsafe {
+ test_start(test_middle);
+ }
+}
+
+struct A;
+
+impl Drop for A {
+ fn drop(&mut self) {}
+}
+
+extern "C" fn test_middle() {
+ let _a = A;
+ foo();
+}
+
+fn foo() {
+ let _a = A;
+ unsafe {
+ test_end();
+ }
+}