1 error[E0045]: C-variadic function must have C or cdecl calling convention
2 --> $DIR/variadic-ffi-1.rs:9:5
4 LL | fn printf(_: *const u8, ...);
5 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C-variadics require C or cdecl calling convention
7 error[E0060]: this function takes at least 2 arguments but 0 arguments were supplied
8 --> $DIR/variadic-ffi-1.rs:20:9
11 | ^^^-- two arguments of type `isize` and `u8` are missing
13 note: function defined here
14 --> $DIR/variadic-ffi-1.rs:13:8
16 LL | fn foo(f: isize, x: u8, ...);
18 help: provide the arguments
20 LL | foo(/* isize */, /* u8 */);
21 | ~~~~~~~~~~~~~~~~~~~~~~~~~~
23 error[E0060]: this function takes at least 2 arguments but 1 argument was supplied
24 --> $DIR/variadic-ffi-1.rs:21:9
27 | ^^^--- an argument of type `u8` is missing
29 note: function defined here
30 --> $DIR/variadic-ffi-1.rs:13:8
32 LL | fn foo(f: isize, x: u8, ...);
34 help: provide the argument
36 LL | foo(1, /* u8 */);
39 error[E0308]: mismatched types
40 --> $DIR/variadic-ffi-1.rs:23:56
42 LL | let x: unsafe extern "C" fn(f: isize, x: u8) = foo;
43 | ------------------------------------- ^^^ expected non-variadic fn, found variadic function
45 | expected due to this
47 = note: expected fn pointer `unsafe extern "C" fn(_, _)`
48 found fn item `unsafe extern "C" fn(_, _, ...) {foo}`
50 error[E0308]: mismatched types
51 --> $DIR/variadic-ffi-1.rs:24:54
53 LL | let y: extern "C" fn(f: isize, x: u8, ...) = bar;
54 | ----------------------------------- ^^^ expected variadic fn, found non-variadic function
56 | expected due to this
58 = note: expected fn pointer `extern "C" fn(_, _, ...)`
59 found fn item `extern "C" fn(_, _) {bar}`
61 error[E0617]: can't pass `f32` to variadic function
62 --> $DIR/variadic-ffi-1.rs:26:19
65 | ^^^^ help: cast the value to `c_double`: `3f32 as c_double`
67 error[E0617]: can't pass `bool` to variadic function
68 --> $DIR/variadic-ffi-1.rs:27:19
71 | ^^^^ help: cast the value to `c_int`: `true as c_int`
73 error[E0617]: can't pass `i8` to variadic function
74 --> $DIR/variadic-ffi-1.rs:28:19
77 | ^^^ help: cast the value to `c_int`: `1i8 as c_int`
79 error[E0617]: can't pass `u8` to variadic function
80 --> $DIR/variadic-ffi-1.rs:29:19
83 | ^^^ help: cast the value to `c_uint`: `1u8 as c_uint`
85 error[E0617]: can't pass `i16` to variadic function
86 --> $DIR/variadic-ffi-1.rs:30:19
89 | ^^^^ help: cast the value to `c_int`: `1i16 as c_int`
91 error[E0617]: can't pass `u16` to variadic function
92 --> $DIR/variadic-ffi-1.rs:31:19
95 | ^^^^ help: cast the value to `c_uint`: `1u16 as c_uint`
97 error: aborting due to 11 previous errors
99 Some errors have detailed explanations: E0045, E0060, E0308, E0617.
100 For more information about an error, try `rustc --explain E0045`.