about summary refs log tree commit diff
path: root/tests/ui/panic-handler
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-09-22 08:36:18 +0000
committerbors <bors@rust-lang.org>2023-09-22 08:36:18 +0000
commitce33ca0a1e5d10589fa6ea89ef64242b1b6552dc (patch)
tree9155b7bc012f9b7342a94f59f74ae7145de9861a /tests/ui/panic-handler
parentaea1eff871cdb587e936613a9b3d160cd5d61049 (diff)
parent896065f902602e99c6996cee9cee99ab7c00dcaa (diff)
downloadrust-ce33ca0a1e5d10589fa6ea89ef64242b1b6552dc.tar.gz
rust-ce33ca0a1e5d10589fa6ea89ef64242b1b6552dc.zip
Auto merge of #3074 - rust-lang:rustup-2023-09-22, r=RalfJung
Automatic sync from rustc
Diffstat (limited to 'tests/ui/panic-handler')
-rw-r--r--tests/ui/panic-handler/panic-handler-bad-signature-1.rs7
-rw-r--r--tests/ui/panic-handler/panic-handler-bad-signature-1.stderr18
-rw-r--r--tests/ui/panic-handler/panic-handler-bad-signature-2.rs5
-rw-r--r--tests/ui/panic-handler/panic-handler-bad-signature-2.stderr12
-rw-r--r--tests/ui/panic-handler/panic-handler-bad-signature-3.rs2
-rw-r--r--tests/ui/panic-handler/panic-handler-bad-signature-3.stderr8
-rw-r--r--tests/ui/panic-handler/panic-handler-bad-signature-5.rs13
-rw-r--r--tests/ui/panic-handler/panic-handler-bad-signature-5.stderr12
8 files changed, 52 insertions, 25 deletions
diff --git a/tests/ui/panic-handler/panic-handler-bad-signature-1.rs b/tests/ui/panic-handler/panic-handler-bad-signature-1.rs
index 775961d3fd7..ae27db7a835 100644
--- a/tests/ui/panic-handler/panic-handler-bad-signature-1.rs
+++ b/tests/ui/panic-handler/panic-handler-bad-signature-1.rs
@@ -6,8 +6,5 @@
 use core::panic::PanicInfo;
 
 #[panic_handler]
-fn panic(
-    info: PanicInfo, //~ ERROR argument should be `&PanicInfo`
-) -> () //~ ERROR return type should be `!`
-{
-}
+fn panic(info: PanicInfo) -> () {}
+//~^ `#[panic_handler]` function has wrong type [E0308]
diff --git a/tests/ui/panic-handler/panic-handler-bad-signature-1.stderr b/tests/ui/panic-handler/panic-handler-bad-signature-1.stderr
index 8b044f7669c..d12bfbf269e 100644
--- a/tests/ui/panic-handler/panic-handler-bad-signature-1.stderr
+++ b/tests/ui/panic-handler/panic-handler-bad-signature-1.stderr
@@ -1,14 +1,12 @@
-error: return type should be `!`
-  --> $DIR/panic-handler-bad-signature-1.rs:11:6
+error[E0308]: `#[panic_handler]` function has wrong type
+  --> $DIR/panic-handler-bad-signature-1.rs:9:16
    |
-LL | ) -> ()
-   |      ^^
-
-error: argument should be `&PanicInfo`
-  --> $DIR/panic-handler-bad-signature-1.rs:10:11
+LL | fn panic(info: PanicInfo) -> () {}
+   |                ^^^^^^^^^ expected `&PanicInfo<'_>`, found `PanicInfo<'_>`
    |
-LL |     info: PanicInfo,
-   |           ^^^^^^^^^
+   = note: expected signature `fn(&PanicInfo<'_>) -> !`
+              found signature `fn(PanicInfo<'_>)`
 
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/panic-handler/panic-handler-bad-signature-2.rs b/tests/ui/panic-handler/panic-handler-bad-signature-2.rs
index 72793400058..3c3f1513f6f 100644
--- a/tests/ui/panic-handler/panic-handler-bad-signature-2.rs
+++ b/tests/ui/panic-handler/panic-handler-bad-signature-2.rs
@@ -6,9 +6,8 @@
 use core::panic::PanicInfo;
 
 #[panic_handler]
