summaryrefslogtreecommitdiffstats
path: root/src/test/ui/alloc-error
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/alloc-error')
-rw-r--r--src/test/ui/alloc-error/alloc-error-handler-bad-signature-1.rs4
-rw-r--r--src/test/ui/alloc-error/alloc-error-handler-bad-signature-1.stderr52
-rw-r--r--src/test/ui/alloc-error/alloc-error-handler-bad-signature-2.rs4
-rw-r--r--src/test/ui/alloc-error/alloc-error-handler-bad-signature-2.stderr61
-rw-r--r--src/test/ui/alloc-error/alloc-error-handler-bad-signature-3.rs2
-rw-r--r--src/test/ui/alloc-error/alloc-error-handler-bad-signature-3.stderr21
6 files changed, 121 insertions, 23 deletions
diff --git a/src/test/ui/alloc-error/alloc-error-handler-bad-signature-1.rs b/src/test/ui/alloc-error/alloc-error-handler-bad-signature-1.rs
index 41c9a265c..cd06423e3 100644
--- a/src/test/ui/alloc-error/alloc-error-handler-bad-signature-1.rs
+++ b/src/test/ui/alloc-error/alloc-error-handler-bad-signature-1.rs
@@ -8,8 +8,8 @@ use core::alloc::Layout;
#[alloc_error_handler]
fn oom(
- info: &Layout, //~ ERROR argument should be `Layout`
-) -> () //~ ERROR return type should be `!`
+ info: &Layout, //~^ ERROR mismatched types
+) -> () //~^^ ERROR mismatched types
{
loop {}
}
diff --git a/src/test/ui/alloc-error/alloc-error-handler-bad-signature-1.stderr b/src/test/ui/alloc-error/alloc-error-handler-bad-signature-1.stderr
index 34e09da45..dd3665f22 100644
--- a/src/test/ui/alloc-error/alloc-error-handler-bad-signature-1.stderr
+++ b/src/test/ui/alloc-error/alloc-error-handler-bad-signature-1.stderr
@@ -1,14 +1,50 @@
-error: return type should be `!`
- --> $DIR/alloc-error-handler-bad-signature-1.rs:12:6
+error[E0308]: mismatched types
+ --> $DIR/alloc-error-handler-bad-signature-1.rs:10:1
|
-LL | ) -> ()
- | ^^
-
-error: argument should be `Layout`
- --> $DIR/alloc-error-handler-bad-signature-1.rs:11:11
+LL | #[alloc_error_handler]
+ | ---------------------- in this procedural macro expansion
+LL | fn oom(
+ | __^
+ | | _|
+ | ||
+LL | || info: &Layout,
+LL | || ) -> ()
+ | ||_______- arguments to this function are incorrect
+LL | | {
+LL | | loop {}
+LL | | }
+ | |__^ expected `&Layout`, found struct `Layout`
+ |
+note: function defined here
+ --> $DIR/alloc-error-handler-bad-signature-1.rs:10:4
|
+LL | fn oom(
+ | ^^^
LL | info: &Layout,
- | ^^^^^^^
+ | -------------
+ = note: this error originates in the attribute macro `alloc_error_handler` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0308]: mismatched types
+ --> $DIR/alloc-error-handler-bad-signature-1.rs:10:1
+ |
+LL | #[alloc_error_handler]
+ | ---------------------- in this procedural macro expansion
+LL | fn oom(
+ | __^
+ | | _|
+ | ||
+LL | || info: &Layout,
+LL | || ) -> ()
+ | ||_______^ expected `!`, found `()`
+LL | | {
+LL | | loop {}
+LL | | }
+ | |__- expected `!` because of return type
+ |
+ = note: expected type `!`
+ found unit type `()`
+ = note: this error originates in the attribute macro `alloc_error_handler` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/alloc-error/alloc-error-handler-bad-signature-2.rs b/src/test/ui/alloc-error/alloc-error-handler-bad-signature-2.rs
index 49ea3105f..4f76257fc 100644
--- a/src/test/ui/alloc-error/alloc-error-handler-bad-signature-2.rs
+++ b/src/test/ui/alloc-error/alloc-error-handler-bad-signature-2.rs
@@ -8,8 +8,8 @@ struct Layout;
#[alloc_error_handler]
fn oom(
- info: Layout, //~ ERROR argument should be `Layout`
-) { //~ ERROR return type should be `!`
+ info: Layout, //~^ ERROR mismatched types
+) { //~^^ ERROR mismatched types
loop {}
}
diff --git a/src/test/ui/alloc-error/alloc-error-handler-bad-signature-2.stderr b/src/test/ui/alloc-error/alloc-error-handler-bad-signature-2.stderr
index 85544b0c3..adb652fe6 100644
--- a/src/test/ui/alloc-error/alloc-error-handler-bad-signature-2.stderr
+++ b/src/test/ui/alloc-error/alloc-error-handler-bad-signature-2.stderr
@@ -1,14 +1,59 @@
-error: return type should be `!`
- --> $DIR/alloc-error-handler-bad-signature-2.rs:12:3
+error[E0308]: mismatched types
+ --> $DIR/alloc-error-handler-bad-signature-2.rs:10:1
|
-LL | ) {
- | ^
-
-error: argument should be `Layout`
- --> $DIR/alloc-error-handler-bad-signature-2.rs:11:11
+LL | #[alloc_error_handler]
+ | ---------------------- in this procedural macro expansion
+LL | fn oom(
+ | __^
+ | | _|
+ | ||
+LL | || info: Layout,
+LL | || ) {
+ | ||_- arguments to this function are incorrect
+LL | | loop {}
+LL | | }
+ | |__^ expected struct `Layout`, found struct `core::alloc::Layout`
+ |
+ = note: struct `core::alloc::Layout` and struct `Layout` have similar names, but are actually distinct types
+note: struct `core::alloc::Layout` is defined in crate `core`
+ --> $SRC_DIR/core/src/alloc/layout.rs:LL:COL
+ |
+LL | pub struct Layout {
+ | ^^^^^^^^^^^^^^^^^
+note: struct `Layout` is defined in the current crate
+ --> $DIR/alloc-error-handler-bad-signature-2.rs:7:1
+ |
+LL | struct Layout;
+ | ^^^^^^^^^^^^^
+note: function defined here
+ --> $DIR/alloc-error-handler-bad-signature-2.rs:10:4
|
+LL | fn oom(
+ | ^^^
LL | info: Layout,
- | ^^^^^^
+ | ------------
+ = note: this error originates in the attribute macro `alloc_error_handler` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0308]: mismatched types
+ --> $DIR/alloc-error-handler-bad-signature-2.rs:10:1
+ |
+LL | #[alloc_error_handler]
+ | ---------------------- in this procedural macro expansion
+LL | fn oom(
+ | __^
+ | | _|
+ | ||
+LL | || info: Layout,
+LL | || ) {
+ | ||_^ expected `!`, found `()`
+LL | | loop {}
+LL | | }
+ | |__- expected `!` because of return type
+ |
+ = note: expected type `!`
+ found unit type `()`
+ = note: this error originates in the attribute macro `alloc_error_handler` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/alloc-error/alloc-error-handler-bad-signature-3.rs b/src/test/ui/alloc-error/alloc-error-handler-bad-signature-3.rs
index 321fd954d..8430fabe8 100644
--- a/src/test/ui/alloc-error/alloc-error-handler-bad-signature-3.rs
+++ b/src/test/ui/alloc-error/alloc-error-handler-bad-signature-3.rs
@@ -7,7 +7,7 @@
struct Layout;
#[alloc_error_handler]
-fn oom() -> ! { //~ ERROR function should have one argument
+fn oom() -> ! { //~ ERROR this function takes 0 arguments but 1 argument was supplied
loop {}
}
diff --git a/src/test/ui/alloc-error/alloc-error-handler-bad-signature-3.stderr b/src/test/ui/alloc-error/alloc-error-handler-bad-signature-3.stderr
index 8575e7508..77ea8ef05 100644
--- a/src/test/ui/alloc-error/alloc-error-handler-bad-signature-3.stderr
+++ b/src/test/ui/alloc-error/alloc-error-handler-bad-signature-3.stderr
@@ -1,8 +1,25 @@
-error: function should have one argument
+error[E0061]: this function takes 0 arguments but 1 argument was supplied
--> $DIR/alloc-error-handler-bad-signature-3.rs:10:1
|
+LL | #[alloc_error_handler]
+ | ---------------------- in this procedural macro expansion
+LL | fn oom() -> ! {
+ | _-^^^^^^^^^^^^
+LL | | loop {}
+LL | | }
+ | |_- argument of type `core::alloc::Layout` unexpected
+ |
+note: function defined here
+ --> $DIR/alloc-error-handler-bad-signature-3.rs:10:4
+ |
LL | fn oom() -> ! {
- | ^^^^^^^^^^^^^
+ | ^^^
+ = note: this error originates in the attribute macro `alloc_error_handler` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: remove the extra argument
+ |
+LL | fn oom() -> !() {
+ | ++
error: aborting due to previous error
+For more information about this error, try `rustc --explain E0061`.