1 error[E0045]: C-variadic function must have C or cdecl calling convention
2 --> $DIR/variadic-ffi-1.rs:5: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 parameters but 0 parameters were supplied
8 --> $DIR/variadic-ffi-1.rs:16:9
10 LL | fn foo(f: isize, x: u8, ...);
11 | ----------------------------- defined here
14 | ^^^^^ expected at least 2 parameters
16 error[E0060]: this function takes at least 2 parameters but 1 parameter was supplied
17 --> $DIR/variadic-ffi-1.rs:17:9
19 LL | fn foo(f: isize, x: u8, ...);
20 | ----------------------------- defined here
23 | ^^^^^^ expected at least 2 parameters
25 error[E0308]: mismatched types
26 --> $DIR/variadic-ffi-1.rs:19:56
28 LL | let x: unsafe extern "C" fn(f: isize, x: u8) = foo;
29 | ------------------------------------- ^^^ expected non-variadic fn, found variadic function
31 | expected due to this
33 = note: expected fn pointer `unsafe extern "C" fn(_, _)`
34 found fn item `unsafe extern "C" fn(_, _, ...) {foo}`
36 error[E0308]: mismatched types
37 --> $DIR/variadic-ffi-1.rs:20:54
39 LL | let y: extern "C" fn(f: isize, x: u8, ...) = bar;
40 | ----------------------------------- ^^^ expected variadic fn, found non-variadic function
42 | expected due to this
44 = note: expected fn pointer `extern "C" fn(_, _, ...)`
45 found fn item `extern "C" fn(_, _) {bar}`
47 error[E0617]: can't pass `f32` to variadic function
48 --> $DIR/variadic-ffi-1.rs:22:19
51 | ^^^^ help: cast the value to `c_double`: `3f32 as c_double`
53 error[E0617]: can't pass `bool` to variadic function
54 --> $DIR/variadic-ffi-1.rs:23:19
57 | ^^^^ help: cast the value to `c_int`: `true as c_int`
59 error[E0617]: can't pass `i8` to variadic function
60 --> $DIR/variadic-ffi-1.rs:24:19
63 | ^^^ help: cast the value to `c_int`: `1i8 as c_int`
65 error[E0617]: can't pass `u8` to variadic function
66 --> $DIR/variadic-ffi-1.rs:25:19
69 | ^^^ help: cast the value to `c_uint`: `1u8 as c_uint`
71 error[E0617]: can't pass `i16` to variadic function
72 --> $DIR/variadic-ffi-1.rs:26:19
75 | ^^^^ help: cast the value to `c_int`: `1i16 as c_int`
77 error[E0617]: can't pass `u16` to variadic function
78 --> $DIR/variadic-ffi-1.rs:27:19
81 | ^^^^ help: cast the value to `c_uint`: `1u16 as c_uint`
83 error: aborting due to 11 previous errors
85 Some errors have detailed explanations: E0045, E0060, E0308, E0617.
86 For more information about an error, try `rustc --explain E0045`.