Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit62a104d

Browse files
Update Tests
1 parent468f115 commit62a104d

File tree

4 files changed

+39
-94
lines changed

4 files changed

+39
-94
lines changed
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
//@ build-pass
2+
3+
// Supported since C23
4+
// https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2975.pdf
15
extern"C"{
26
fnfoo(...);
3-
//~^ ERROR C-variadic function must be declared with at least one named argument
47
}
58

69
fnmain(){}

‎tests/ui/c-variadic/variadic-ffi-no-fixed-args.stderr‎

Lines changed: 0 additions & 8 deletions
This file was deleted.

‎tests/ui/parser/variadic-ffi-semantic-restrictions.rs‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,12 @@ fn f1_1(x: isize, ...) {}
88

99
fnf1_2(...){}
1010
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
11-
//~| ERROR C-variadic function must be declared with at least one named argument
1211

1312
extern"C"fnf2_1(x:isize, ...){}
1413
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
1514

1615
extern"C"fnf2_2(...){}
1716
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
18-
//~| ERROR C-variadic function must be declared with at least one named argument
1917

2018
extern"C"fnf2_3(...,x:isize){}
2119
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
@@ -26,7 +24,6 @@ extern "C" fn f3_1(x: isize, ...) {}
2624

2725
extern"C"fnf3_2(...){}
2826
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
29-
//~| ERROR C-variadic function must be declared with at least one named argument
3027

3128
extern"C"fnf3_3(...,x:isize){}
3229
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
@@ -47,8 +44,6 @@ const extern "C" fn f4_3(..., x: isize, ...) {}
4744
//~| ERROR `...` must be the last argument of a C-variadic function
4845

