fork/rust

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

borsAuto merge of #66089 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum4560ea788cb

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