Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit adb3631

Browse files
committedAug 15, 2024
Auto merge of #128784 - tdittr:check-abi-on-fn-ptr, r=<try>
Check ABI target compatibility for function pointers Related tracking issue: #87678 Compatibility of an ABI for a target was previously only performed on function definitions and `extern` blocks. This PR adds it also to function pointers to be consistent. This might have broken some of the `tests/ui/` depending on the platform, so a try run seems like a good idea. Also this might break existing code, because we now emit extra errors. Does this require a crater run? # Example ```rust // build with: --target=x86_64-unknown-linux-gnu // These raise E0570 extern "thiscall" fn foo() {} extern "thiscall" { fn bar() } // This did not raise any error fn baz(f: extern "thiscall" fn()) { f() } ``` try-job: aarch64-gnu try-job: aarch64-apple try-job: x86_64-msvc try-job: x86_64-mingw try-job: i686-msvc try-job: i686-mingw try-job: test-various try-job: armhf-gnu
2 parents 3139ff0 + 0cef57e commit adb3631

17 files changed

+765
-81
lines changed
 

‎compiler/rustc_hir_analysis/src/check/check.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,6 @@ pub fn check_abi(tcx: TyCtxt<'_>, hir_id: hir::HirId, span: Span, abi: Abi) {
5151
});
5252
}
5353
}
54-
55-
// This ABI is only allowed on function pointers
56-
if abi == Abi::CCmseNonSecureCall {
57-
struct_span_code_err!(
58-
tcx.dcx(),
59-
span,
60-
E0781,
61-
"the `\"C-cmse-nonsecure-call\"` ABI is only allowed on function pointers"
62-
)
63-
.emit();
64-
}
6554
}
6655

6756
fn check_struct(tcx: TyCtxt<'_>, def_id: LocalDefId) {

‎compiler/rustc_hir_analysis/src/hir_ty_lowering/cmse.rs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
use rustc_errors::DiagCtxtHandle;
2-
use rustc_hir as hir;
3-
use rustc_hir::HirId;
1+
use rustc_errors::{struct_span_code_err, DiagCtxtHandle, E0781};
2+
use rustc_hir::{self as hir, HirId};
43
use rustc_middle::ty::layout::LayoutError;
54
use rustc_middle::ty::{self, ParamEnv, TyCtxt};
65
use rustc_span::Span;
@@ -26,7 +25,19 @@ pub fn validate_cmse_abi<'tcx>(
2625
..
2726
}) = hir_node
2827
else {
29-
// might happen when this ABI is used incorrectly. That will be handled elsewhere
28+
let span = match tcx.parent_hir_node(hir_id) {
29+
hir::Node::Item(hir::Item {
30+
kind: hir::ItemKind::ForeignMod { .. }, span, ..
31+
}) => *span,
32+
_ => tcx.hir().span(hir_id),
33+
};
34+
struct_span_code_err!(
35+
tcx.dcx(),
36+
span,
37+
E0781,
38+
"the `\"C-cmse-nonsecure-call\"` ABI is only allowed on function pointers"
39+
)
40+
.emit();
3041
return;
3142
};
3243

‎compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2309,6 +2309,12 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
23092309
let fn_ty = tcx.mk_fn_sig(input_tys, output_ty, decl.c_variadic, safety, abi);
23102310
let bare_fn_ty = ty::Binder::bind_with_vars(fn_ty, bound_vars);
23112311

2312+
if let hir::Node::Ty(hir::Ty { kind: hir::TyKind::BareFn(bare_fn_ty), span, .. }) =
2313+
tcx.hir_node(hir_id)
2314+
{
2315+
crate::check::check_abi(tcx, hir_id, *span, bare_fn_ty.abi);
2316+
}
2317+
23122318
// reject function types that violate cmse ABI requirements
23132319
cmse::validate_cmse_abi(self.tcx(), self.dcx(), hir_id, abi, bare_fn_ty);
23142320

