@@ -10,35 +10,55 @@ error: `...` is not supported for non-extern functions
10
10
LL | fn f1_2(...) {}
11
11
| ^^^
12
12
13
- error: defining functions with C-variadic arguments is only allowed for free functions with the "C" or "C-unwind" calling convention
13
+ error: functions with a C variable argument list must be unsafe
14
14
--> $DIR/variadic-ffi-semantic-restrictions.rs:12:30
15
15
|
16
16
LL | extern "C" fn f2_1(x: isize, ...) {}
17
17
| ^^^
18
+ |
19
+ help: add the `unsafe` keyword to this definition
20
+ |
21
+ LL | unsafe extern "C" fn f2_1(x: isize, ...) {}
22
+ | ++++++
18
23
19
- error: defining functions with C-variadic arguments is only allowed for free functions with the "C" or "C-unwind" calling convention
24
+ error: functions with a C variable argument list must be unsafe
20
25
--> $DIR/variadic-ffi-semantic-restrictions.rs:15:20
21
26
|
22
27
LL | extern "C" fn f2_2(...) {}
23
28
| ^^^
29
+ |
30
+ help: add the `unsafe` keyword to this definition
31
+ |
32
+ LL | unsafe extern "C" fn f2_2(...) {}
33
+ | ++++++
24
34
25
35
error: `...` must be the last argument of a C-variadic function
26
36
--> $DIR/variadic-ffi-semantic-restrictions.rs:18:20
27
37
|
28
38
LL | extern "C" fn f2_3(..., x: isize) {}
29
39
| ^^^
30
40
31
- error: defining functions with C-variadic arguments is only allowed for free functions with the "C" or "C-unwind" calling convention
41
+ error: functions with a C variable argument list must be unsafe
32
42
--> $DIR/variadic-ffi-semantic-restrictions.rs:21:30
33
43
|
34
44
LL | extern "C" fn f3_1(x: isize, ...) {}
35
45
| ^^^
46
+ |
47
+ help: add the `unsafe` keyword to this definition
48
+ |
49
+ LL | unsafe extern "C" fn f3_1(x: isize, ...) {}
50
+ | ++++++
36
51
37
- error: defining functions with C-variadic arguments is only allowed for free functions with the "C" or "C-unwind" calling convention
52
+ error: functions with a C variable argument list must be unsafe
38
53
--> $DIR/variadic-ffi-semantic-restrictions.rs:24:20
39
54
|
40
55
LL | extern "C" fn f3_2(...) {}
41
56
| ^^^
57
+ |
58
+ help: add the `unsafe` keyword to this definition
59
+ |
60
+ LL | unsafe extern "C" fn f3_2(...) {}
61
+ | ++++++
42
62
43
63
error: `...` must be the last argument of a C-variadic function
44
64
--> $DIR/variadic-ffi-semantic-restrictions.rs:27:20
@@ -58,11 +78,16 @@ error: functions cannot be both `const` and C-variadic
58
78
LL | const extern "C" fn f4_2(x: isize, ...) {}
59
79
| ^^^^^ `const` because of this ^^^ C-variadic because of this
60
80
61
- error: defining functions with C-variadic arguments is only allowed for free functions with the "C" or "C-unwind" calling convention
81
+ error: functions with a C variable argument list must be unsafe
62
82
--> $DIR/variadic-ffi-semantic-restrictions.rs:34:36
63
83
|
64
84
LL | const extern "C" fn f4_2(x: isize, ...) {}
65
85
| ^^^
86
+ |
87
+ help: add the `unsafe` keyword to this definition
88
+ |
89
+ LL | constunsafe extern "C" fn f4_2(x: isize, ...) {}
90
+ | ++++++
66
91
67
92
error: `...` must be the last argument of a C-variadic function
68
93
--> $DIR/variadic-ffi-semantic-restrictions.rs:39:26
@@ -76,11 +101,16 @@ error: functions cannot be both `const` and C-variadic
76
101
LL | const extern "C" fn f4_3(..., x: isize, ...) {}
77
102
| ^^^^^ `const` because of this ^^^ C-variadic because of this
78
103
79
- error: defining functions with C-variadic arguments is only allowed for free functions with the "C" or "C-unwind" calling convention
104
+ error: functions with a C variable argument list must be unsafe
80
105
--> $DIR/variadic-ffi-semantic-restrictions.rs:39:41
81
106
|
82
107
LL | const extern "C" fn f4_3(..., x: isize, ...) {}
83
108
| ^^^
109
+ |
110
+ help: add the `unsafe` keyword to this definition
111
+ |
112
+ LL | constunsafe extern "C" fn f4_3(..., x: isize, ...) {}
113
+ | ++++++
84
114
85
115
error: `...` must be the last argument of a C-variadic function
86
116
--> $DIR/variadic-ffi-semantic-restrictions.rs:45:13
0 commit comments