summaryrefslogtreecommitdiffstats
path: root/tests/ui/lang-items
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:43 +0000
commit3e3e70d529d8c7d7c4d7bc4fefc9f109393b9245 (patch)
treedaf049b282ab10e8c3d03e409b3cd84ff3f7690c /tests/ui/lang-items
parentAdding debian version 1.68.2+dfsg1-1. (diff)
downloadrustc-3e3e70d529d8c7d7c4d7bc4fefc9f109393b9245.tar.xz
rustc-3e3e70d529d8c7d7c4d7bc4fefc9f109393b9245.zip
Merging upstream version 1.69.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/lang-items')
-rw-r--r--tests/ui/lang-items/bad-add-impl.rs18
-rw-r--r--tests/ui/lang-items/bad-add-impl.stderr11
-rw-r--r--tests/ui/lang-items/fn-fn_mut-call-ill-formed.bad_item.stderr18
-rw-r--r--tests/ui/lang-items/fn-fn_mut-call-ill-formed.bad_sig.stderr18
-rw-r--r--tests/ui/lang-items/fn-fn_mut-call-ill-formed.fn_bad_item.stderr18
-rw-r--r--tests/ui/lang-items/fn-fn_mut-call-ill-formed.fn_bad_sig.stderr18
-rw-r--r--tests/ui/lang-items/fn-fn_mut-call-ill-formed.fn_mut_bad_item.stderr18
-rw-r--r--tests/ui/lang-items/fn-fn_mut-call-ill-formed.fn_mut_bad_sig.stderr18
-rw-r--r--tests/ui/lang-items/fn-fn_mut-call-ill-formed.fn_once_bad_item.stderr18
-rw-r--r--tests/ui/lang-items/fn-fn_mut-call-ill-formed.fn_once_bad_sig.stderr18
-rw-r--r--tests/ui/lang-items/fn-fn_mut-call-ill-formed.rs34
-rw-r--r--tests/ui/lang-items/fn-fn_mut-call-ill-formed.stderr14
-rw-r--r--tests/ui/lang-items/issue-86238.stderr2
-rw-r--r--tests/ui/lang-items/lang-item-missing-generator.rs21
-rw-r--r--tests/ui/lang-items/lang-item-missing-generator.stderr15
15 files changed, 202 insertions, 57 deletions
diff --git a/tests/ui/lang-items/bad-add-impl.rs b/tests/ui/lang-items/bad-add-impl.rs
new file mode 100644
index 000000000..0c44edbe5
--- /dev/null
+++ b/tests/ui/lang-items/bad-add-impl.rs
@@ -0,0 +1,18 @@
+#![feature(no_core)]
+#![feature(lang_items)]
+#![no_core]
+
+#[lang = "sized"]
+trait Sized {}
+
+#[lang = "add"]
+trait Add<T> {
+ const add: u32 = 1u32;
+}
+
+impl Add<u32> for u32 {}
+
+fn main() {
+ 1u32 + 1u32;
+ //~^ ERROR cannot add `u32` to `u32`
+}
diff --git a/tests/ui/lang-items/bad-add-impl.stderr b/tests/ui/lang-items/bad-add-impl.stderr
new file mode 100644
index 000000000..3143729f9
--- /dev/null
+++ b/tests/ui/lang-items/bad-add-impl.stderr
@@ -0,0 +1,11 @@
+error[E0369]: cannot add `u32` to `u32`
+ --> $DIR/bad-add-impl.rs:16:10
+ |
+LL | 1u32 + 1u32;
+ | ---- ^ ---- u32
+ | |
+ | u32
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0369`.
diff --git a/tests/ui/lang-items/fn-fn_mut-call-ill-formed.bad_item.stderr b/tests/ui/lang-items/fn-fn_mut-call-ill-formed.bad_item.stderr
new file mode 100644
index 000000000..ff603111e
--- /dev/null
+++ b/tests/ui/lang-items/fn-fn_mut-call-ill-formed.bad_item.stderr
@@ -0,0 +1,18 @@
+error: failed to find an overloaded call trait for closure call
+ --> $DIR/fn-fn_mut-call-ill-formed.rs:39:5
+ |
+LL | a();
+ | ^^^
+ |
+ = help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have correctly defined `call`/`call_mut`/`call_once` methods
+
+error: failed to find an overloaded call trait for closure call
+ --> $DIR/fn-fn_mut-call-ill-formed.rs:43:5
+ |
+LL | b();
+ | ^^^
+ |
+ = help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have correctly defined `call`/`call_mut`/`call_once` methods
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/lang-items/fn-fn_mut-call-ill-formed.bad_sig.stderr b/tests/ui/lang-items/fn-fn_mut-call-ill-formed.bad_sig.stderr
new file mode 100644
index 000000000..ff603111e
--- /dev/null
+++ b/tests/ui/lang-items/fn-fn_mut-call-ill-formed.bad_sig.stderr
@@ -0,0 +1,18 @@
+error: failed to find an overloaded call trait for closure call
+ --> $DIR/fn-fn_mut-call-ill-formed.rs:39:5
+ |
+LL | a();
+ | ^^^
+ |
+ = help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have correctly defined `call`/`call_mut`/`call_once` methods
+
+error: failed to find an overloaded call trait for closure call
+ --> $DIR/fn-fn_mut-call-ill-formed.rs:43:5
+ |
+LL | b();
+ | ^^^
+ |
+ = help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have correctly defined `call`/`call_mut`/`call_once` methods
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/lang-items/fn-fn_mut-call-ill-formed.fn_bad_item.stderr b/tests/ui/lang-items/fn-fn_mut-call-ill-formed.fn_bad_item.stderr
new file mode 100644
index 000000000..02e33c597
--- /dev/null
+++ b/tests/ui/lang-items/fn-fn_mut-call-ill-formed.fn_bad_item.stderr
@@ -0,0 +1,18 @@
+error: failed to find an overloaded call trait for closure call
+ --> $DIR/fn-fn_mut-call-ill-formed.rs:42:5
+ |
+LL | a();
+ | ^^^
+ |
+ = help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have correctly defined `call`/`call_mut`/`call_once` methods
+
+error: failed to find an overloaded call trait for closure call
+ --> $DIR/fn-fn_mut-call-ill-formed.rs:47:5
+ |
+LL | b();
+ | ^^^
+ |
+ = help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have correctly defined `call`/`call_mut`/`call_once` methods
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/lang-items/fn-fn_mut-call-ill-formed.fn_bad_sig.stderr b/tests/ui/lang-items/fn-fn_mut-call-ill-formed.fn_bad_sig.stderr
new file mode 100644
index 000000000..02e33c597
--- /dev/null
+++ b/tests/ui/lang-items/fn-fn_mut-call-ill-formed.fn_bad_sig.stderr
@@ -0,0 +1,18 @@
+error: failed to find an overloaded call trait for closure call
+ --> $DIR/fn-fn_mut-call-ill-formed.rs:42:5
+ |
+LL | a();
+ | ^^^
+ |
+ = help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have correctly defined `call`/`call_mut`/`call_once` methods
+
+error: failed to find an overloaded call trait for closure call
+ --> $DIR/fn-fn_mut-call-ill-formed.rs:47:5
+ |
+LL | b();
+ | ^^^
+ |
+ = help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have correctly defined `call`/`call_mut`/`call_once` methods
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/lang-items/fn-fn_mut-call-ill-formed.fn_mut_bad_item.stderr b/tests/ui/lang-items/fn-fn_mut-call-ill-formed.fn_mut_bad_item.stderr
new file mode 100644
index 000000000..02e33c597
--- /dev/null
+++ b/tests/ui/lang-items/fn-fn_mut-call-ill-formed.fn_mut_bad_item.stderr
@@ -0,0 +1,18 @@
+error: failed to find an overloaded call trait for closure call
+ --> $DIR/fn-fn_mut-call-ill-formed.rs:42:5
+ |
+LL | a();
+ | ^^^
+ |
+ = help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have correctly defined `call`/`call_mut`/`call_once` methods
+
+error: failed to find an overloaded call trait for closure call
+ --> $DIR/fn-fn_mut-call-ill-formed.rs:47:5
+ |
+LL | b();
+ | ^^^
+ |
+ = help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have correctly defined `call`/`call_mut`/`call_once` methods
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/lang-items/fn-fn_mut-call-ill-formed.fn_mut_bad_sig.stderr b/tests/ui/lang-items/fn-fn_mut-call-ill-formed.fn_mut_bad_sig.stderr
new file mode 100644
index 000000000..02e33c597
--- /dev/null
+++ b/tests/ui/lang-items/fn-fn_mut-call-ill-formed.fn_mut_bad_sig.stderr
@@ -0,0 +1,18 @@
+error: failed to find an overloaded call trait for closure call
+ --> $DIR/fn-fn_mut-call-ill-formed.rs:42:5
+ |
+LL | a();
+ | ^^^
+ |
+ = help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have correctly defined `call`/`call_mut`/`call_once` methods
+
+error: failed to find an overloaded call trait for closure call
+ --> $DIR/fn-fn_mut-call-ill-formed.rs:47:5
+ |
+LL | b();
+ | ^^^
+ |
+ = help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have correctly defined `call`/`call_mut`/`call_once` methods
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/lang-items/fn-fn_mut-call-ill-formed.fn_once_bad_item.stderr b/tests/ui/lang-items/fn-fn_mut-call-ill-formed.fn_once_bad_item.stderr
new file mode 100644
index 000000000..02e33c597
--- /dev/null
+++ b/tests/ui/lang-items/fn-fn_mut-call-ill-formed.fn_once_bad_item.stderr
@@ -0,0 +1,18 @@
+error: failed to find an overloaded call trait for closure call
+ --> $DIR/fn-fn_mut-call-ill-formed.rs:42:5
+ |
+LL | a();
+ | ^^^
+ |
+ = help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have correctly defined `call`/`call_mut`/`call_once` methods
+
+error: failed to find an overloaded call trait for closure call
+ --> $DIR/fn-fn_mut-call-ill-formed.rs:47:5
+ |
+LL | b();
+ | ^^^
+ |
+ = help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have correctly defined `call`/`call_mut`/`call_once` methods
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/lang-items/fn-fn_mut-call-ill-formed.fn_once_bad_sig.stderr b/tests/ui/lang-items/fn-fn_mut-call-ill-formed.fn_once_bad_sig.stderr
new file mode 100644
index 000000000..02e33c597
--- /dev/null
+++ b/tests/ui/lang-items/fn-fn_mut-call-ill-formed.fn_once_bad_sig.stderr
@@ -0,0 +1,18 @@
+error: failed to find an overloaded call trait for closure call
+ --> $DIR/fn-fn_mut-call-ill-formed.rs:42:5
+ |
+LL | a();
+ | ^^^
+ |
+ = help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have correctly defined `call`/`call_mut`/`call_once` methods
+
+error: failed to find an overloaded call trait for closure call
+ --> $DIR/fn-fn_mut-call-ill-formed.rs:47:5
+ |
+LL | b();
+ | ^^^
+ |
+ = help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have correctly defined `call`/`call_mut`/`call_once` methods
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/lang-items/fn-fn_mut-call-ill-formed.rs b/tests/ui/lang-items/fn-fn_mut-call-ill-formed.rs
index 52bd8136d..757c6538d 100644
--- a/tests/ui/lang-items/fn-fn_mut-call-ill-formed.rs
+++ b/tests/ui/lang-items/fn-fn_mut-call-ill-formed.rs
@@ -1,27 +1,49 @@
-// Make sure that an error is reported if the `call` function of the
-// `fn`/`fn_mut` lang item is grossly ill-formed.
+// revisions: fn_once_bad_item fn_once_bad_sig fn_mut_bad_item fn_mut_bad_sig fn_bad_item fn_bad_sig
#![feature(lang_items)]
#![feature(no_core)]
#![no_core]
+#[lang = "sized"]
+trait Sized {}
+
+#[cfg(any(fn_bad_item, fn_bad_sig))]
#[lang = "fn"]
trait MyFn<T> {
+ #[cfg(fn_bad_sig)]
+ fn call(i: i32) -> i32 { 0 }
+
+ #[cfg(fn_bad_item)]
const call: i32 = 42;
- //~^ ERROR: `call` trait item in `fn` lang item must be a function
}
+#[cfg(any(fn_mut_bad_item, fn_mut_bad_sig))]
#[lang = "fn_mut"]
trait MyFnMut<T> {
- fn call(i: i32, j: i32) -> i32 { i + j }
- //~^ ERROR: first argument of `call` in `fn_mut` lang item must be a reference
+ #[cfg(fn_mut_bad_sig)]
+ fn call_mut(i: i32) -> i32 { 0 }
+
+ #[cfg(fn_mut_bad_item)]
+ const call_mut: i32 = 42;
+}
+
+#[cfg(any(fn_once_bad_item, fn_once_bad_sig))]
+#[lang = "fn_once"]
+trait MyFnOnce<T> {
+ #[cfg(fn_once_bad_sig)]
+ fn call_once(i: i32) -> i32 { 0 }
+
+ #[cfg(fn_once_bad_item)]
+ const call_once: i32 = 42;
}
fn main() {
let a = || 42;
a();
+ //~^ ERROR failed to find an overloaded call trait for closure call
let mut i = 0;
- let mut b = || { i += 1; };
+ let mut b = || { };
b();
+ //~^ ERROR failed to find an overloaded call trait for closure call
}
diff --git a/tests/ui/lang-items/fn-fn_mut-call-ill-formed.stderr b/tests/ui/lang-items/fn-fn_mut-call-ill-formed.stderr
deleted file mode 100644
index 82bdae270..000000000
--- a/tests/ui/lang-items/fn-fn_mut-call-ill-formed.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error: `call` trait item in `fn` lang item must be a function
- --> $DIR/fn-fn_mut-call-ill-formed.rs:10:5
- |
-LL | const call: i32 = 42;
- | ^^^^^^^^^^^^^^^^^^^^^
-
-error: first argument of `call` in `fn_mut` lang item must be a reference
- --> $DIR/fn-fn_mut-call-ill-formed.rs:16:16
- |
-LL | fn call(i: i32, j: i32) -> i32 { i + j }
- | ^^^
-
-error: aborting due to 2 previous errors
-
diff --git a/tests/ui/lang-items/issue-86238.stderr b/tests/ui/lang-items/issue-86238.stderr
index 767e6de22..c6e811a94 100644
--- a/tests/ui/lang-items/issue-86238.stderr
+++ b/tests/ui/lang-items/issue-86238.stderr
@@ -4,7 +4,7 @@ error: failed to find an overloaded call trait for closure call
LL | one()
| ^^^^^
|
- = help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have associated `call`/`call_mut`/`call_once` functions
+ = help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have correctly defined `call`/`call_mut`/`call_once` methods
error: aborting due to previous error
diff --git a/tests/ui/lang-items/lang-item-missing-generator.rs b/tests/ui/lang-items/lang-item-missing-generator.rs
deleted file mode 100644
index 9b9aff38e..000000000
--- a/tests/ui/lang-items/lang-item-missing-generator.rs
+++ /dev/null
@@ -1,21 +0,0 @@
-// error-pattern: requires `generator` lang_item
-#![feature(no_core, lang_items, unboxed_closures, tuple_trait)]
-#![no_core]
-
-#[lang = "sized"] pub trait Sized { }
-
-#[lang = "tuple_trait"] pub trait Tuple { }
-
-#[lang = "fn_once"]
-#[rustc_paren_sugar]
-pub trait FnOnce<Args: Tuple> {
- type Output;
-
- extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
-}
-
-pub fn abc() -> impl FnOnce(f32) {
- |_| {}
-}
-
-fn main() {}
diff --git a/tests/ui/lang-items/lang-item-missing-generator.stderr b/tests/ui/lang-items/lang-item-missing-generator.stderr
deleted file mode 100644
index a24fdb5fb..000000000
--- a/tests/ui/lang-items/lang-item-missing-generator.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0635]: unknown feature `tuple_trait`
- --> $DIR/lang-item-missing-generator.rs:2:51
- |
-LL | #![feature(no_core, lang_items, unboxed_closures, tuple_trait)]
- | ^^^^^^^^^^^
-
-error: requires `generator` lang_item
- --> $DIR/lang-item-missing-generator.rs:17:17
- |
-LL | pub fn abc() -> impl FnOnce(f32) {
- | ^^^^^^^^^^^^^^^^
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0635`.