4946
extern"C"{
50-
fne_f1(...);
51-
//~^ ERROR C-variadic function must be declared with at least one named argument
5247
fne_f2(...,x:isize);
5348
//~^ ERROR `...` must be the last argument of a C-variadic function
5449
}
@@ -60,7 +55,6 @@ impl X {
6055
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
6156
fni_f2(...){}
6257
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
63-
//~| ERROR C-variadic function must be declared with at least one named argument
6458
fni_f3(...,x:isize, ...){}
6559
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
6660
//~| ERROR `...` must be the last argument of a C-variadic function
@@ -80,10 +74,8 @@ trait T {
8074
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
8175
fnt_f3(...){}
8276
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
83-
//~| ERROR C-variadic function must be declared with at least one named argument
8477
fnt_f4(...);
8578
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
86-
//~| ERROR C-variadic function must be declared with at least one named argument
8779
fnt_f5(...,x:isize){}
8880
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic
8981
//~| ERROR `...` must be the last argument of a C-variadic function

‎tests/ui/parser/variadic-ffi-semantic-restrictions.stderr‎

Lines changed: 35 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -4,104 +4,86 @@ error: only foreign or `unsafe extern "C"` functions may be C-variadic
44
LL | fn f1_1(x: isize, ...) {}
55
| ^^^
66

7-
error: C-variadic function must be declared with at least one named argument
8-
--> $DIR/variadic-ffi-semantic-restrictions.rs:9:9
9-
|
10-
LL | fn f1_2(...) {}
11-
| ^^^
12-
137
error: only foreign or `unsafe extern "C"` functions may be C-variadic
148
--> $DIR/variadic-ffi-semantic-restrictions.rs:9:9
159
|
1610
LL | fn f1_2(...) {}
1711
| ^^^
1812

1913
error: only foreign or `unsafe extern "C"` functions may be C-variadic
20-
--> $DIR/variadic-ffi-semantic-restrictions.rs:13:30
14+
--> $DIR/variadic-ffi-semantic-restrictions.rs:12:30
2115
|
2216
LL | extern "C" fn f2_1(x: isize, ...) {}
2317
| ^^^
2418

25-
error: C-variadic function must be declared with at least one named argument
26-
--> $DIR/variadic-ffi-semantic-restrictions.rs:16:20
27-
|
28-
LL | extern "C" fn f2_2(...) {}
29-
| ^^^
30-
3119
error: only foreign or `unsafe extern "C"` functions may be C-variadic
32-
--> $DIR/variadic-ffi-semantic-restrictions.rs:16:20
20+
--> $DIR/variadic-ffi-semantic-restrictions.rs:15:20
3321
|
3422
LL | extern "C" fn f2_2(...) {}
3523
| ^^^
3624

3725
error: `...` must be the last argument of a C-variadic function
38-
--> $DIR/variadic-ffi-semantic-restrictions.rs:20:20
26+
--> $DIR/variadic-ffi-semantic-restrictions.rs:18:20
3927
|
4028
LL | extern "C" fn f2_3(..., x: isize) {}
4129
| ^^^
4230

4331
error: only foreign or `unsafe extern "C"` functions may be C-variadic
44-
--> $DIR/variadic-ffi-semantic-restrictions.rs:20:20
32+
--> $DIR/variadic-ffi-semantic-restrictions.rs:18:20
4533
|
4634
LL | extern "C" fn f2_3(..., x: isize) {}
4735
| ^^^
4836

4937
error: only foreign or `unsafe extern "C"` functions may be C-variadic
50-
--> $DIR/variadic-ffi-semantic-restrictions.rs:24:30
38+
--> $DIR/variadic-ffi-semantic-restrictions.rs:22:30
5139
|
5240
LL | extern "C" fn f3_1(x: isize, ...) {}
5341
| ^^^
5442

55-
error: C-variadic function must be declared with at least one named argument
56-
--> $DIR/variadic-ffi-semantic-restrictions.rs:27:20
57-
|
58-
LL | extern "C" fn f3_2(...) {}
59-
| ^^^
60-
6143
error: only foreign or `unsafe extern "C"` functions may be C-variadic
62-
--> $DIR/variadic-ffi-semantic-restrictions.rs:27:20
44+
--> $DIR/variadic-ffi-semantic-restrictions.rs:25:20
6345
|
6446
LL | extern "C" fn f3_2(...) {}
6547
| ^^^
6648

6749
error: `...` must be the last argument of a C-variadic function
68-
--> $DIR/variadic-ffi-semantic-restrictions.rs:31:20
50+
--> $DIR/variadic-ffi-semantic-restrictions.rs:28:20
6951
|
7052
LL | extern "C" fn f3_3(..., x: isize) {}
7153
| ^^^
7254

7355
error: only foreign or `unsafe extern "C"` functions may be C-variadic
74-
--> $DIR/variadic-ffi-semantic-restrictions.rs:31:20
56+
--> $DIR/variadic-ffi-semantic-restrictions.rs:28:20
7557
|
7658
LL | extern "C" fn f3_3(..., x: isize) {}
7759
| ^^^
7860

7961
error: functions cannot be both `const` and C-variadic
80-
--> $DIR/variadic-ffi-semantic-restrictions.rs:35:1
62+
--> $DIR/variadic-ffi-semantic-restrictions.rs:32:1
8163
|
8264
LL | const unsafe extern "C" fn f4_1(x: isize, ...) {}
8365
| ^^^^^ `const` because of this ^^^ C-variadic because of this
8466

8567
error: functions cannot be both `const` and C-variadic
86-
--> $DIR/variadic-ffi-semantic-restrictions.rs:39:1
68+
--> $DIR/variadic-ffi-semantic-restrictions.rs:36:1
8769
|
8870
LL | const extern "C" fn f4_2(x: isize, ...) {}
8971
| ^^^^^ `const` because of this ^^^ C-variadic because of this
9072

9173
error: only foreign or `unsafe extern "C"` functions may be C-variadic
92-
--> $DIR/variadic-ffi-semantic-restrictions.rs:39:36
74+
--> $DIR/variadic-ffi-semantic-restrictions.rs:36:36
9375
|
9476
LL | const extern "C" fn f4_2(x: isize, ...) {}
9577
| ^^^
9678

9779
error: `...` must be the last argument of a C-variadic function
98-
--> $DIR/variadic-ffi-semantic-restrictions.rs:44:26
80+
--> $DIR/variadic-ffi-semantic-restrictions.rs:41:26
9981
|
10082
LL | const extern "C" fn f4_3(..., x: isize, ...) {}
10183
| ^^^
10284

10385
error: functions cannot be both `const` and C-variadic
104-
--> $DIR/variadic-ffi-semantic-restrictions.rs:44:1
86+
--> $DIR/variadic-ffi-semantic-restrictions.rs:41:1
10587
|
10688
LL | const extern "C" fn f4_3(..., x: isize, ...) {}
10789
| ^^^^^ ^^^ ^^^ C-variadic because of this
@@ -110,163 +92,139 @@ LL | const extern "C" fn f4_3(..., x: isize, ...) {}
11092
| `const` because of this
11193

11294
error: only foreign or `unsafe extern "C"` functions may be C-variadic
113-
--> $DIR/variadic-ffi-semantic-restrictions.rs:44:26
95+
--> $DIR/variadic-ffi-semantic-restrictions.rs:41:26
11496
|
11597
LL | const extern "C" fn f4_3(..., x: isize, ...) {}
11698
| ^^^ ^^^
11799

118-
error: C-variadic function must be declared with at least one named argument
119-
--> $DIR/variadic-ffi-semantic-restrictions.rs:50:13
120-
|
121-
LL | fn e_f1(...);
122-
| ^^^
123-
124100
error: `...` must be the last argument of a C-variadic function
125-
--> $DIR/variadic-ffi-semantic-restrictions.rs:52:13
101+
--> $DIR/variadic-ffi-semantic-restrictions.rs:47:13
126102
|
127103
LL | fn e_f2(..., x: isize);
128104
| ^^^
129105

130106
error: only foreign or `unsafe extern "C"` functions may be C-variadic
131-
--> $DIR/variadic-ffi-semantic-restrictions.rs:59:23
107+
--> $DIR/variadic-ffi-semantic-restrictions.rs:54:23
132108
|
133109
LL | fn i_f1(x: isize, ...) {}
134110
| ^^^
135111

136-
error: C-variadic function must be declared with at least one named argument
137-
--> $DIR/variadic-ffi-semantic-restrictions.rs:61:13
138-
|
139-
LL | fn i_f2(...) {}
140-
| ^^^
141-
142112
error: only foreign or `unsafe extern "C"` functions may be C-variadic
143-
--> $DIR/variadic-ffi-semantic-restrictions.rs:61:13
113+
--> $DIR/variadic-ffi-semantic-restrictions.rs:56:13
144114
|
145115
LL | fn i_f2(...) {}
146116
| ^^^
147117

148118
error: `...` must be the last argument of a C-variadic function
149-
--> $DIR/variadic-ffi-semantic-restrictions.rs:64:13
119+
--> $DIR/variadic-ffi-semantic-restrictions.rs:58:13
150120
|
151121
LL | fn i_f3(..., x: isize, ...) {}
152122
| ^^^
153123

154124
error: only foreign or `unsafe extern "C"` functions may be C-variadic
155-
--> $DIR/variadic-ffi-semantic-restrictions.rs:64:13
125+
--> $DIR/variadic-ffi-semantic-restrictions.rs:58:13
156126
|
157127
LL | fn i_f3(..., x: isize, ...) {}
158128
| ^^^ ^^^
159129

160130
error: `...` must be the last argument of a C-variadic function
161-
--> $DIR/variadic-ffi-semantic-restrictions.rs:67:13
131+
--> $DIR/variadic-ffi-semantic-restrictions.rs:61:13
162132
|
163133
LL | fn i_f4(..., x: isize, ...) {}
164134
| ^^^
165135

166136
error: only foreign or `unsafe extern "C"` functions may be C-variadic
167-
--> $DIR/variadic-ffi-semantic-restrictions.rs:67:13
137+
--> $DIR/variadic-ffi-semantic-restrictions.rs:61:13
168138
|
169139
LL | fn i_f4(..., x: isize, ...) {}
170140
| ^^^ ^^^
171141

172142
error: functions cannot be both `const` and C-variadic
173-
--> $DIR/variadic-ffi-semantic-restrictions.rs:70:5
143+
--> $DIR/variadic-ffi-semantic-restrictions.rs:64:5
174144
|
175145
LL | const fn i_f5(x: isize, ...) {}
176146
| ^^^^^ ^^^ C-variadic because of this
177147
| |
178148
| `const` because of this
179149

180150
error: only foreign or `unsafe extern "C"` functions may be C-variadic
181-
--> $DIR/variadic-ffi-semantic-restrictions.rs:70:29
151+
--> $DIR/variadic-ffi-semantic-restrictions.rs:64:29
182152
|
183153
LL | const fn i_f5(x: isize, ...) {}
184154
| ^^^
185155

186156
error: only foreign or `unsafe extern "C"` functions may be C-variadic
187-
--> $DIR/variadic-ffi-semantic-restrictions.rs:77:23
157+
--> $DIR/variadic-ffi-semantic-restrictions.rs:71:23
188158
|
189159
LL | fn t_f1(x: isize, ...) {}
190160
| ^^^
191161

192162
error: only foreign or `unsafe extern "C"` functions may be C-variadic
193-
--> $DIR/variadic-ffi-semantic-restrictions.rs:79:23
163+
--> $DIR/variadic-ffi-semantic-restrictions.rs:73:23
194164
|
195165
LL | fn t_f2(x: isize, ...);
196166
| ^^^
197167

198-
error: C-variadic function must be declared with at least one named argument
199-
--> $DIR/variadic-ffi-semantic-restrictions.rs:81:13
200-
|
201-
LL | fn t_f3(...) {}
202-
| ^^^
203-
204168
error: only foreign or `unsafe extern "C"` functions may be C-variadic
205-
--> $DIR/variadic-ffi-semantic-restrictions.rs:81:13
169+
--> $DIR/variadic-ffi-semantic-restrictions.rs:75:13
206170
|
207171
LL | fn t_f3(...) {}
208172
| ^^^
209173

210-
error: C-variadic function must be declared with at least one named argument
211-
--> $DIR/variadic-ffi-semantic-restrictions.rs:84:13
212-
|
213-
LL | fn t_f4(...);
214-
| ^^^
215-
216174
error: only foreign or `unsafe extern "C"` functions may be C-variadic
217-
--> $DIR/variadic-ffi-semantic-restrictions.rs:84:13
175+
--> $DIR/variadic-ffi-semantic-restrictions.rs:77:13
218176
|
219177
LL | fn t_f4(...);
220178
| ^^^
221179

222180
error: `...` must be the last argument of a C-variadic function
223-
--> $DIR/variadic-ffi-semantic-restrictions.rs:87:13
181+
--> $DIR/variadic-ffi-semantic-restrictions.rs:79:13
224182
|
225183
LL | fn t_f5(..., x: isize) {}
226184
| ^^^
227185

228186
error: only foreign or `unsafe extern "C"` functions may be C-variadic
229-
--> $DIR/variadic-ffi-semantic-restrictions.rs:87:13
187+
--> $DIR/variadic-ffi-semantic-restrictions.rs:79:13
230188
|
231189
LL | fn t_f5(..., x: isize) {}
232190
| ^^^
233191

234192
error: `...` must be the last argument of a C-variadic function
235-
--> $DIR/variadic-ffi-semantic-restrictions.rs:90:13
193+
--> $DIR/variadic-ffi-semantic-restrictions.rs:82:13
236194
|
237195
LL | fn t_f6(..., x: isize);
238196
| ^^^
239197

240198
error: only foreign or `unsafe extern "C"` functions may be C-variadic
241-
--> $DIR/variadic-ffi-semantic-restrictions.rs:90:13
199+
--> $DIR/variadic-ffi-semantic-restrictions.rs:82:13
242200
|
243201
LL | fn t_f6(..., x: isize);
244202
| ^^^
245203

246204
error[E0493]: destructor of `VaListImpl<'_>` cannot be evaluated at compile-time
247-
--> $DIR/variadic-ffi-semantic-restrictions.rs:35:43
205+
--> $DIR/variadic-ffi-semantic-restrictions.rs:32:43
248206
|
249207
LL | const unsafe extern "C" fn f4_1(x: isize, ...) {}
250208
| ^^^ - value is dropped here
251209
| |
252210
| the destructor for this type cannot be evaluated in constant functions
253211

254212
error[E0493]: destructor of `VaListImpl<'_>` cannot be evaluated at compile-time
255-
--> $DIR/variadic-ffi-semantic-restrictions.rs:39:36
213+
--> $DIR/variadic-ffi-semantic-restrictions.rs:36:36
256214
|
257215
LL | const extern "C" fn f4_2(x: isize, ...) {}
258216
| ^^^ - value is dropped here
259217
| |
260218
| the destructor for this type cannot be evaluated in constant functions
261219

262220
error[E0493]: destructor of `VaListImpl<'_>` cannot be evaluated at compile-time
263-
--> $DIR/variadic-ffi-semantic-restrictions.rs:70:29
221+
--> $DIR/variadic-ffi-semantic-restrictions.rs:64:29
264222
|
265223
LL | const fn i_f5(x: isize, ...) {}
266224
| ^^^ - value is dropped here
267225
| |
268226
| the destructor for this type cannot be evaluated in constant functions
269227

270-
error: aborting due to43 previous errors
228+
error: aborting due to36 previous errors
271229

272230
For more information about this error, try `rustc --explain E0493`.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp