fork/rust

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

borsAuto merge of #72883 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum49cae55760d

1.44.0
3.1 KiB90 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 arguments but 0 arguments 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   |         ^^^-- supplied 0 arguments
15   |         |
16   |         expected at least 2 arguments
17
18error[E0060]: this function takes at least 2 arguments but 1 argument was supplied
19  --> $DIR/variadic-ffi-1.rs:17:9
20   |
21LL |     fn foo(f: isize, x: u8, ...);
22   |     ----------------------------- defined here
23...
24LL |         foo(1);
25   |         ^^^ - supplied 1 argument
26   |         |
27   |         expected at least 2 arguments
28
29error[E0308]: mismatched types
30  --> $DIR/variadic-ffi-1.rs:19:56
31   |
32LL |         let x: unsafe extern "C" fn(f: isize, x: u8) = foo;
33   |                -------------------------------------   ^^^ expected non-variadic fn, found variadic function
34   |                |
35   |                expected due to this
36   |
37   = note: expected fn pointer `unsafe extern "C" fn(_, _)`
38                 found fn item `unsafe extern "C" fn(_, _, ...) {foo}`
39
40error[E0308]: mismatched types
41  --> $DIR/variadic-ffi-1.rs:20:54
42   |
43LL |         let y: extern "C" fn(f: isize, x: u8, ...) = bar;
44   |                -----------------------------------   ^^^ expected variadic fn, found non-variadic function
45   |                |
46   |                expected due to this
47   |
48   = note: expected fn pointer `extern "C" fn(_, _, ...)`
49                 found fn item `extern "C" fn(_, _) {bar}`
50
51error[E0617]: can't pass `f32` to variadic function
52  --> $DIR/variadic-ffi-1.rs:22:19
53   |
54LL |         foo(1, 2, 3f32);
55   |                   ^^^^ help: cast the value to `c_double`: `3f32 as c_double`
56
57error[E0617]: can't pass `bool` to variadic function
58  --> $DIR/variadic-ffi-1.rs:23:19
59   |
60LL |         foo(1, 2, true);
61   |                   ^^^^ help: cast the value to `c_int`: `true as c_int`
62
63error[E0617]: can't pass `i8` to variadic function
64  --> $DIR/variadic-ffi-1.rs:24:19
65   |
66LL |         foo(1, 2, 1i8);
67   |                   ^^^ help: cast the value to `c_int`: `1i8 as c_int`
68
69error[E0617]: can't pass `u8` to variadic function
70  --> $DIR/variadic-ffi-1.rs:25:19
71   |
72LL |         foo(1, 2, 1u8);
73   |                   ^^^ help: cast the value to `c_uint`: `1u8 as c_uint`
74
75error[E0617]: can't pass `i16` to variadic function
76  --> $DIR/variadic-ffi-1.rs:26:19
77   |
78LL |         foo(1, 2, 1i16);
79   |                   ^^^^ help: cast the value to `c_int`: `1i16 as c_int`
80
81error[E0617]: can't pass `u16` to variadic function
82  --> $DIR/variadic-ffi-1.rs:27:19
83   |
84LL |         foo(1, 2, 1u16);
85   |                   ^^^^ help: cast the value to `c_uint`: `1u16 as c_uint`
86
87error: aborting due to 11 previous errors
88
89Some errors have detailed explanations: E0045, E0060, E0308, E0617.
90For more information about an error, try `rustc --explain E0045`.