about summary refs log tree commit diff
path: root/tests/ui/codegen/no-mangle-on-panic-handler.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/codegen/no-mangle-on-panic-handler.rs')
-rw-r--r--tests/ui/codegen/no-mangle-on-panic-handler.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/ui/codegen/no-mangle-on-panic-handler.rs b/tests/ui/codegen/no-mangle-on-panic-handler.rs
new file mode 100644
index 00000000000..1dc0cce0a2e
--- /dev/null
+++ b/tests/ui/codegen/no-mangle-on-panic-handler.rs
@@ -0,0 +1,14 @@
+// Issue an error when the user uses #[no_mangle] on the panic handler
+//@ edition:2024
+
+#![crate_type="lib"]
+#![no_std]
+#![no_main]
+
+use core::panic::PanicInfo;
+
+#[unsafe(no_mangle)] //~ ERROR `#[no_mangle]` cannot be used on internal language items
+#[panic_handler]
+pub unsafe fn panic_fmt(pi: &PanicInfo) -> ! {
+    loop {}
+}