about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/test/run-make-fulldeps/issue-51671/Makefile2
-rw-r--r--src/test/run-make-fulldeps/issue-51671/app.rs4
-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.stderr65
-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
-rw-r--r--src/test/ui/feature-gates/feature-gate-alloc-error-handler.rs6
-rw-r--r--src/test/ui/feature-gates/feature-gate-alloc-error-handler.stderr6
10 files changed, 135 insertions, 31 deletions
diff --git a/src/test/run-make-fulldeps/issue-51671/Makefile b/src/test/run-make-fulldeps/issue-51671/Makefile
index 1d1d370d382..c9364536992 100644
--- a/src/test/run-make-fulldeps/issue-51671/Makefile
+++ b/src/test/run-make-fulldeps/issue-51671/Makefile
@@ -6,4 +6,4 @@ all:
 	$(RUSTC) --emit=obj app.rs
 	nm $(TMPDIR)/app.o | $(CGREP) rust_begin_unwind
 	nm $(TMPDIR)/app.o | $(CGREP) rust_eh_personality
-	nm $(TMPDIR)/app.o | $(CGREP) rust_oom
+	nm $(TMPDIR)/app.o | $(CGREP) __rg_oom
diff --git a/src/test/run-make-fulldeps/issue-51671/app.rs b/src/test/run-make-fulldeps/issue-51671/app.rs
index c13937dcfbe..e9dc1e9744f 100644
--- a/src/test/run-make-fulldeps/issue-51671/app.rs
+++ b/src/test/run-make-fulldeps/issue-51671/app.rs
@@ -1,5 +1,5 @@
 #![crate_type = "bin"]
-#![feature(lang_items)]
+#![feature(lang_items, alloc_error_handler)]
 #![no_main]
 #![no_std]
 
@@ -14,7 +14,7 @@ fn panic(_: &PanicInfo) -> ! {
 #[lang = "eh_personality"]
 fn eh() {}
 
-#[lang = "oom"]
+#[alloc_error_handler]
 fn oom(_: Layout) -> ! {
     loop {}
 }
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 41c9a265cd7..cd06423e3a5 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 34e09da45ad..d0911fa3985 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 49ea3105fbd..4f76257fc72 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 85544b0c384..5777279855d 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,63 @@
-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 321fd954db6..8430fabe84d 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 8575e7508f1..77ea8ef0520 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`.
diff --git a/src/test/ui/feature-gates/feature-gate-alloc-error-handler.rs b/src/test/ui/feature-gates/feature-gate-alloc-error-handler.rs
index ad890961830..78d189d20b6 100644
--- a/src/test/ui/feature-gates/feature-gate-alloc-error-handler.rs
+++ b/src/test/ui/feature-gates/feature-gate-alloc-error-handler.rs
@@ -5,10 +5,12 @@
 
 use core::alloc::Layout;
 
-#[alloc_error_handler] //~ ERROR the `#[alloc_error_handler]` attribute is an experimental feature
+#[alloc_error_handler] //~ ERROR use of unstable library feature 'alloc_error_handler'
 fn oom(info: Layout) -> ! {
     loop {}
 }
 
 #[panic_handler]
-fn panic(_: &core::panic::PanicInfo) -> ! { loop {} }
+fn panic(_: &core::panic::PanicInfo) -> ! {
+    loop {}
+}
diff --git a/src/test/ui/feature-gates/feature-gate-alloc-error-handler.stderr b/src/test/ui/feature-gates/feature-gate-alloc-error-handler.stderr
index 03f31e53f4f..f414eb463df 100644
--- a/src/test/ui/feature-gates/feature-gate-alloc-error-handler.stderr
+++ b/src/test/ui/feature-gates/feature-gate-alloc-error-handler.stderr
@@ -1,8 +1,8 @@
-error[E0658]: the `#[alloc_error_handler]` attribute is an experimental feature
-  --> $DIR/feature-gate-alloc-error-handler.rs:8:1
+error[E0658]: use of unstable library feature 'alloc_error_handler'
+  --> $DIR/feature-gate-alloc-error-handler.rs:8:3
    |
 LL | #[alloc_error_handler]
-   | ^^^^^^^^^^^^^^^^^^^^^^
+   |   ^^^^^^^^^^^^^^^^^^^
    |
    = note: see issue #51540 <https://github.com/rust-lang/rust/issues/51540> for more information
    = help: add `#![feature(alloc_error_handler)]` to the crate attributes to enable