Skip to content

Commit 837992d

Browse files
tests: Enhance unsupported ABI tests
We have fairly different error messages now and handle more cases, so we augment the test in tests/ui/abi/unsupported.rs with more examples to handle structs, traits, and impls on same when those feature the unsupported ABIs of interest.
1 parent dc5b931 commit 837992d

9 files changed

+1096
-1856
lines changed

tests/crashes/132430.rs

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

tests/ui/abi/unsupported.aarch64.stderr

Lines changed: 173 additions & 302 deletions
Large diffs are not rendered by default.

tests/ui/abi/unsupported.arm.stderr

Lines changed: 161 additions & 276 deletions
Large diffs are not rendered by default.

tests/ui/abi/unsupported.i686.stderr

Lines changed: 83 additions & 182 deletions
Original file line numberDiff line numberDiff line change
@@ -1,234 +1,135 @@
1-
warning: the calling convention "ptx-kernel" is not supported on this target
2-
--> $DIR/unsupported.rs:38:15
1+
error[E0570]: "ptx-kernel" is not a supported ABI for the current target
2+
--> $DIR/unsupported.rs:36:8
33
|
4-
LL | fn ptx_ptr(f: extern "ptx-kernel" fn()) {
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^
4+
LL | extern "ptx-kernel" fn ptx() {}
5+
| ^^^^^^^^^^^^
6+
7+
error[E0570]: "ptx-kernel" is not a supported ABI for the current target
8+
--> $DIR/unsupported.rs:38:22
69
|
7-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
8-
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
9-
= note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default
10+
LL | fn ptx_ptr(f: extern "ptx-kernel" fn()) {
11+
| ^^^^^^^^^^^^
1012

11-
error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target
12-
--> $DIR/unsupported.rs:43:1
13+
error[E0570]: "ptx-kernel" is not a supported ABI for the current target
14+
--> $DIR/unsupported.rs:42:8
1315
|
1416
LL | extern "ptx-kernel" {}
15-
| ^^^^^^^^^^^^^^^^^^^^^^
17+
| ^^^^^^^^^^^^
1618

17-
warning: the calling convention "aapcs" is not supported on this target
18-
--> $DIR/unsupported.rs:50:17
19-
|
20-
LL | fn aapcs_ptr(f: extern "aapcs" fn()) {
21-
| ^^^^^^^^^^^^^^^^^^^
19+
error[E0570]: "gpu-kernel" is not a supported ABI for the current target
20+
--> $DIR/unsupported.rs:44:8
2221
|
23-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
24-
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
22+
LL | extern "gpu-kernel" fn gpu() {}
23+
| ^^^^^^^^^^^^
2524

26-
error[E0570]: `"aapcs"` is not a supported ABI for the current target
27-
--> $DIR/unsupported.rs:55:1
25+
error[E0570]: "aapcs" is not a supported ABI for the current target
26+
--> $DIR/unsupported.rs:47:8
2827
|
29-
LL | extern "aapcs" {}
30-
| ^^^^^^^^^^^^^^^^^
28+
LL | extern "aapcs" fn aapcs() {}
29+
| ^^^^^^^
3130

32-
warning: the calling convention "msp430-interrupt" is not supported on this target
33-
--> $DIR/unsupported.rs:60:18
31+
error[E0570]: "aapcs" is not a supported ABI for the current target
32+
--> $DIR/unsupported.rs:49:24
3433
|
35-
LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) {
36-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
37-
|
38-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
39-
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
34+
LL | fn aapcs_ptr(f: extern "aapcs" fn()) {
35+
| ^^^^^^^
4036

41-
error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target
42-
--> $DIR/unsupported.rs:65:1
37+
error[E0570]: "aapcs" is not a supported ABI for the current target
38+
--> $DIR/unsupported.rs:53:8
4339
|
44-
LL | extern "msp430-interrupt" {}
45-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
40+
LL | extern "aapcs" {}
41+
| ^^^^^^^
4642

47-
warning: the calling convention "avr-interrupt" is not supported on this target
48-
--> $DIR/unsupported.rs:70:15
43+
error[E0570]: "msp430-interrupt" is not a supported ABI for the current target
44+
--> $DIR/unsupported.rs:56:8
4945
|
50-
LL | fn avr_ptr(f: extern "avr-interrupt" fn()) {
51-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
52-
|
53-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
54-
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
46+
LL | extern "msp430-interrupt" fn msp430() {}
47+
| ^^^^^^^^^^^^^^^^^^
5548

56-
error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target
57-
--> $DIR/unsupported.rs:75:1
49+
error[E0570]: "msp430-interrupt" is not a supported ABI for the current target
50+
--> $DIR/unsupported.rs:58:25
5851
|
59-
LL | extern "avr-interrupt" {}
60-
| ^^^^^^^^^^^^^^^^^^^^^^^^^
52+
LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) {
53+
| ^^^^^^^^^^^^^^^^^^
6154

62-
warning: the calling convention "riscv-interrupt-m" is not supported on this target
63-
--> $DIR/unsupported.rs:80:17
55+
error[E0570]: "msp430-interrupt" is not a supported ABI for the current target
56+
--> $DIR/unsupported.rs:62:8
6457
|
65-
LL | fn riscv_ptr(f: extern "riscv-interrupt-m" fn()) {
66-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
67-
|
68-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
69-
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
58+
LL | extern "msp430-interrupt" {}
59+
| ^^^^^^^^^^^^^^^^^^
7060

71-
error[E0570]: `"riscv-interrupt-m"` is not a supported ABI for the current target
72-
--> $DIR/unsupported.rs:86:1
61+
error[E0570]: "avr-interrupt" is not a supported ABI for the current target
62+
--> $DIR/unsupported.rs:65:8
7363
|
74-
LL | extern "riscv-interrupt-m" {}
75-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
64+
LL | extern "avr-interrupt" fn avr() {}
65+
| ^^^^^^^^^^^^^^^
7666

77-
warning: the calling convention "C-cmse-nonsecure-call" is not supported on this target
78-
--> $DIR/unsupported.rs:155:21
67+
error[E0570]: "avr-interrupt" is not a supported ABI for the current target
68+
--> $DIR/unsupported.rs:67:22
7969
|
80-
LL | fn cmse_call_ptr(f: extern "C-cmse-nonsecure-call" fn()) {
81-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
82-
|
83-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
84-
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
70+
LL | fn avr_ptr(f: extern "avr-interrupt" fn()) {
71+
| ^^^^^^^^^^^^^^^
8572

86-
warning: the calling convention "C-cmse-nonsecure-entry" is not supported on this target
87-
--> $DIR/unsupported.rs:163:22
88-
|
89-
LL | fn cmse_entry_ptr(f: extern "C-cmse-nonsecure-entry" fn()) {
90-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
73+
error[E0570]: "avr-interrupt" is not a supported ABI for the current target
74+
--> $DIR/unsupported.rs:71:8
9175
|
92-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
93-
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
76+
LL | extern "avr-interrupt" {}
77+
| ^^^^^^^^^^^^^^^
9478

95-
error[E0570]: `"C-cmse-nonsecure-entry"` is not a supported ABI for the current target
96-
--> $DIR/unsupported.rs:168:1
79+
error[E0570]: "riscv-interrupt-m" is not a supported ABI for the current target
80+
--> $DIR/unsupported.rs:74:8
9781
|
98-
LL | extern "C-cmse-nonsecure-entry" {}
99-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
82+
LL | extern "riscv-interrupt-m" fn riscv() {}
83+
| ^^^^^^^^^^^^^^^^^^^
10084

101-
error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target
102-
--> $DIR/unsupported.rs:36:1
85+
error[E0570]: "riscv-interrupt-m" is not a supported ABI for the current target
86+
--> $DIR/unsupported.rs:76:24
10387
|
104-
LL | extern "ptx-kernel" fn ptx() {}
105-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
88+
LL | fn riscv_ptr(f: extern "riscv-interrupt-m" fn()) {
89+
| ^^^^^^^^^^^^^^^^^^^
10690

107-
error[E0570]: `"gpu-kernel"` is not a supported ABI for the current target
108-
--> $DIR/unsupported.rs:45:1
91+
error[E0570]: "riscv-interrupt-m" is not a supported ABI for the current target
92+
--> $DIR/unsupported.rs:81:8
10993
|
110-
LL | extern "gpu-kernel" fn gpu() {}
111-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
94+
LL | extern "riscv-interrupt-m" {}
95+
| ^^^^^^^^^^^^^^^^^^^
11296

113-
error[E0570]: `"aapcs"` is not a supported ABI for the current target
114-
--> $DIR/unsupported.rs:48:1
97+
error[E0570]: "C-cmse-nonsecure-call" is not a supported ABI for the current target
98+
--> $DIR/unsupported.rs:146:28
11599
|
116-
LL | extern "aapcs" fn aapcs() {}
117-
| ^^^^^^^^^^^^^^^^^^^^^^^^^
100+
LL | fn cmse_call_ptr(f: extern "C-cmse-nonsecure-call" fn()) {
101+
| ^^^^^^^^^^^^^^^^^^^^^^^
118102

119-
error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target
120-
--> $DIR/unsupported.rs:58:1
103+
error[E0570]: "C-cmse-nonsecure-entry" is not a supported ABI for the current target
104+
--> $DIR/unsupported.rs:151:8
121105
|
122-
LL | extern "msp430-interrupt" fn msp430() {}
123-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
106+
LL | extern "C-cmse-nonsecure-entry" fn cmse_entry() {}
107+
| ^^^^^^^^^^^^^^^^^^^^^^^^
124108

125-
error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target
126-
--> $DIR/unsupported.rs:68:1
109+
error[E0570]: "C-cmse-nonsecure-entry" is not a supported ABI for the current target
110+
--> $DIR/unsupported.rs:153:29
127111
|
128-
LL | extern "avr-interrupt" fn avr() {}
129-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
112+
LL | fn cmse_entry_ptr(f: extern "C-cmse-nonsecure-entry" fn()) {
113+
| ^^^^^^^^^^^^^^^^^^^^^^^^
130114

131-
error[E0570]: `"riscv-interrupt-m"` is not a supported ABI for the current target
132-
--> $DIR/unsupported.rs:78:1
115+
error[E0570]: "C-cmse-nonsecure-entry" is not a supported ABI for the current target
116+
--> $DIR/unsupported.rs:157:8
133117
|
134-
LL | extern "riscv-interrupt-m" fn riscv() {}
135-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
118+
LL | extern "C-cmse-nonsecure-entry" {}
119+
| ^^^^^^^^^^^^^^^^^^^^^^^^
136120

137121
error: functions with the "x86-interrupt" ABI cannot be called
138-
--> $DIR/unsupported.rs:94:5
122+
--> $DIR/unsupported.rs:88:5
139123
|
140124
LL | f()
141125
| ^^^
142126
|
143127
note: an `extern "x86-interrupt"` function can only be called using inline assembly
144-
--> $DIR/unsupported.rs:94:5
128+
--> $DIR/unsupported.rs:88:5
145129
|
146130
LL | f()
147131
| ^^^
148132

149-
error[E0570]: `"C-cmse-nonsecure-entry"` is not a supported ABI for the current target
150-
--> $DIR/unsupported.rs:161:1
151-
|
152-
LL | extern "C-cmse-nonsecure-entry" fn cmse_entry() {}
153-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
154-
155-
error: aborting due to 14 previous errors; 7 warnings emitted
133+
error: aborting due to 21 previous errors
156134

157135
For more information about this error, try `rustc --explain E0570`.
158-
Future incompatibility report: Future breakage diagnostic:
159-
warning: the calling convention "ptx-kernel" is not supported on this target
160-
--> $DIR/unsupported.rs:38:15
161-
|
162-
LL | fn ptx_ptr(f: extern "ptx-kernel" fn()) {
163-
| ^^^^^^^^^^^^^^^^^^^^^^^^
164-
|
165-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
166-
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
167-
= note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default
168-
169-
Future breakage diagnostic:
170-
warning: the calling convention "aapcs" is not supported on this target
171-
--> $DIR/unsupported.rs:50:17
172-
|
173-
LL | fn aapcs_ptr(f: extern "aapcs" fn()) {
174-
| ^^^^^^^^^^^^^^^^^^^
175-
|
176-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
177-
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
178-
= note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default
179-
180-
Future breakage diagnostic:
181-
warning: the calling convention "msp430-interrupt" is not supported on this target
182-
--> $DIR/unsupported.rs:60:18
183-
|
184-
LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) {
185-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
186-
|
187-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
188-
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
189-
= note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default
190-
191-
Future breakage diagnostic:
192-
warning: the calling convention "avr-interrupt" is not supported on this target
193-
--> $DIR/unsupported.rs:70:15
194-
|
195-
LL | fn avr_ptr(f: extern "avr-interrupt" fn()) {
196-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
197-
|
198-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
199-
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
200-
= note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default
201-
202-
Future breakage diagnostic:
203-
warning: the calling convention "riscv-interrupt-m" is not supported on this target
204-
--> $DIR/unsupported.rs:80:17
205-
|
206-
LL | fn riscv_ptr(f: extern "riscv-interrupt-m" fn()) {
207-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
208-
|
209-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
210-
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
211-
= note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default
212-
213-
Future breakage diagnostic:
214-
warning: the calling convention "C-cmse-nonsecure-call" is not supported on this target
215-
--> $DIR/unsupported.rs:155:21
216-
|
217-
LL | fn cmse_call_ptr(f: extern "C-cmse-nonsecure-call" fn()) {
218-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
219-
|
220-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
221-
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
222-
= note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default
223-
224-
Future breakage diagnostic:
225-
warning: the calling convention "C-cmse-nonsecure-entry" is not supported on this target
226-
--> $DIR/unsupported.rs:163:22
227-
|
228-
LL | fn cmse_entry_ptr(f: extern "C-cmse-nonsecure-entry" fn()) {
229-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
230-
|
231-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
232-
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>
233-
= note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default
234-

0 commit comments

Comments
 (0)