Lines changed: 112 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,157 @@
11
error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target
2-
--> $DIR/unsupported.rs:28:1
2+
--> $DIR/unsupported.rs:34:15
3+
|
4+
LL | fn ptx_ptr(f: extern "ptx-kernel" fn()) {
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^
6+
7+
error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target
8+
--> $DIR/unsupported.rs:38:1
9+
|
10+
LL | extern "ptx-kernel" {}
11+
| ^^^^^^^^^^^^^^^^^^^^^^
12+
13+
error[E0570]: `"aapcs"` is not a supported ABI for the current target
14+
--> $DIR/unsupported.rs:47:17
15+
|
16+
LL | fn aapcs_ptr(f: extern "aapcs" fn()) {
17+
| ^^^^^^^^^^^^^^^^^^^
18+
19+
error[E0570]: `"aapcs"` is not a supported ABI for the current target
20+
--> $DIR/unsupported.rs:55:1
21+
|
22+
LL | extern "aapcs" {}
23+
| ^^^^^^^^^^^^^^^^^
24+
25+
error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target
26+
--> $DIR/unsupported.rs:64:18
27+
|
28+
LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) {
29+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
30+
31+
error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target
32+
--> $DIR/unsupported.rs:68:1
33+
|
34+
LL | extern "msp430-interrupt" {}
35+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
36+
37+
error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target
38+
--> $DIR/unsupported.rs:73:15
39+
|
40+
LL | fn avr_ptr(f: extern "avr-interrupt" fn()) {
41+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
42+
43+
error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target
44+
--> $DIR/unsupported.rs:77:1
45+
|
46+
LL | extern "avr-interrupt" {}
47+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
48+
49+
error[E0570]: `"riscv-interrupt-m"` is not a supported ABI for the current target
50+
--> $DIR/unsupported.rs:85:17
51+
|
52+
LL | fn riscv_ptr(f: extern "riscv-interrupt-m" fn()) {
53+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
54+
55+
error[E0570]: `"riscv-interrupt-m"` is not a supported ABI for the current target
56+
--> $DIR/unsupported.rs:92:1
57+
|
58+
LL | extern "riscv-interrupt-m" {}
59+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
60+
61+
error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target
62+
--> $DIR/unsupported.rs:103:15
63+
|
64+
LL | fn x86_ptr(f: extern "x86-interrupt" fn()) {
65+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
66+
67+
error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target
68+
--> $DIR/unsupported.rs:110:1
69+
|
70+
LL | extern "x86-interrupt" {}
71+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
72+
73+
error[E0570]: `"thiscall"` is not a supported ABI for the current target
74+
--> $DIR/unsupported.rs:122:20
75+
|
76+
LL | fn thiscall_ptr(f: extern "thiscall" fn()) {
77+
| ^^^^^^^^^^^^^^^^^^^^^^
78+
79+
error[E0570]: `"thiscall"` is not a supported ABI for the current target
80+
--> $DIR/unsupported.rs:130:1
81+
|
82+
LL | extern "thiscall" {}
83+
| ^^^^^^^^^^^^^^^^^^^^
84+
85+
warning: use of calling convention not supported on this target
86+
--> $DIR/unsupported.rs:148:19
87+
|
88+
LL | fn stdcall_ptr(f: extern "stdcall" fn()) {
89+
| ^^^^^^^^^^^^^^^^^^^^^
90+
|
91+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
92+
= note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678>
93+
= note: `#[warn(unsupported_calling_conventions)]` on by default
94+
95+
warning: use of calling convention not supported on this target
96+
--> $DIR/unsupported.rs:161:1
97+
|
98+
LL | extern "stdcall" {}
99+
| ^^^^^^^^^^^^^^^^^^^
100+
|
101+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
102+
= note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678>
103+
104+
error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target
105+
--> $DIR/unsupported.rs:32:1
3106
|
4107
LL | extern "ptx-kernel" fn ptx() {}
5108
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6109

7110
error[E0570]: `"aapcs"` is not a supported ABI for the current target
8-
--> $DIR/unsupported.rs:30:1
111+
--> $DIR/unsupported.rs:41:1
9112
|
10113
LL | extern "aapcs" fn aapcs() {}
11114
| ^^^^^^^^^^^^^^^^^^^^^^^^^
12115

13116
error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target
14-
--> $DIR/unsupported.rs:36:1
117+
--> $DIR/unsupported.rs:62:1
15118
|
16119
LL | extern "msp430-interrupt" fn msp430() {}
17120
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
18121

19122
error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target
20-
--> $DIR/unsupported.rs:38:1
123+
--> $DIR/unsupported.rs:71:1
21124
|
22125
LL | extern "avr-interrupt" fn avr() {}
23126
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
24127

25128
error[E0570]: `"riscv-interrupt-m"` is not a supported ABI for the current target
26-
--> $DIR/unsupported.rs:40:1
129+
--> $DIR/unsupported.rs:80:1
27130
|
28131
LL | extern "riscv-interrupt-m" fn riscv() {}
29132
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
30133

31134
error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target
32-
--> $DIR/unsupported.rs:45:1
135+
--> $DIR/unsupported.rs:98:1
33136
|
34137
LL | extern "x86-interrupt" fn x86() {}
35138
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
36139

37140
error[E0570]: `"thiscall"` is not a supported ABI for the current target
38-
--> $DIR/unsupported.rs:50:1
141+
--> $DIR/unsupported.rs:116:1
39142
|
40143
LL | extern "thiscall" fn thiscall() {}
41144
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
42145

43146
warning: use of calling convention not supported on this target
44-
--> $DIR/unsupported.rs:56:1
147+
--> $DIR/unsupported.rs:137:1
45148
|
46149
LL | extern "stdcall" fn stdcall() {}
47150
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
48151
|
49152
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
50153
= note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678>
51-
= note: `#[warn(unsupported_calling_conventions)]` on by default
52154

53-
error: aborting due to 7 previous errors; 1 warning emitted
155+
error: aborting due to 21 previous errors; 3 warnings emitted
54156

55157
For more information about this error, try `rustc --explain E0570`.

‎tests/ui/abi/unsupported.arm.stderr

Lines changed: 99 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,139 @@
11
error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target
2-
--> $DIR/unsupported.rs:28:1
2+
--> $DIR/unsupported.rs:34:15
3+
|
4+
LL | fn ptx_ptr(f: extern "ptx-kernel" fn()) {
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^
6+
7+
error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target
8+
--> $DIR/unsupported.rs:38:1
9+
|
10+
LL | extern "ptx-kernel" {}
11+
| ^^^^^^^^^^^^^^^^^^^^^^
12+
13+
error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target
14+
--> $DIR/unsupported.rs:64:18
15+
|
16+
LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) {
17+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
18+
19+
error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target
20+
--> $DIR/unsupported.rs:68:1
21+
|
22+
LL | extern "msp430-interrupt" {}
23+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
24+
25+
error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target
26+
--> $DIR/unsupported.rs:73:15
27+
|
28+
LL | fn avr_ptr(f: extern "avr-interrupt" fn()) {
29+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
30+
31+
error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target
32+
--> $DIR/unsupported.rs:77:1
33+
|
34+
LL | extern "avr-interrupt" {}
35+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
36+
37+
error[E0570]: `"riscv-interrupt-m"` is not a supported ABI for the current target
38+
--> $DIR/unsupported.rs:85:17
39+
|
40+
LL | fn riscv_ptr(f: extern "riscv-interrupt-m" fn()) {
41+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
42+
43+
error[E0570]: `"riscv-interrupt-m"` is not a supported ABI for the current target
44+
--> $DIR/unsupported.rs:92:1
45+
|
46+
LL | extern "riscv-interrupt-m" {}
47+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
48+
49+
error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target
50+
--> $DIR/unsupported.rs:103:15
51+
|
52+
LL | fn x86_ptr(f: extern "x86-interrupt" fn()) {
53+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
54+
55+
error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target
56+
--> $DIR/unsupported.rs:110:1
57+
|
58+
LL | extern "x86-interrupt" {}
59+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
60+
61+
error[E0570]: `"thiscall"` is not a supported ABI for the current target
62+
--> $DIR/unsupported.rs:122:20
63+
|
64+
LL | fn thiscall_ptr(f: extern "thiscall" fn()) {
65+
| ^^^^^^^^^^^^^^^^^^^^^^
66+
67+
error[E0570]: `"thiscall"` is not a supported ABI for the current target
68+
--> $DIR/unsupported.rs:130:1
69+
|
70+
LL | extern "thiscall" {}
71+
| ^^^^^^^^^^^^^^^^^^^^
72+
73+
warning: use of calling convention not supported on this target
74+
--> $DIR/unsupported.rs:148:19
75+
|
76+
LL | fn stdcall_ptr(f: extern "stdcall" fn()) {
77+
| ^^^^^^^^^^^^^^^^^^^^^
78+
|
79+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
80+
= note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678>
81+
= note: `#[warn(unsupported_calling_conventions)]` on by default
82+
83+
warning: use of calling convention not supported on this target
84+
--> $DIR/unsupported.rs:161:1
85+
|
86+
LL | extern "stdcall" {}
87+
| ^^^^^^^^^^^^^^^^^^^
88+
|
89+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
90+
= note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678>
91+
92+
error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target
93+
--> $DIR/unsupported.rs:32:1
394
|
495
LL | extern "ptx-kernel" fn ptx() {}
596
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
697

798
error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target
8-
--> $DIR/unsupported.rs:36:1
99+
--> $DIR/unsupported.rs:62:1
9100
|
10101
LL | extern "msp430-interrupt" fn msp430() {}
11102
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12103

13104
error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target
14-
--> $DIR/unsupported.rs:38:1
105+
--> $DIR/unsupported.rs:71:1
15106
|
16107
LL | extern "avr-interrupt" fn avr() {}
17108
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
18109

19110
error[E0570]: `"riscv-interrupt-m"` is not a supported ABI for the current target
20-
--> $DIR/unsupported.rs:40:1
111+
--> $DIR/unsupported.rs:80:1
21112
|
22113
LL | extern "riscv-interrupt-m" fn riscv() {}
23114
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
24115

25116
error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target
26-
--> $DIR/unsupported.rs:45:1
117+
--> $DIR/unsupported.rs:98:1
27118
|
28119
LL | extern "x86-interrupt" fn x86() {}
29120
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
30121

31122
error[E0570]: `"thiscall"` is not a supported ABI for the current target
32-
--> $DIR/unsupported.rs:50:1
123+
--> $DIR/unsupported.rs:116:1
33124
|
34125
LL | extern "thiscall" fn thiscall() {}
35126
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
36127

37128
warning: use of calling convention not supported on this target
38-
--> $DIR/unsupported.rs:56:1
129+
--> $DIR/unsupported.rs:137:1
39130
|
40131
LL | extern "stdcall" fn stdcall() {}
41132
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
42133
|
43134
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
44135
= note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678>
45-
= note: `#[warn(unsupported_calling_conventions)]` on by default
46136

47-
error: aborting due to 6 previous errors; 1 warning emitted
137+
error: aborting due to 18 previous errors; 3 warnings emitted
48138

49139
For more information about this error, try `rustc --explain E0570`.

‎tests/ui/abi/unsupported.i686.stderr

Lines changed: 72 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,99 @@
11
error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target
2-
--> $DIR/unsupported.rs:28:1
2+
--> $DIR/unsupported.rs:34:15
3+
|
4+
LL | fn ptx_ptr(f: extern "ptx-kernel" fn()) {
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^
6+
7+
error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target
8+
--> $DIR/unsupported.rs:38:1
9+
|
10+
LL | extern "ptx-kernel" {}
11+
| ^^^^^^^^^^^^^^^^^^^^^^
12+
13+
error[E0570]: `"aapcs"` is not a supported ABI for the current target
14+
--> $DIR/unsupported.rs:47:17
15+
|
16+
LL | fn aapcs_ptr(f: extern "aapcs" fn()) {
17+
| ^^^^^^^^^^^^^^^^^^^
18+
19+
error[E0570]: `"aapcs"` is not a supported ABI for the current target
20+
--> $DIR/unsupported.rs:55:1
21+
|
22+
LL | extern "aapcs" {}
23+
| ^^^^^^^^^^^^^^^^^
24+
25+
error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target
26+
--> $DIR/unsupported.rs:64:18
27+
|
28+
LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) {
29+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
30+
31+
error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target
32+
--> $DIR/unsupported.rs:68:1
33+
|
34+
LL | extern "msp430-interrupt" {}
35+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
36+
37+
error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target
38+
--> $DIR/unsupported.rs:73:15
39+
|
40+
LL | fn avr_ptr(f: extern "avr-interrupt" fn()) {
41+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
42+
43+
error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target
44+
--> $DIR/unsupported.rs:77:1
45+
|
46+
LL | extern "avr-interrupt" {}
47+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
48+
49+
error[E0570]: `"riscv-interrupt-m"` is not a supported ABI for the current target
50+
--> $DIR/unsupported.rs:85:17
51+
|
52+
LL | fn riscv_ptr(f: extern "riscv-interrupt-m" fn()) {
53+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
54+
55+
error[E0570]: `"riscv-interrupt-m"` is not a supported ABI for the current target
56+
--> $DIR/unsupported.rs:92:1
57+
|
58+
LL | extern "riscv-interrupt-m" {}
59+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
60+
61+
error[E0570]: `"C-cmse-nonsecure-call"` is not a supported ABI for the current target
62+
--> $DIR/unsupported.rs:173:16
63+
|
64+
LL | fn cmse_ptr(f: extern "C-cmse-nonsecure-call" fn()) {
65+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66+
67+
error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target
68+
--> $DIR/unsupported.rs:32:1
369
|
470
LL | extern "ptx-kernel" fn ptx() {}
571
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
672

773
error[E0570]: `"aapcs"` is not a supported ABI for the current target
8-
--> $DIR/unsupported.rs:30:1
74+
--> $DIR/unsupported.rs:41:1
975
|
1076
LL | extern "aapcs" fn aapcs() {}
1177
| ^^^^^^^^^^^^^^^^^^^^^^^^^
1278

1379
error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target
14-
--> $DIR/unsupported.rs:36:1
80+
--> $DIR/unsupported.rs:62:1
1581
|
1682
LL | extern "msp430-interrupt" fn msp430() {}
1783
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1884

1985
error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target
20-
--> $DIR/unsupported.rs:38:1
86+
--> $DIR/unsupported.rs:71:1
2187
|
2288
LL | extern "avr-interrupt" fn avr() {}
2389
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2490

2591
error[E0570]: `"riscv-interrupt-m"` is not a supported ABI for the current target
26-
--> $DIR/unsupported.rs:40:1
92+
--> $DIR/unsupported.rs:80:1
2793
|
2894
LL | extern "riscv-interrupt-m" fn riscv() {}
2995
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3096

31-
error: aborting due to 5 previous errors
97+
error: aborting due to 16 previous errors
3298

3399
For more information about this error, try `rustc --explain E0570`.
Lines changed: 105 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,145 @@
11
error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target
2-
--> $DIR/unsupported.rs:28:1
2+
--> $DIR/unsupported.rs:34:15
3+
|
4+
LL | fn ptx_ptr(f: extern "ptx-kernel" fn()) {
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^
6+
7+
error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target
8+
--> $DIR/unsupported.rs:38:1
9+
|
10+
LL | extern "ptx-kernel" {}
11+
| ^^^^^^^^^^^^^^^^^^^^^^
12+
13+
error[E0570]: `"aapcs"` is not a supported ABI for the current target
14+
--> $DIR/unsupported.rs:47:17
15+
|
16+
LL | fn aapcs_ptr(f: extern "aapcs" fn()) {
17+
| ^^^^^^^^^^^^^^^^^^^
18+
19+
error[E0570]: `"aapcs"` is not a supported ABI for the current target
20+
--> $DIR/unsupported.rs:55:1
21+
|
22+
LL | extern "aapcs" {}
23+
| ^^^^^^^^^^^^^^^^^
24+
25+
error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target
26+
--> $DIR/unsupported.rs:64:18
27+
|
28+
LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) {
29+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
30+
31+
error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target
32+
--> $DIR/unsupported.rs:68:1
33+
|
34+
LL | extern "msp430-interrupt" {}
35+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
36+
37+
error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target
38+
--> $DIR/unsupported.rs:73:15
39+
|
40+
LL | fn avr_ptr(f: extern "avr-interrupt" fn()) {
41+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
42+
43+
error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target
44+
--> $DIR/unsupported.rs:77:1
45+
|
46+
LL | extern "avr-interrupt" {}
47+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
48+
49+
error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target
50+
--> $DIR/unsupported.rs:103:15
51+
|
52+
LL | fn x86_ptr(f: extern "x86-interrupt" fn()) {
53+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
54+
55+
error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target
56+
--> $DIR/unsupported.rs:110:1
57+
|
58+
LL | extern "x86-interrupt" {}
59+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
60+
61+
error[E0570]: `"thiscall"` is not a supported ABI for the current target
62+
--> $DIR/unsupported.rs:122:20
63+
|
64+
LL | fn thiscall_ptr(f: extern "thiscall" fn()) {
65+
| ^^^^^^^^^^^^^^^^^^^^^^
66+
67+
error[E0570]: `"thiscall"` is not a supported ABI for the current target
68+
--> $DIR/unsupported.rs:130:1
69+
|
70+
LL | extern "thiscall" {}
71+
| ^^^^^^^^^^^^^^^^^^^^
72+
73+
warning: use of calling convention not supported on this target
74+
--> $DIR/unsupported.rs:148:19
75+
|
76+
LL | fn stdcall_ptr(f: extern "stdcall" fn()) {
77+
| ^^^^^^^^^^^^^^^^^^^^^
78+
|
79+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
80+
= note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678>
81+
= note: `#[warn(unsupported_calling_conventions)]` on by default
82+
83+
warning: use of calling convention not supported on this target
84+
--> $DIR/unsupported.rs:161:1
85+
|
86+
LL | extern "stdcall" {}
87+
| ^^^^^^^^^^^^^^^^^^^
88+
|
89+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
90+
= note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678>
91+
92+
error[E0570]: `"C-cmse-nonsecure-call"` is not a supported ABI for the current target
93+
--> $DIR/unsupported.rs:173:16
94+
|
95+
LL | fn cmse_ptr(f: extern "C-cmse-nonsecure-call" fn()) {
96+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
97+
98+
error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target
99+
--> $DIR/unsupported.rs:32:1
3100
|
4101
LL | extern "ptx-kernel" fn ptx() {}
5102
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6103

7104
error[E0570]: `"aapcs"` is not a supported ABI for the current target
8-
--> $DIR/unsupported.rs:30:1
105+
--> $DIR/unsupported.rs:41:1
9106
|
10107
LL | extern "aapcs" fn aapcs() {}
11108
| ^^^^^^^^^^^^^^^^^^^^^^^^^
12109

13110
error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target
14-
--> $DIR/unsupported.rs:36:1
111+
--> $DIR/unsupported.rs:62:1
15112
|
16113
LL | extern "msp430-interrupt" fn msp430() {}
17114
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
18115

19116
error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target
20-
--> $DIR/unsupported.rs:38:1
117+
--> $DIR/unsupported.rs:71:1
21118
|
22119
LL | extern "avr-interrupt" fn avr() {}
23120
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
24121

25122
error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target
26-
--> $DIR/unsupported.rs:45:1
123+
--> $DIR/unsupported.rs:98:1
27124
|
28125
LL | extern "x86-interrupt" fn x86() {}
29126
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
30127

31128
error[E0570]: `"thiscall"` is not a supported ABI for the current target
32-
--> $DIR/unsupported.rs:50:1
129+
--> $DIR/unsupported.rs:116:1
33130
|
34131
LL | extern "thiscall" fn thiscall() {}
35132
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
36133

37134
warning: use of calling convention not supported on this target
38-
--> $DIR/unsupported.rs:56:1
135+
--> $DIR/unsupported.rs:137:1
39136
|
40137
LL | extern "stdcall" fn stdcall() {}
41138
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
42139
|
43140
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
44141
= note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678>
45-
= note: `#[warn(unsupported_calling_conventions)]` on by default
46142

47-
error: aborting due to 6 previous errors; 1 warning emitted
143+
error: aborting due to 19 previous errors; 3 warnings emitted
48144

49145
For more information about this error, try `rustc --explain E0570`.
Lines changed: 105 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,145 @@
11
error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target
2-
--> $DIR/unsupported.rs:28:1
2+
--> $DIR/unsupported.rs:34:15
3+
|
4+
LL | fn ptx_ptr(f: extern "ptx-kernel" fn()) {
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^
6+
7+
error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target
8+
--> $DIR/unsupported.rs:38:1
9+
|
10+
LL | extern "ptx-kernel" {}
11+
| ^^^^^^^^^^^^^^^^^^^^^^
12+
13+
error[E0570]: `"aapcs"` is not a supported ABI for the current target
14+
--> $DIR/unsupported.rs:47:17
15+
|
16+
LL | fn aapcs_ptr(f: extern "aapcs" fn()) {
17+
| ^^^^^^^^^^^^^^^^^^^
18+
19+
error[E0570]: `"aapcs"` is not a supported ABI for the current target
20+
--> $DIR/unsupported.rs:55:1
21+
|
22+
LL | extern "aapcs" {}
23+
| ^^^^^^^^^^^^^^^^^
24+
25+
error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target
26+
--> $DIR/unsupported.rs:64:18
27+
|
28+
LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) {
29+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
30+
31+
error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target
32+
--> $DIR/unsupported.rs:68:1
33+
|
34+
LL | extern "msp430-interrupt" {}
35+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
36+
37+
error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target
38+
--> $DIR/unsupported.rs:73:15
39+
|
40+
LL | fn avr_ptr(f: extern "avr-interrupt" fn()) {
41+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
42+
43+
error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target
44+
--> $DIR/unsupported.rs:77:1
45+
|
46+
LL | extern "avr-interrupt" {}
47+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
48+
49+
error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target
50+
--> $DIR/unsupported.rs:103:15
51+
|
52+
LL | fn x86_ptr(f: extern "x86-interrupt" fn()) {
53+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
54+
55+
error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target
56+
--> $DIR/unsupported.rs:110:1
57+
|
58+
LL | extern "x86-interrupt" {}
59+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
60+
61+
error[E0570]: `"thiscall"` is not a supported ABI for the current target
62+
--> $DIR/unsupported.rs:122:20
63+
|
64+
LL | fn thiscall_ptr(f: extern "thiscall" fn()) {
65+
| ^^^^^^^^^^^^^^^^^^^^^^
66+
67+
error[E0570]: `"thiscall"` is not a supported ABI for the current target
68+
--> $DIR/unsupported.rs:130:1
69+
|
70+
LL | extern "thiscall" {}
71+
| ^^^^^^^^^^^^^^^^^^^^
72+
73+
warning: use of calling convention not supported on this target
74+
--> $DIR/unsupported.rs:148:19
75+
|
76+
LL | fn stdcall_ptr(f: extern "stdcall" fn()) {
77+
| ^^^^^^^^^^^^^^^^^^^^^
78+
|
79+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
80+
= note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678>
81+
= note: `#[warn(unsupported_calling_conventions)]` on by default
82+
83+
warning: use of calling convention not supported on this target
84+
--> $DIR/unsupported.rs:161:1
85+
|
86+
LL | extern "stdcall" {}
87+
| ^^^^^^^^^^^^^^^^^^^
88+
|
89+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
90+
= note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678>
91+
92+
error[E0570]: `"C-cmse-nonsecure-call"` is not a supported ABI for the current target
93+
--> $DIR/unsupported.rs:173:16
94+
|
95+
LL | fn cmse_ptr(f: extern "C-cmse-nonsecure-call" fn()) {
96+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
97+
98+
error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target
99+
--> $DIR/unsupported.rs:32:1
3100
|
4101
LL | extern "ptx-kernel" fn ptx() {}
5102
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6103

7104
error[E0570]: `"aapcs"` is not a supported ABI for the current target
8-
--> $DIR/unsupported.rs:30:1
105+
--> $DIR/unsupported.rs:41:1
9106
|
10107
LL | extern "aapcs" fn aapcs() {}
11108
| ^^^^^^^^^^^^^^^^^^^^^^^^^
12109

13110
error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target
14-
--> $DIR/unsupported.rs:36:1
111+
--> $DIR/unsupported.rs:62:1
15112
|
16113
LL | extern "msp430-interrupt" fn msp430() {}
17114
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
18115

19116
error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target
20-
--> $DIR/unsupported.rs:38:1
117+
--> $DIR/unsupported.rs:71:1
21118
|
22119
LL | extern "avr-interrupt" fn avr() {}
23120
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
24121

25122
error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target
26-
--> $DIR/unsupported.rs:45:1
123+
--> $DIR/unsupported.rs:98:1
27124
|
28125
LL | extern "x86-interrupt" fn x86() {}
29126
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
30127

31128
error[E0570]: `"thiscall"` is not a supported ABI for the current target
32-
--> $DIR/unsupported.rs:50:1
129+
--> $DIR/unsupported.rs:116:1
33130
|
34131
LL | extern "thiscall" fn thiscall() {}
35132
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
36133

37134
warning: use of calling convention not supported on this target
38-
--> $DIR/unsupported.rs:56:1
135+
--> $DIR/unsupported.rs:137:1
39136
|
40137
LL | extern "stdcall" fn stdcall() {}
41138
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
42139
|
43140
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
44141
= note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678>
45-
= note: `#[warn(unsupported_calling_conventions)]` on by default
46142

47-
error: aborting due to 6 previous errors; 1 warning emitted
143+
error: aborting due to 19 previous errors; 3 warnings emitted
48144

49145
For more information about this error, try `rustc --explain E0570`.

‎tests/ui/abi/unsupported.rs

Lines changed: 114 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,39 +20,120 @@
2020
abi_msp430_interrupt,
2121
abi_avr_interrupt,
2222
abi_x86_interrupt,
23-
abi_riscv_interrupt
23+
abi_riscv_interrupt,
24+
abi_c_cmse_nonsecure_call
2425
)]
2526
#[lang = "sized"]
2627
trait Sized {}
2728

29+
#[lang = "copy"]
30+
trait Copy {}
31+
2832
extern "ptx-kernel" fn ptx() {}
2933
//~^ ERROR is not a supported ABI
34+
fn ptx_ptr(f: extern "ptx-kernel" fn()) {
35+
//~^ ERROR is not a supported ABI
36+
f()
37+
}
38+
extern "ptx-kernel" {}
39+
//~^ ERROR is not a supported ABI
40+
3041
extern "aapcs" fn aapcs() {}
3142
//[x64]~^ ERROR is not a supported ABI
3243
//[i686]~^^ ERROR is not a supported ABI
3344
//[aarch64]~^^^ ERROR is not a supported ABI
3445
//[riscv32]~^^^^ ERROR is not a supported ABI
3546
//[riscv64]~^^^^^ ERROR is not a supported ABI
47+
fn aapcs_ptr(f: extern "aapcs" fn()) {
48+
//[x64]~^ ERROR is not a supported ABI
49+
//[i686]~^^ ERROR is not a supported ABI
50+
//[aarch64]~^^^ ERROR is not a supported ABI
51+
//[riscv32]~^^^^ ERROR is not a supported ABI
52+
//[riscv64]~^^^^^ ERROR is not a supported ABI
53+
f()
54+
}
55+
extern "aapcs" {}
56+
//[x64]~^ ERROR is not a supported ABI
57+
//[i686]~^^ ERROR is not a supported ABI
58+
//[aarch64]~^^^ ERROR is not a supported ABI
59+
//[riscv32]~^^^^ ERROR is not a supported ABI
60+
//[riscv64]~^^^^^ ERROR is not a supported ABI
61+
3662
extern "msp430-interrupt" fn msp430() {}
3763
//~^ ERROR is not a supported ABI
64+
fn msp430_ptr(f: extern "msp430-interrupt" fn()) {
65+
//~^ ERROR is not a supported ABI
66+
f()
67+
}
68+
extern "msp430-interrupt" {}
69+
//~^ ERROR is not a supported ABI
70+
3871
extern "avr-interrupt" fn avr() {}
3972
//~^ ERROR is not a supported ABI
73+
fn avr_ptr(f: extern "avr-interrupt" fn()) {
74+
//~^ ERROR is not a supported ABI
75+
f()
76+
}
77+
extern "avr-interrupt" {}
78+
//~^ ERROR is not a supported ABI
79+
4080
extern "riscv-interrupt-m" fn riscv() {}
4181
//[arm]~^ ERROR is not a supported ABI
4282
//[x64]~^^ ERROR is not a supported ABI
4383
//[i686]~^^^ ERROR is not a supported ABI
4484
//[aarch64]~^^^^ ERROR is not a supported ABI
85+
fn riscv_ptr(f: extern "riscv-interrupt-m" fn()) {
86+
//[arm]~^ ERROR is not a supported ABI
87+
//[x64]~^^ ERROR is not a supported ABI
88+
//[i686]~^^^ ERROR is not a supported ABI
89+
//[aarch64]~^^^^ ERROR is not a supported ABI
90+
f()
91+
}
92+
extern "riscv-interrupt-m" {}
93+
//[arm]~^ ERROR is not a supported ABI
94+
//[x64]~^^ ERROR is not a supported ABI
95+
//[i686]~^^^ ERROR is not a supported ABI
96+
//[aarch64]~^^^^ ERROR is not a supported ABI
97+
4598
extern "x86-interrupt" fn x86() {}
4699
//[aarch64]~^ ERROR is not a supported ABI
47100
//[arm]~^^ ERROR is not a supported ABI
48101
//[riscv32]~^^^ ERROR is not a supported ABI
49102
//[riscv64]~^^^^ ERROR is not a supported ABI
103+
fn x86_ptr(f: extern "x86-interrupt" fn()) {
104+
//[aarch64]~^ ERROR is not a supported ABI
105+
//[arm]~^^ ERROR is not a supported ABI
106+
//[riscv32]~^^^ ERROR is not a supported ABI
107+
//[riscv64]~^^^^ ERROR is not a supported ABI
108+
f()
109+
}
110+
extern "x86-interrupt" {}
111+
//[aarch64]~^ ERROR is not a supported ABI
112+
//[arm]~^^ ERROR is not a supported ABI
113+
//[riscv32]~^^^ ERROR is not a supported ABI
114+
//[riscv64]~^^^^ ERROR is not a supported ABI
115+
50116
extern "thiscall" fn thiscall() {}
51117
//[x64]~^ ERROR is not a supported ABI
52118
//[arm]~^^ ERROR is not a supported ABI
53119
//[aarch64]~^^^ ERROR is not a supported ABI
54120
//[riscv32]~^^^^ ERROR is not a supported ABI
55121
//[riscv64]~^^^^^ ERROR is not a supported ABI
122+
fn thiscall_ptr(f: extern "thiscall" fn()) {
123+
//[x64]~^ ERROR is not a supported ABI
124+
//[arm]~^^ ERROR is not a supported ABI
125+
//[aarch64]~^^^ ERROR is not a supported ABI
126+
//[riscv32]~^^^^ ERROR is not a supported ABI
127+
//[riscv64]~^^^^^ ERROR is not a supported ABI
128+
f()
129+
}
130+
extern "thiscall" {}
131+
//[x64]~^ ERROR is not a supported ABI
132+
//[arm]~^^ ERROR is not a supported ABI
133+
//[aarch64]~^^^ ERROR is not a supported ABI
134+
//[riscv32]~^^^^ ERROR is not a supported ABI
135+
//[riscv64]~^^^^^ ERROR is not a supported ABI
136+
56137
extern "stdcall" fn stdcall() {}
57138
//[x64]~^ WARN use of calling convention not supported
58139
//[x64]~^^ WARN this was previously accepted
@@ -64,3 +145,35 @@ extern "stdcall" fn stdcall() {}
64145
//[riscv32]~^^^^^^^^ WARN this was previously accepted
65146
//[riscv64]~^^^^^^^^^ WARN use of calling convention not supported
66147
//[riscv64]~^^^^^^^^^^ WARN this was previously accepted
148+
fn stdcall_ptr(f: extern "stdcall" fn()) {
149+
//[x64]~^ WARN use of calling convention not supported
150+
//[x64]~^^ WARN this was previously accepted
151+
//[arm]~^^^ WARN use of calling convention not supported
152+
//[arm]~^^^^ WARN this was previously accepted
153+
//[aarch64]~^^^^^ WARN use of calling convention not supported
154+
//[aarch64]~^^^^^^ WARN this was previously accepted
155+
//[riscv32]~^^^^^^^ WARN use of calling convention not supported
156+
//[riscv32]~^^^^^^^^ WARN this was previously accepted
157+
//[riscv64]~^^^^^^^^^ WARN use of calling convention not supported
158+
//[riscv64]~^^^^^^^^^^ WARN this was previously accepted
159+
f()
160+
}
161+
extern "stdcall" {}
162+
//[x64]~^ WARN use of calling convention not supported
163+
//[x64]~^^ WARN this was previously accepted
164+
//[arm]~^^^ WARN use of calling convention not supported
165+
//[arm]~^^^^ WARN this was previously accepted
166+
//[aarch64]~^^^^^ WARN use of calling convention not supported
167+
//[aarch64]~^^^^^^ WARN this was previously accepted
168+
//[riscv32]~^^^^^^^ WARN use of calling convention not supported
169+
//[riscv32]~^^^^^^^^ WARN this was previously accepted
170+
//[riscv64]~^^^^^^^^^ WARN use of calling convention not supported
171+
//[riscv64]~^^^^^^^^^^ WARN this was previously accepted
172+
173+
fn cmse_ptr(f: extern "C-cmse-nonsecure-call" fn()) {
174+
//[x64]~^ ERROR is not a supported ABI
175+
//[i686]~^^ ERROR is not a supported ABI
176+
//[riscv32]~^^^ ERROR is not a supported ABI
177+
//[riscv64]~^^^^ ERROR is not a supported ABI
178+
f()
179+
}

‎tests/ui/abi/unsupported.x64.stderr

Lines changed: 105 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,145 @@
11
error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target
2-
--> $DIR/unsupported.rs:28:1
2+
--> $DIR/unsupported.rs:34:15
3+
|
4+
LL | fn ptx_ptr(f: extern "ptx-kernel" fn()) {
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^
6+
7+
error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target
8+
--> $DIR/unsupported.rs:38:1
9+
|
10+
LL | extern "ptx-kernel" {}
11+
| ^^^^^^^^^^^^^^^^^^^^^^
12+
13+
error[E0570]: `"aapcs"` is not a supported ABI for the current target
14+
--> $DIR/unsupported.rs:47:17
15+
|
16+
LL | fn aapcs_ptr(f: extern "aapcs" fn()) {
17+
| ^^^^^^^^^^^^^^^^^^^
18+
19+
error[E0570]: `"aapcs"` is not a supported ABI for the current target
20+
--> $DIR/unsupported.rs:55:1
21+
|
22+
LL | extern "aapcs" {}
23+
| ^^^^^^^^^^^^^^^^^
24+
25+
error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target
26+
--> $DIR/unsupported.rs:64:18
27+
|
28+
LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) {
29+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
30+
31+
error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target
32+
--> $DIR/unsupported.rs:68:1
33+
|
34+
LL | extern "msp430-interrupt" {}
35+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
36+
37+
error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target
38+
--> $DIR/unsupported.rs:73:15
39+
|
40+
LL | fn avr_ptr(f: extern "avr-interrupt" fn()) {
41+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
42+
43+
error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target
44+
--> $DIR/unsupported.rs:77:1
45+
|
46+
LL | extern "avr-interrupt" {}
47+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
48+
49+
error[E0570]: `"riscv-interrupt-m"` is not a supported ABI for the current target
50+
--> $DIR/unsupported.rs:85:17
51+
|
52+
LL | fn riscv_ptr(f: extern "riscv-interrupt-m" fn()) {
53+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
54+
55+
error[E0570]: `"riscv-interrupt-m"` is not a supported ABI for the current target
56+
--> $DIR/unsupported.rs:92:1
57+
|
58+
LL | extern "riscv-interrupt-m" {}
59+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
60+
61+
error[E0570]: `"thiscall"` is not a supported ABI for the current target
62+
--> $DIR/unsupported.rs:122:20
63+
|
64+
LL | fn thiscall_ptr(f: extern "thiscall" fn()) {
65+
| ^^^^^^^^^^^^^^^^^^^^^^
66+
67+
error[E0570]: `"thiscall"` is not a supported ABI for the current target
68+
--> $DIR/unsupported.rs:130:1
69+
|
70+
LL | extern "thiscall" {}
71+
| ^^^^^^^^^^^^^^^^^^^^
72+
73+
warning: use of calling convention not supported on this target
74+
--> $DIR/unsupported.rs:148:19
75+
|
76+
LL | fn stdcall_ptr(f: extern "stdcall" fn()) {
77+
| ^^^^^^^^^^^^^^^^^^^^^
78+
|
79+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
80+
= note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678>
81+
= note: `#[warn(unsupported_calling_conventions)]` on by default
82+
83+
warning: use of calling convention not supported on this target
84+
--> $DIR/unsupported.rs:161:1
85+
|
86+
LL | extern "stdcall" {}
87+
| ^^^^^^^^^^^^^^^^^^^
88+
|
89+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
90+
= note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678>
91+
92+
error[E0570]: `"C-cmse-nonsecure-call"` is not a supported ABI for the current target
93+
--> $DIR/unsupported.rs:173:16
94+
|
95+
LL | fn cmse_ptr(f: extern "C-cmse-nonsecure-call" fn()) {
96+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
97+
98+
error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target
99+
--> $DIR/unsupported.rs:32:1
3100
|
4101
LL | extern "ptx-kernel" fn ptx() {}
5102
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6103

7104
error[E0570]: `"aapcs"` is not a supported ABI for the current target
8-
--> $DIR/unsupported.rs:30:1
105+
--> $DIR/unsupported.rs:41:1
9106
|
10107
LL | extern "aapcs" fn aapcs() {}
11108
| ^^^^^^^^^^^^^^^^^^^^^^^^^
12109

13110
error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target
14-
--> $DIR/unsupported.rs:36:1
111+
--> $DIR/unsupported.rs:62:1
15112
|
16113
LL | extern "msp430-interrupt" fn msp430() {}
17114
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
18115

19116
error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target
20-
--> $DIR/unsupported.rs:38:1
117+
--> $DIR/unsupported.rs:71:1
21118
|
22119
LL | extern "avr-interrupt" fn avr() {}
23120
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
24121

25122
error[E0570]: `"riscv-interrupt-m"` is not a supported ABI for the current target
26-
--> $DIR/unsupported.rs:40:1
123+
--> $DIR/unsupported.rs:80:1
27124
|
28125
LL | extern "riscv-interrupt-m" fn riscv() {}
29126
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
30127

31128
error[E0570]: `"thiscall"` is not a supported ABI for the current target
32-
--> $DIR/unsupported.rs:50:1
129+
--> $DIR/unsupported.rs:116:1
33130
|
34131
LL | extern "thiscall" fn thiscall() {}
35132
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
36133

37134
warning: use of calling convention not supported on this target
38-
--> $DIR/unsupported.rs:56:1
135+
--> $DIR/unsupported.rs:137:1
39136
|
40137
LL | extern "stdcall" fn stdcall() {}
41138
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
42139
|
43140
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
44141
= note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678>
45-
= note: `#[warn(unsupported_calling_conventions)]` on by default
46142

47-
error: aborting due to 6 previous errors; 1 warning emitted
143+
error: aborting due to 19 previous errors; 3 warnings emitted
48144

49145
For more information about this error, try `rustc --explain E0570`.

‎tests/ui/c-variadic/feature-gate-extended_varargs_abi_support.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//@ only-x86_64
2+
13
fn efiapi(f: extern "efiapi" fn(usize, ...)) {
24
//~^ ERROR: C-variadic function must have a compatible calling convention, like `C` or `cdecl`
35
//~^^ ERROR: using calling conventions other than `C` or `cdecl` for varargs functions is unstable

‎tests/ui/c-variadic/feature-gate-extended_varargs_abi_support.stderr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0658]: using calling conventions other than `C` or `cdecl` for varargs functions is unstable
2-
--> $DIR/feature-gate-extended_varargs_abi_support.rs:1:14
2+
--> $DIR/feature-gate-extended_varargs_abi_support.rs:3:14
33
|
44
LL | fn efiapi(f: extern "efiapi" fn(usize, ...)) {
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -9,13 +9,13 @@ LL | fn efiapi(f: extern "efiapi" fn(usize, ...)) {
99
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
1010

1111
error[E0045]: C-variadic function must have a compatible calling convention, like `C` or `cdecl`
12-
--> $DIR/feature-gate-extended_varargs_abi_support.rs:1:14
12+
--> $DIR/feature-gate-extended_varargs_abi_support.rs:3:14
1313
|
1414
LL | fn efiapi(f: extern "efiapi" fn(usize, ...)) {
1515
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C-variadic function must have a compatible calling convention
1616

1717
error[E0658]: using calling conventions other than `C` or `cdecl` for varargs functions is unstable
18-
--> $DIR/feature-gate-extended_varargs_abi_support.rs:6:12
18+
--> $DIR/feature-gate-extended_varargs_abi_support.rs:8:12
1919
|
2020
LL | fn sysv(f: extern "sysv64" fn(usize, ...)) {
2121
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -25,13 +25,13 @@ LL | fn sysv(f: extern "sysv64" fn(usize, ...)) {
2525
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
2626

2727
error[E0045]: C-variadic function must have a compatible calling convention, like `C` or `cdecl`
28-
--> $DIR/feature-gate-extended_varargs_abi_support.rs:6:12
28+
--> $DIR/feature-gate-extended_varargs_abi_support.rs:8:12
2929
|
3030
LL | fn sysv(f: extern "sysv64" fn(usize, ...)) {
3131
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C-variadic function must have a compatible calling convention
3232

3333
error[E0658]: using calling conventions other than `C` or `cdecl` for varargs functions is unstable
34-
--> $DIR/feature-gate-extended_varargs_abi_support.rs:11:11
34+
--> $DIR/feature-gate-extended_varargs_abi_support.rs:13:11
3535
|
3636
LL | fn win(f: extern "win64" fn(usize, ...)) {
3737
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -41,7 +41,7 @@ LL | fn win(f: extern "win64" fn(usize, ...)) {
4141
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
4242

4343
error[E0045]: C-variadic function must have a compatible calling convention, like `C` or `cdecl`
44-
--> $DIR/feature-gate-extended_varargs_abi_support.rs:11:11
44+
--> $DIR/feature-gate-extended_varargs_abi_support.rs:13:11
4545
|
4646
LL | fn win(f: extern "win64" fn(usize, ...)) {
4747
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C-variadic function must have a compatible calling convention
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
//@ only-arm
2+
//@ build-pass
3+
#![feature(extended_varargs_abi_support)]
4+
5+
fn aapcs(f: extern "aapcs" fn(usize, ...)) {
6+
f(22, 44);
7+
}
8+
9+
fn main() {}

‎tests/ui/c-variadic/variadic-ffi-2.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//@ ignore-arm stdcall isn't supported
22
#![feature(extended_varargs_abi_support)]
33

4+
#[allow(unsupported_calling_conventions)]
45
fn baz(f: extern "stdcall" fn(usize, ...)) {
56
//~^ ERROR: C-variadic function must have a compatible calling convention,
67
// like C, cdecl, system, aapcs, win64, sysv64 or efiapi
@@ -10,12 +11,11 @@ fn baz(f: extern "stdcall" fn(usize, ...)) {
1011
fn system(f: extern "system" fn(usize, ...)) {
1112
f(22, 44);
1213
}
13-
fn aapcs(f: extern "aapcs" fn(usize, ...)) {
14-
f(22, 44);
15-
}
14+
#[cfg(target_arch = "x86_64")]
1615
fn sysv(f: extern "sysv64" fn(usize, ...)) {
1716
f(22, 44);
1817
}
18+
#[cfg(target_arch = "x86_64")]
1919
fn win(f: extern "win64" fn(usize, ...)) {
2020
f(22, 44);
2121
}

‎tests/ui/c-variadic/variadic-ffi-2.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0045]: C-variadic function must have a compatible calling convention, like `C`, `cdecl`, `system`, `aapcs`, `win64`, `sysv64` or `efiapi`
2-
--> $DIR/variadic-ffi-2.rs:4:11
2+
--> $DIR/variadic-ffi-2.rs:5:11
33
|
44
LL | fn baz(f: extern "stdcall" fn(usize, ...)) {
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C-variadic function must have a compatible calling convention

‎tests/ui/cmse-nonsecure/cmse-nonsecure-call/gate_test.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
fn main() {
33
let non_secure_function = unsafe {
44
core::mem::transmute::<usize, extern "C-cmse-nonsecure-call" fn(i32, i32, i32, i32) -> i32>(
5-
//~^ ERROR [E0658]
5+
//~^ ERROR [E0658]
6+
//~| ERROR [E0570]
67
0x10000004,
78
)
89
};

‎tests/ui/cmse-nonsecure/cmse-nonsecure-call/gate_test.stderr

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ LL | core::mem::transmute::<usize, extern "C-cmse-nonsecure-call" fn(i32
88
= help: add `#![feature(abi_c_cmse_nonsecure_call)]` to the crate attributes to enable
99
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
1010

11-
error: aborting due to 1 previous error
11+
error[E0570]: `"C-cmse-nonsecure-call"` is not a supported ABI for the current target
12+
--> $DIR/gate_test.rs:4:39
13+
|
14+
LL | core::mem::transmute::<usize, extern "C-cmse-nonsecure-call" fn(i32, i32, i32, i32) -> i32>(
15+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
16+
17+
error: aborting due to 2 previous errors
1218

13-
For more information about this error, try `rustc --explain E0658`.
19+
Some errors have detailed explanations: E0570, E0658.
20+
For more information about an error, try `rustc --explain E0570`.

0 commit comments

Comments
 (0)
Please sign in to comment.