Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add regression test for #92157 #106878

Merged
merged 1 commit into from
Jan 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions tests/ui/borrowck/issue-92157.rs
Original file line number Diff line number Diff line change
@@ -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() {}
11 changes: 11 additions & 0 deletions tests/ui/borrowck/issue-92157.stderr
Original file line number Diff line number Diff line change
@@ -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