Skip to content

Commit aa51a0f

Browse files
committed
Add regression test for #92157
Signed-off-by: Yuki Okushi <[email protected]>
1 parent 4b51adf commit aa51a0f

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

tests/ui/borrowck/issue-92157.rs

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#![feature(no_core)]
2+
#![feature(lang_items)]
3+
4+
#![no_core]
5+
6+
#[cfg(target_os = "linux")]
7+
#[link(name = "c")]
8+
extern {}
9+
10+
#[lang = "start"]
11+
fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8) -> isize {
12+
//~^ ERROR: incorrect number of parameters for the `start` lang item
13+
40+2
14+
}
15+
16+
#[lang = "sized"]
17+
pub trait Sized {}
18+
#[lang = "copy"]
19+
pub trait Copy {}
20+
21+
#[lang = "drop_in_place"]
22+
#[allow(unconditional_recursion)]
23+
pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
24+
drop_in_place(to_drop)
25+
}
26+
27+
#[lang = "add"]
28+
trait Add<RHS> {
29+
type Output;
30+
fn add(self, other: RHS) -> Self::Output;
31+
}
32+
33+
impl Add<isize> for isize {
34+
type Output = isize;
35+
fn add(self, other: isize) -> isize {
36+
self + other
37+
}
38+
}
39+
40+
fn main() {}

tests/ui/borrowck/issue-92157.stderr

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error: incorrect number of parameters for the `start` lang item
2+
--> $DIR/issue-92157.rs:11:1
3+
|
4+
LL | fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8) -> isize {
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: the `start` lang item should have four parameters, but found 3
8+
= note: the `start` lang item should have the signature `fn(fn() -> T, isize, *const *const u8, u8) -> isize`
9+
10+
error: aborting due to previous error
11+

0 commit comments

Comments
 (0)