about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorkennytm <kennytm@gmail.com>2018-06-08 07:05:41 +0800
committerGitHub <noreply@github.com>2018-06-08 07:05:41 +0800
commit6c739430010b7781ae8fbeee3b0a69adddd35e87 (patch)
treed51f342c89ebae268e4c9e017835fcf4b7801787 /src/test
parent26a9d589c8fa46061912497de638f3f523087097 (diff)
parentf37557764d0f1ca32d6b0c2525c88e49319e13d3 (diff)
downloadrust-6c739430010b7781ae8fbeee3b0a69adddd35e87.tar.gz
rust-6c739430010b7781ae8fbeee3b0a69adddd35e87.zip
Rollup merge of #51368 - varkor:panic_implementation-closures, r=eddyb
Fix the use of closures within #[panic_implementation]

Fixes #51365.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/compile-fail/panic_implementation-closures.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/test/compile-fail/panic_implementation-closures.rs b/src/test/compile-fail/panic_implementation-closures.rs
new file mode 100644
index 00000000000..4fa9a639928
--- /dev/null
+++ b/src/test/compile-fail/panic_implementation-closures.rs
@@ -0,0 +1,21 @@
+// Copyright 2018 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 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// compile-pass
+
+#![crate_type = "rlib"]
+#![no_std]
+#![feature(panic_implementation)]
+
+#[panic_implementation]
+pub fn panic_fmt(_: &::core::panic::PanicInfo) -> ! {
+    |x: u8| x;
+    loop {}
+}