@@ -10,35 +10,55 @@ error: `...` is not supported for non-extern functions
1010LL | fn f1_2(...) {}
1111 | ^^^
1212
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
1414 --> $DIR/variadic-ffi-semantic-restrictions.rs:12:30
1515 |
1616LL | extern "C" fn f2_1(x: isize, ...) {}
1717 | ^^^
18+ |
19+ help: add the `unsafe` keyword to this definition
20+ |
21+ LL | unsafe extern "C" fn f2_1(x: isize, ...) {}
22+ | ++++++
1823
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
2025 --> $DIR/variadic-ffi-semantic-restrictions.rs:15:20
2126 |
2227LL | extern "C" fn f2_2(...) {}
2328 | ^^^
29+ |
30+ help: add the `unsafe` keyword to this definition
31+ |
32+ LL | unsafe extern "C" fn f2_2(...) {}
33+ | ++++++
2434
2535error: `...` must be the last argument of a C-variadic function
2636 --> $DIR/variadic-ffi-semantic-restrictions.rs:18:20
2737 |
2838LL | extern "C" fn f2_3(..., x: isize) {}
2939 | ^^^
3040
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
3242 --> $DIR/variadic-ffi-semantic-restrictions.rs:21:30
3343 |
3444LL | extern "C" fn f3_1(x: isize, ...) {}
3545 | ^^^
46+ |
47+ help: add the `unsafe` keyword to this definition
48+ |
49+ LL | unsafe extern "C" fn f3_1(x: isize, ...) {}
50+ | ++++++
3651
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
3853 --> $DIR/variadic-ffi-semantic-restrictions.rs:24:20
3954 |
4055LL | extern "C" fn f3_2(...) {}
4156 | ^^^
57+ |
58+ help: add the `unsafe` keyword to this definition
59+ |
60+ LL | unsafe extern "C" fn f3_2(...) {}
61+ | ++++++
4262
4363error: `...` must be the last argument of a C-variadic function
4464 --> $DIR/variadic-ffi-semantic-restrictions.rs:27:20
@@ -58,11 +78,16 @@ error: functions cannot be both `const` and C-variadic
5878LL | const extern "C" fn f4_2(x: isize, ...) {}
5979 | ^^^^^ `const` because of this ^^^ C-variadic because of this
6080
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
6282 --> $DIR/variadic-ffi-semantic-restrictions.rs:34:36
6383 |
6484LL | const extern "C" fn f4_2(x: isize, ...) {}
6585 | ^^^
86+ |
87+ help: add the `unsafe` keyword to this definition
88+ |
89+ LL | const unsafe extern "C" fn f4_2(x: isize, ...) {}
90+ | ++++++
6691
6792error: `...` must be the last argument of a C-variadic function
6893 --> $DIR/variadic-ffi-semantic-restrictions.rs:39:26
@@ -76,11 +101,16 @@ error: functions cannot be both `const` and C-variadic
76101LL | const extern "C" fn f4_3(..., x: isize, ...) {}
77102 | ^^^^^ `const` because of this ^^^ C-variadic because of this
78103
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
80105 --> $DIR/variadic-ffi-semantic-restrictions.rs:39:41
81106 |
82107LL | const extern "C" fn f4_3(..., x: isize, ...) {}
83108 | ^^^
109+ |
110+ help: add the `unsafe` keyword to this definition
111+ |
112+ LL | const unsafe extern "C" fn f4_3(..., x: isize, ...) {}
113+ | ++++++
84114
85115error: `...` must be the last argument of a C-variadic function
86116 --> $DIR/variadic-ffi-semantic-restrictions.rs:45:13
0 commit comments