fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
3.3 KiB100 linesraw
1error[E0045]: C-variadic function must have a compatible calling convention, like `C` or `cdecl`
2  --> $DIR/variadic-ffi-1.rs:9:5
3   |
4LL |     fn printf(_: *const u8, ...);
5   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C-variadic function must have a compatible calling convention
6
7error[E0060]: this function takes at least 2 arguments but 0 arguments were supplied
8  --> $DIR/variadic-ffi-1.rs:22:9
9   |
10LL |         foo();
11   |         ^^^-- two arguments of type `isize` and `u8` are missing
12   |
13note: function defined here
14  --> $DIR/variadic-ffi-1.rs:15:8
15   |
16LL |     fn foo(f: isize, x: u8, ...);
17   |        ^^^
18help: provide the arguments
19   |
20LL |         foo(/* isize */, /* u8 */);
21   |            ~~~~~~~~~~~~~~~~~~~~~~~
22
23error[E0060]: this function takes at least 2 arguments but 1 argument was supplied
24  --> $DIR/variadic-ffi-1.rs:23:9
25   |
26LL |         foo(1);
27   |         ^^^--- an argument of type `u8` is missing
28   |
29note: function defined here
30  --> $DIR/variadic-ffi-1.rs:15:8
31   |
32LL |     fn foo(f: isize, x: u8, ...);
33   |        ^^^
34help: provide the argument
35   |
36LL |         foo(1, /* u8 */);
37   |            ~~~~~~~~~~~~~
38
39error[E0308]: mismatched types
40  --> $DIR/variadic-ffi-1.rs:25:56
41   |
42LL |         let x: unsafe extern "C" fn(f: isize, x: u8) = foo;
43   |                -------------------------------------   ^^^ expected non-variadic fn, found variadic function
44   |                |
45   |                expected due to this
46   |
47   = note: expected fn pointer `unsafe extern "C" fn(_, _)`
48                 found fn item `unsafe extern "C" fn(_, _, ...) {foo}`
49
50error[E0308]: mismatched types
51  --> $DIR/variadic-ffi-1.rs:26:54
52   |
53LL |         let y: extern "C" fn(f: isize, x: u8, ...) = bar;
54   |                -----------------------------------   ^^^ expected variadic fn, found non-variadic function
55   |                |
56   |                expected due to this
57   |
58   = note: expected fn pointer `extern "C" fn(_, _, ...)`
59                 found fn item `extern "C" fn(_, _) {bar}`
60
61error[E0617]: can't pass `f32` to variadic function
62  --> $DIR/variadic-ffi-1.rs:28:19
63   |
64LL |         foo(1, 2, 3f32);
65   |                   ^^^^ help: cast the value to `c_double`: `3f32 as c_double`
66
67error[E0617]: can't pass `bool` to variadic function
68  --> $DIR/variadic-ffi-1.rs:29:19
69   |
70LL |         foo(1, 2, true);
71   |                   ^^^^ help: cast the value to `c_int`: `true as c_int`
72
73error[E0617]: can't pass `i8` to variadic function
74  --> $DIR/variadic-ffi-1.rs:30:19
75   |
76LL |         foo(1, 2, 1i8);
77   |                   ^^^ help: cast the value to `c_int`: `1i8 as c_int`
78
79error[E0617]: can't pass `u8` to variadic function
80  --> $DIR/variadic-ffi-1.rs:31:19
81   |
82LL |         foo(1, 2, 1u8);
83   |                   ^^^ help: cast the value to `c_uint`: `1u8 as c_uint`
84
85error[E0617]: can't pass `i16` to variadic function
86  --> $DIR/variadic-ffi-1.rs:32:19
87   |
88LL |         foo(1, 2, 1i16);
89   |                   ^^^^ help: cast the value to `c_int`: `1i16 as c_int`
90
91error[E0617]: can't pass `u16` to variadic function
92  --> $DIR/variadic-ffi-1.rs:33:19
93   |
94LL |         foo(1, 2, 1u16);
95   |                   ^^^^ help: cast the value to `c_uint`: `1u16 as c_uint`
96
97error: aborting due to 11 previous errors
98
99Some errors have detailed explanations: E0045, E0060, E0308, E0617.
100For more information about an error, try `rustc --explain E0045`.