about summary refs log tree commit diff
path: root/tests/ui/panic-handler
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2024-04-17 12:17:29 +0200
committerRalf Jung <post@ralfj.de>2024-04-17 12:59:55 +0200
commitd101971ab10ebc95ad0664b704b730ce792d8fc5 (patch)
treeb2353ad98bf448c90939f956c4e99484e0ef6669 /tests/ui/panic-handler
parentb7581490aaf964d4a34121d75be0fc49a2445911 (diff)
downloadrust-d101971ab10ebc95ad0664b704b730ce792d8fc5.tar.gz
rust-d101971ab10ebc95ad0664b704b730ce792d8fc5.zip
weak lang items are not allowed to be #[track_caller]
Diffstat (limited to 'tests/ui/panic-handler')
-rw-r--r--tests/ui/panic-handler/panic-handler-with-target-feature.rs2
-rw-r--r--tests/ui/panic-handler/panic-handler-with-target-feature.stderr4
-rw-r--r--tests/ui/panic-handler/panic-handler-with-track-caller.rs14
-rw-r--r--tests/ui/panic-handler/panic-handler-with-track-caller.stderr11
4 files changed, 28 insertions, 3 deletions
diff --git a/tests/ui/panic-handler/panic-handler-with-target-feature.rs b/tests/ui/panic-handler/panic-handler-with-target-feature.rs
index 3dfdd2847bf..8d5ea0703af 100644
--- a/tests/ui/panic-handler/panic-handler-with-target-feature.rs
+++ b/tests/ui/panic-handler/panic-handler-with-target-feature.rs
@@ -9,7 +9,7 @@ use core::panic::PanicInfo;
 
 #[panic_handler]
 #[target_feature(enable = "avx2")]
-//~^ ERROR `panic_impl` language item function is not allowed to have `#[target_feature]`
+//~^ ERROR `#[panic_handler]` function is not allowed to have `#[target_feature]`
 fn panic(info: &PanicInfo) -> ! {
     unimplemented!();
 }
diff --git a/tests/ui/panic-handler/panic-handler-with-target-feature.stderr b/tests/ui/panic-handler/panic-handler-with-target-feature.stderr
index c38feab49c3..cb17da3a4ef 100644
--- a/tests/ui/panic-handler/panic-handler-with-target-feature.stderr
+++ b/tests/ui/panic-handler/panic-handler-with-target-feature.stderr
@@ -1,11 +1,11 @@
-error: `panic_impl` language item function is not allowed to have `#[target_feature]`
+error: `#[panic_handler]` function is not allowed to have `#[target_feature]`
   --> $DIR/panic-handler-with-target-feature.rs:11:1
    |
 LL | #[target_feature(enable = "avx2")]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 LL |
 LL | fn panic(info: &PanicInfo) -> ! {
-   | ------------------------------- `panic_impl` language item function is not allowed to have `#[target_feature]`
+   | ------------------------------- `#[panic_handler]` function is not allowed to have `#[target_feature]`
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/panic-handler/panic-handler-with-track-caller.rs b/tests/ui/panic-handler/panic-handler-with-track-caller.rs
new file mode 100644
index 00000000000..09c94139e16
--- /dev/null
+++ b/tests/ui/panic-handler/panic-handler-with-track-caller.rs
@@ -0,0 +1,14 @@
+//@ compile-flags:-C panic=abort
+//@ only-x86_64
+
+#![no_std]
+#![no_main]
+
+use core::panic::PanicInfo;
+
+#[panic_handler]
+#[track_caller]
+//~^ ERROR `#[panic_handler]` function is not allowed to have `#[track_caller]`
+fn panic(info: &PanicInfo) -> ! {
+    unimplemented!();
+}
diff --git a/tests/ui/panic-handler/panic-handler-with-track-caller.stderr b/tests/ui/panic-handler/panic-handler-with-track-caller.stderr
new file mode 100644
index 00000000000..9ed387fc8d1
--- /dev/null
+++ b/tests/ui/panic-handler/panic-handler-with-track-caller.stderr
@@ -0,0 +1,11 @@
+error: `#[panic_handler]` function is not allowed to have `#[track_caller]`
+  --> $DIR/panic-handler-with-track-caller.rs:10:1
+   |
+LL | #[track_caller]
+   | ^^^^^^^^^^^^^^^
+LL |
+LL | fn panic(info: &PanicInfo) -> ! {
+   | ------------------------------- `#[panic_handler]` function is not allowed to have `#[target_feature]`
+
+error: aborting due to 1 previous error
+