]> git.lizzy.rs Git - rust.git/blob - tests/ui/lang-items/start_lang_item_args.rs
Auto merge of #107618 - chriswailes:linker-arg, r=albertlarsan68
[rust.git] / tests / ui / lang-items / start_lang_item_args.rs
1 // check-fail
2 // revisions: missing_all_args missing_sigpipe_arg missing_ret start_ret too_many_args
3 // revisions: main_ty main_args main_ret argc argv_inner_ptr argv sigpipe
4
5 #![feature(lang_items, no_core)]
6 #![no_core]
7
8 #[lang = "copy"]
9 pub trait Copy {}
10 #[lang = "sized"]
11 pub trait Sized {}
12
13 #[cfg(missing_all_args)]
14 #[lang = "start"]
15 fn start<T>() -> isize {
16     //[missing_all_args]~^ ERROR incorrect number of parameters
17     100
18 }
19
20 #[cfg(missing_sigpipe_arg)]
21 #[lang = "start"]
22 fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8) -> isize {
23     //[missing_sigpipe_arg]~^ ERROR incorrect number of parameters
24     100
25 }
26
27 #[cfg(missing_ret)]
28 #[lang = "start"]
29 fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8, _sigpipe: u8) {}
30 //[missing_ret]~^ ERROR the return type of the `start` lang item is incorrect
31
32 #[cfg(start_ret)]
33 #[lang = "start"]
34 fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> u8 {
35     //[start_ret]~^ ERROR the return type of the `start` lang item is incorrect
36     100
37 }
38
39 #[cfg(too_many_args)]
40 #[lang = "start"]
41 fn start<T>(
42     //[too_many_args]~^ ERROR incorrect number of parameters
43     _main: fn() -> T,
44     _argc: isize,
45     _argv: *const *const u8,
46     _sigpipe: u8,
47     _extra_arg: (),
48 ) -> isize {
49     100
50 }
51
52 #[cfg(main_ty)]
53 #[lang = "start"]
54 fn start<T>(_main: u64, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize {
55     //[main_ty]~^ ERROR parameter 1 of the `start` lang item is incorrect
56     100
57 }
58
59 #[cfg(main_args)]
60 #[lang = "start"]
61 fn start<T>(_main: fn(i32) -> T, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize {
62     //[main_args]~^ ERROR parameter 1 of the `start` lang item is incorrect
63     100
64 }
65
66 #[cfg(main_ret)]
67 #[lang = "start"]
68 fn start<T>(_main: fn() -> u16, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize {
69     //[main_ret]~^ ERROR parameter 1 of the `start` lang item is incorrect
70     100
71 }
72
73 #[cfg(argc)]
74 #[lang = "start"]
75 fn start<T>(_main: fn() -> T, _argc: i8, _argv: *const *const u8, _sigpipe: u8) -> isize {
76     //[argc]~^ ERROR parameter 2 of the `start` lang item is incorrect
77     100
78 }
79
80 #[cfg(argv_inner_ptr)]
81 #[lang = "start"]
82 fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const usize, _sigpipe: u8) -> isize {
83     //[argv_inner_ptr]~^ ERROR parameter 3 of the `start` lang item is incorrect
84     100
85 }
86
87 #[cfg(argv)]
88 #[lang = "start"]
89 fn start<T>(_main: fn() -> T, _argc: isize, _argv: u8, _sigpipe: u8) -> isize {
90     //[argv]~^ ERROR parameter 3 of the `start` lang item is incorrect
91     100
92 }
93
94 #[cfg(sigpipe)]
95 #[lang = "start"]
96 fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8, _sigpipe: i64) -> isize {
97     //[sigpipe]~^ ERROR parameter 4 of the `start` lang item is incorrect
98     100
99 }
100
101 fn main() {}