about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYuki Okushi <jtitor@2k36.org>2023-01-15 05:47:24 +0900
committerYuki Okushi <jtitor@2k36.org>2023-01-15 05:47:24 +0900
commitaa51a0f19ae571497a18d2f75e409a3944d4b736 (patch)
tree21fbb350ab5944ecb24aa276e239defc6e20c762
parent4b51adf6ffa1ae2286ea436eb48cbaa8771886e6 (diff)
downloadrust-aa51a0f19ae571497a18d2f75e409a3944d4b736.tar.gz
rust-aa51a0f19ae571497a18d2f75e409a3944d4b736.zip
Add regression test for #92157
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
-rw-r--r--tests/ui/borrowck/issue-92157.rs40
-rw-r--r--tests/ui/borrowck/issue-92157.stderr11
2 files changed, 51 insertions, 0 deletions
diff --git a/tests/ui/borrowck/issue-92157.rs b/tests/ui/borrowck/issue-92157.rs
new file mode 100644
index 00000000000..6ee2320a603
--- /dev/null
+++ b/tests/ui/borrowck/issue-92157.rs
@@ -0,0 +1,40 @@
+#![feature(no_core)]
+#![feature(lang_items)]
+
+#![no_core]
+
+#[cfg(target_os = "linux")]
+#[link(name = "c")]
+extern {}
+
+#[lang = "start"]
+fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8) -> isize {
+    //~^ ERROR: incorrect number of parameters for the `start` lang item
+    40+2
+}
+
+#[lang = "sized"]
+pub trait Sized {}
+#[lang = "copy"]
+pub trait Copy {}
+
+#[lang = "drop_in_place"]
+#[allow(unconditional_recursion)]
+pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
+    drop_in_place(to_drop)
+}
+
+#[lang = "add"]
+trait Add<RHS> {
+    type Output;
+    fn add(self, other: RHS) -> Self::Output;
+}
+
+impl Add<isize> for isize {
+    type Output = isize;
+    fn add(self, other: isize) -> isize {
+        self + other
+    }
+}
+
+fn main() {}
diff --git a/tests/ui/borrowck/issue-92157.stderr b/tests/ui/borrowck/issue-92157.stderr
new file mode 100644
index 00000000000..a4010d73d05
--- /dev/null
+++ b/tests/ui/borrowck/issue-92157.stderr
@@ -0,0 +1,11 @@
+error: incorrect number of parameters for the `start` lang item
+  --> $DIR/issue-92157.rs:11:1
+   |
+LL | fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8) -> isize {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: the `start` lang item should have four parameters, but found 3
+   = note: the `start` lang item should have the signature `fn(fn() -> T, isize, *const *const u8, u8) -> isize`
+
+error: aborting due to previous error
+