-fn panic(
-    info: &'static PanicInfo, //~ ERROR argument should be `&PanicInfo`
-) -> !
+fn panic(info: &'static PanicInfo) -> !
+//~^ #[panic_handler]` function has wrong type [E0308]
 {
     loop {}
 }
diff --git a/tests/ui/panic-handler/panic-handler-bad-signature-2.stderr b/tests/ui/panic-handler/panic-handler-bad-signature-2.stderr
index 5ab6934202e..06e32d5fb84 100644
--- a/tests/ui/panic-handler/panic-handler-bad-signature-2.stderr
+++ b/tests/ui/panic-handler/panic-handler-bad-signature-2.stderr
@@ -1,8 +1,12 @@
-error: argument should be `&PanicInfo`
-  --> $DIR/panic-handler-bad-signature-2.rs:10:11
+error[E0308]: `#[panic_handler]` function has wrong type
+  --> $DIR/panic-handler-bad-signature-2.rs:9:1
    |
-LL |     info: &'static PanicInfo,
-   |           ^^^^^^^^^^^^^^^^^^
+LL | fn panic(info: &'static PanicInfo) -> !
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
+   |
+   = note: expected fn pointer `for<'a, 'b> fn(&'a PanicInfo<'b>) -> _`
+              found fn pointer `for<'a> fn(&'static PanicInfo<'a>) -> _`
 
 error: aborting due to previous error
 
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/panic-handler/panic-handler-bad-signature-3.rs b/tests/ui/panic-handler/panic-handler-bad-signature-3.rs
index ab9c9d7f417..9e17e32fbb4 100644
--- a/tests/ui/panic-handler/panic-handler-bad-signature-3.rs
+++ b/tests/ui/panic-handler/panic-handler-bad-signature-3.rs
@@ -6,6 +6,6 @@
 use core::panic::PanicInfo;
 
 #[panic_handler]
-fn panic() -> ! { //~ ERROR function should have one argument
+fn panic() -> ! { //~ #[panic_handler]` function has wrong type [E0308]
     loop {}
 }
diff --git a/tests/ui/panic-handler/panic-handler-bad-signature-3.stderr b/tests/ui/panic-handler/panic-handler-bad-signature-3.stderr
index 0a70181fdac..8365f5769eb 100644
--- a/tests/ui/panic-handler/panic-handler-bad-signature-3.stderr
+++ b/tests/ui/panic-handler/panic-handler-bad-signature-3.stderr
@@ -1,8 +1,12 @@
-error: function should have one argument
+error[E0308]: `#[panic_handler]` function has wrong type
   --> $DIR/panic-handler-bad-signature-3.rs:9:1
    |
 LL | fn panic() -> ! {
-   | ^^^^^^^^^^^^^^^
+   | ^^^^^^^^^^^^^^^ incorrect number of function parameters
+   |
+   = note: expected signature `fn(&PanicInfo<'_>) -> _`
+              found signature `fn() -> _`
 
 error: aborting due to previous error
 
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/panic-handler/panic-handler-bad-signature-5.rs b/tests/ui/panic-handler/panic-handler-bad-signature-5.rs
new file mode 100644
index 00000000000..97307d1b2a4
--- /dev/null
+++ b/tests/ui/panic-handler/panic-handler-bad-signature-5.rs
@@ -0,0 +1,13 @@
+// compile-flags:-C panic=abort
+
+#![no_std]
+#![no_main]
+
+use core::panic::PanicInfo;
+
+#[panic_handler]
+fn panic(info: &PanicInfo<'static>) -> !
+//~^ #[panic_handler]` function has wrong type [E0308]
+{
+    loop {}
+}
diff --git a/tests/ui/panic-handler/panic-handler-bad-signature-5.stderr b/tests/ui/panic-handler/panic-handler-bad-signature-5.stderr
new file mode 100644
index 00000000000..22b8d5ca811
--- /dev/null
+++ b/tests/ui/panic-handler/panic-handler-bad-signature-5.stderr
@@ -0,0 +1,12 @@
+error[E0308]: `#[panic_handler]` function has wrong type
+  --> $DIR/panic-handler-bad-signature-5.rs:9:1
+   |
+LL | fn panic(info: &PanicInfo<'static>) -> !
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
+   |
+   = note: expected fn pointer `for<'a, 'b> fn(&'a PanicInfo<'b>) -> _`
+              found fn pointer `for<'a> fn(&'a PanicInfo<'static>) -> _`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.