summaryrefslogtreecommitdiffstats
path: root/tests/ui/lang-items/start_lang_item_args.rs
blob: 4a0302bcb15282f9e6cad12f8db0f754ab45ad66 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
// check-fail
// revisions: missing_all_args missing_sigpipe_arg missing_ret start_ret too_many_args
// revisions: main_ty main_args main_ret argc argv_inner_ptr argv sigpipe

#![feature(lang_items, no_core)]
#![no_core]

#[lang = "copy"]
pub trait Copy {}
#[lang = "sized"]
pub trait Sized {}

#[cfg(missing_all_args)]
#[lang = "start"]
fn start<T>() -> isize {
    //[missing_all_args]~^ ERROR lang item `start` function has wrong type [E0308]
    100
}

#[cfg(missing_sigpipe_arg)]
#[lang = "start"]
fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8) -> isize {
    //[missing_sigpipe_arg]~^ ERROR lang item `start` function has wrong type [E0308]
    100
}

#[cfg(missing_ret)]
#[lang = "start"]
fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8, _sigpipe: u8) {}
//[missing_ret]~^ ERROR lang item `start` function has wrong type [E0308]

#[cfg(start_ret)]
#[lang = "start"]
fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> u8 {
    //[start_ret]~^ ERROR lang item `start` function has wrong type [E0308]
    100
}

#[cfg(too_many_args)]
#[lang = "start"]
fn start<T>(
    //[too_many_args]~^ ERROR lang item `start` function has wrong type [E0308]
    _main: fn() -> T,
    _argc: isize,
    _argv: *const *const u8,
    _sigpipe: u8,
    _extra_arg: (),
) -> isize {
    100
}

#[cfg(main_ty)]
#[lang = "start"]
fn start<T>(_main: u64, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize {
    //[main_ty]~^ ERROR lang item `start` function has wrong type [E0308]
    100
}

#[cfg(main_args)]
#[lang = "start"]
fn start<T>(_main: fn(i32) -> T, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize {
    //[main_args]~^ ERROR lang item `start` function has wrong type [E0308]
    100
}

#[cfg(main_ret)]
#[lang = "start"]
fn start<T>(_main: fn() -> u16, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize {
    //[main_ret]~^ ERROR lang item `start` function has wrong type [E0308]
    100
}

#[cfg(argc)]
#[lang = "start"]
fn start<T>(_main: fn() -> T, _argc: i8, _argv: *const *const u8, _sigpipe: u8) -> isize {
    //[argc]~^ ERROR lang item `start` function has wrong type [E0308]
    100
}

#[cfg(argv_inner_ptr)]
#[lang = "start"]
fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const usize, _sigpipe: u8) -> isize {
    //[argv_inner_ptr]~^ ERROR lang item `start` function has wrong type [E0308]
    100
}

#[cfg(argv)]
#[lang = "start"]
fn start<T>(_main: fn() -> T, _argc: isize, _argv: u8, _sigpipe: u8) -> isize {
    //[argv]~^ ERROR lang item `start` function has wrong type [E0308]
    100
}

#[cfg(sigpipe)]
#[lang = "start"]
fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8, _sigpipe: i64) -> isize {
    //[sigpipe]~^ ERROR lang item `start` function has wrong type [E0308]
    100
}

fn main() {}