]> git.lizzy.rs Git - rust.git/blob - src/test/ui/c-variadic/variadic-ffi-1.stderr
05d839a0c5507c18eed36dd68e1d409e5d99f6dd
[rust.git] / src / test / ui / c-variadic / variadic-ffi-1.stderr
1 error[E0045]: C-variadic function must have C or cdecl calling convention
2   --> $DIR/variadic-ffi-1.rs:5:5
3    |
4 LL |     fn printf(_: *const u8, ...);
5    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C-variadics require C or cdecl calling convention
6
7 error[E0060]: this function takes at least 2 parameters but 0 parameters were supplied
8   --> $DIR/variadic-ffi-1.rs:16:9
9    |
10 LL |     fn foo(f: isize, x: u8, ...);
11    |     ----------------------------- defined here
12 ...
13 LL |         foo();
14    |         ^^^^^ expected at least 2 parameters
15
16 error[E0060]: this function takes at least 2 parameters but 1 parameter was supplied
17   --> $DIR/variadic-ffi-1.rs:17:9
18    |
19 LL |     fn foo(f: isize, x: u8, ...);
20    |     ----------------------------- defined here
21 ...
22 LL |         foo(1);
23    |         ^^^^^^ expected at least 2 parameters
24
25 error[E0308]: mismatched types
26   --> $DIR/variadic-ffi-1.rs:19:56
27    |
28 LL |         let x: unsafe extern "C" fn(f: isize, x: u8) = foo;
29    |                -------------------------------------   ^^^ expected non-variadic fn, found variadic function
30    |                |
31    |                expected due to this
32    |
33    = note: expected fn pointer `unsafe extern "C" fn(_, _)`
34                  found fn item `unsafe extern "C" fn(_, _, ...) {foo}`
35
36 error[E0308]: mismatched types
37   --> $DIR/variadic-ffi-1.rs:20:54
38    |
39 LL |         let y: extern "C" fn(f: isize, x: u8, ...) = bar;
40    |                -----------------------------------   ^^^ expected variadic fn, found non-variadic function
41    |                |
42    |                expected due to this
43    |
44    = note: expected fn pointer `extern "C" fn(_, _, ...)`
45                  found fn item `extern "C" fn(_, _) {bar}`
46
47 error[E0617]: can't pass `f32` to variadic function
48   --> $DIR/variadic-ffi-1.rs:22:19
49    |
50 LL |         foo(1, 2, 3f32);
51    |                   ^^^^ help: cast the value to `c_double`: `3f32 as c_double`
52
53 error[E0617]: can't pass `bool` to variadic function
54   --> $DIR/variadic-ffi-1.rs:23:19
55    |
56 LL |         foo(1, 2, true);
57    |                   ^^^^ help: cast the value to `c_int`: `true as c_int`
58
59 error[E0617]: can't pass `i8` to variadic function
60   --> $DIR/variadic-ffi-1.rs:24:19
61    |
62 LL |         foo(1, 2, 1i8);
63    |                   ^^^ help: cast the value to `c_int`: `1i8 as c_int`
64
65 error[E0617]: can't pass `u8` to variadic function
66   --> $DIR/variadic-ffi-1.rs:25:19
67    |
68 LL |         foo(1, 2, 1u8);
69    |                   ^^^ help: cast the value to `c_uint`: `1u8 as c_uint`
70
71 error[E0617]: can't pass `i16` to variadic function
72   --> $DIR/variadic-ffi-1.rs:26:19
73    |
74 LL |         foo(1, 2, 1i16);
75    |                   ^^^^ help: cast the value to `c_int`: `1i16 as c_int`
76
77 error[E0617]: can't pass `u16` to variadic function
78   --> $DIR/variadic-ffi-1.rs:27:19
79    |
80 LL |         foo(1, 2, 1u16);
81    |                   ^^^^ help: cast the value to `c_uint`: `1u16 as c_uint`
82
83 error: aborting due to 11 previous errors
84
85 Some errors have detailed explanations: E0045, E0060, E0308, E0617.
86 For more information about an error, try `rustc --explain E0045`.