Skip to content

Commit 1530ca4

Browse files
RalfJungworkingjubilee
authored andcommitted
unsupported_calling_conventions: print which ABI this is about
1 parent 3c99834 commit 1530ca4

File tree

9 files changed

+34
-32
lines changed

9 files changed

+34
-32
lines changed

compiler/rustc_hir_analysis/src/check/check.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ pub fn check_abi(tcx: TyCtxt<'_>, hir_id: hir::HirId, span: Span, abi: ExternAbi
6363
}
6464
AbiMapping::Deprecated(..) => {
6565
tcx.node_span_lint(UNSUPPORTED_CALLING_CONVENTIONS, hir_id, span, |lint| {
66-
lint.primary_message("use of calling convention not supported on this target");
66+
lint.primary_message(format!(
67+
"{abi} is not a supported ABI for the current target"
68+
));
6769
add_abi_diag_help(abi, lint);
6870
});
6971
}

tests/ui/abi/unsupported.aarch64.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ error[E0570]: `"thiscall"` is not a supported ABI for the current target
228228
LL | extern "thiscall" fn trait_fn(self) {
229229
| ^^^^^^^^^^
230230

231-
warning: use of calling convention not supported on this target
231+
warning: "cdecl" is not a supported ABI for the current target
232232
--> $DIR/unsupported.rs:123:17
233233
|
234234
LL | fn cdecl_ptr(f: extern "cdecl" fn()) {
@@ -239,7 +239,7 @@ LL | fn cdecl_ptr(f: extern "cdecl" fn()) {
239239
= help: use `extern "C"` instead
240240
= note: `#[warn(unsupported_calling_conventions)]` on by default
241241

242-
warning: use of calling convention not supported on this target
242+
warning: "cdecl" is not a supported ABI for the current target
243243
--> $DIR/unsupported.rs:128:1
244244
|
245245
LL | extern "cdecl" {}
@@ -249,7 +249,7 @@ LL | extern "cdecl" {}
249249
= note: for more information, see issue #137018 <https://github.com/rust-lang/rust/issues/137018>
250250
= help: use `extern "C"` instead
251251

252-
warning: use of calling convention not supported on this target
252+
warning: "cdecl-unwind" is not a supported ABI for the current target
253253
--> $DIR/unsupported.rs:131:1
254254
|
255255
LL | extern "cdecl-unwind" {}
@@ -259,7 +259,7 @@ LL | extern "cdecl-unwind" {}
259259
= note: for more information, see issue #137018 <https://github.com/rust-lang/rust/issues/137018>
260260
= help: use `extern "C-unwind"` instead
261261

262-
warning: use of calling convention not supported on this target
262+
warning: "cdecl" is not a supported ABI for the current target
263263
--> $DIR/unsupported.rs:120:1
264264
|
265265
LL | extern "cdecl" fn cdecl() {}

tests/ui/abi/unsupported.arm.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ error[E0570]: `"thiscall"` is not a supported ABI for the current target
210210
LL | extern "thiscall" fn trait_fn(self) {
211211
| ^^^^^^^^^^
212212

213-
warning: use of calling convention not supported on this target
213+
warning: "cdecl" is not a supported ABI for the current target
214214
--> $DIR/unsupported.rs:123:17
215215
|
216216
LL | fn cdecl_ptr(f: extern "cdecl" fn()) {
@@ -221,7 +221,7 @@ LL | fn cdecl_ptr(f: extern "cdecl" fn()) {
221221
= help: use `extern "C"` instead
222222
= note: `#[warn(unsupported_calling_conventions)]` on by default
223223

224-
warning: use of calling convention not supported on this target
224+
warning: "cdecl" is not a supported ABI for the current target
225225
--> $DIR/unsupported.rs:128:1
226226
|
227227
LL | extern "cdecl" {}
@@ -231,7 +231,7 @@ LL | extern "cdecl" {}
231231
= note: for more information, see issue #137018 <https://github.com/rust-lang/rust/issues/137018>
232232
= help: use `extern "C"` instead
233233

234-
warning: use of calling convention not supported on this target
234+
warning: "cdecl-unwind" is not a supported ABI for the current target
235235
--> $DIR/unsupported.rs:131:1
236236
|
237237
LL | extern "cdecl-unwind" {}
@@ -241,7 +241,7 @@ LL | extern "cdecl-unwind" {}
241241
= note: for more information, see issue #137018 <https://github.com/rust-lang/rust/issues/137018>
242242
= help: use `extern "C-unwind"` instead
243243

244-
warning: use of calling convention not supported on this target
244+
warning: "cdecl" is not a supported ABI for the current target
245245
--> $DIR/unsupported.rs:120:1
246246
|
247247
LL | extern "cdecl" fn cdecl() {}

tests/ui/abi/unsupported.riscv32.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ error[E0570]: `"thiscall"` is not a supported ABI for the current target
210210
LL | extern "thiscall" fn trait_fn(self) {
211211
| ^^^^^^^^^^
212212

213-
warning: use of calling convention not supported on this target
213+
warning: "cdecl" is not a supported ABI for the current target
214214
--> $DIR/unsupported.rs:123:17
215215
|
216216
LL | fn cdecl_ptr(f: extern "cdecl" fn()) {
@@ -221,7 +221,7 @@ LL | fn cdecl_ptr(f: extern "cdecl" fn()) {
221221
= help: use `extern "C"` instead
222222
= note: `#[warn(unsupported_calling_conventions)]` on by default
223223

224-
warning: use of calling convention not supported on this target
224+
warning: "cdecl" is not a supported ABI for the current target
225225
--> $DIR/unsupported.rs:128:1
226226
|
227227
LL | extern "cdecl" {}
@@ -231,7 +231,7 @@ LL | extern "cdecl" {}
231231
= note: for more information, see issue #137018 <https://github.com/rust-lang/rust/issues/137018>
232232
= help: use `extern "C"` instead
233233

234-
warning: use of calling convention not supported on this target
234+
warning: "cdecl-unwind" is not a supported ABI for the current target
235235
--> $DIR/unsupported.rs:131:1
236236
|
237237
LL | extern "cdecl-unwind" {}
@@ -241,7 +241,7 @@ LL | extern "cdecl-unwind" {}
241241
= note: for more information, see issue #137018 <https://github.com/rust-lang/rust/issues/137018>
242242
= help: use `extern "C-unwind"` instead
243243

244-
warning: use of calling convention not supported on this target
244+
warning: "cdecl" is not a supported ABI for the current target
245245
--> $DIR/unsupported.rs:120:1
246246
|
247247
LL | extern "cdecl" fn cdecl() {}

tests/ui/abi/unsupported.riscv64.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ error[E0570]: `"thiscall"` is not a supported ABI for the current target
210210
LL | extern "thiscall" fn trait_fn(self) {
211211
| ^^^^^^^^^^
212212

213-
warning: use of calling convention not supported on this target
213+
warning: "cdecl" is not a supported ABI for the current target
214214
--> $DIR/unsupported.rs:123:17
215215
|
216216
LL | fn cdecl_ptr(f: extern "cdecl" fn()) {
@@ -221,7 +221,7 @@ LL | fn cdecl_ptr(f: extern "cdecl" fn()) {
221221
= help: use `extern "C"` instead
222222
= note: `#[warn(unsupported_calling_conventions)]` on by default
223223

224-
warning: use of calling convention not supported on this target
224+
warning: "cdecl" is not a supported ABI for the current target
225225
--> $DIR/unsupported.rs:128:1
226226
|
227227
LL | extern "cdecl" {}
@@ -231,7 +231,7 @@ LL | extern "cdecl" {}
231231
= note: for more information, see issue #137018 <https://github.com/rust-lang/rust/issues/137018>
232232
= help: use `extern "C"` instead
233233

234-
warning: use of calling convention not supported on this target
234+
warning: "cdecl-unwind" is not a supported ABI for the current target
235235
--> $DIR/unsupported.rs:131:1
236236
|
237237
LL | extern "cdecl-unwind" {}
@@ -241,7 +241,7 @@ LL | extern "cdecl-unwind" {}
241241
= note: for more information, see issue #137018 <https://github.com/rust-lang/rust/issues/137018>
242242
= help: use `extern "C-unwind"` instead
243243

244-
warning: use of calling convention not supported on this target
244+
warning: "cdecl" is not a supported ABI for the current target
245245
--> $DIR/unsupported.rs:120:1
246246
|
247247
LL | extern "cdecl" fn cdecl() {}

tests/ui/abi/unsupported.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ extern "C-cmse-nonsecure-entry" {}
158158
#[cfg(windows)]
159159
#[link(name = "foo", kind = "raw-dylib")]
160160
extern "cdecl" {}
161-
//[x64_win]~^ WARN use of calling convention not supported on this target
161+
//[x64_win]~^ WARN unsupported_calling_conventions
162162
//[x64_win]~^^ WARN this was previously accepted
163163

164164
struct FnPtrBearer {

tests/ui/abi/unsupported.x64.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ error[E0570]: `"thiscall"` is not a supported ABI for the current target
192192
LL | extern "thiscall" fn trait_fn(self) {
193193
| ^^^^^^^^^^
194194

195-
warning: use of calling convention not supported on this target
195+
warning: "cdecl" is not a supported ABI for the current target
196196
--> $DIR/unsupported.rs:123:17
197197
|
198198
LL | fn cdecl_ptr(f: extern "cdecl" fn()) {
@@ -203,7 +203,7 @@ LL | fn cdecl_ptr(f: extern "cdecl" fn()) {
203203
= help: use `extern "C"` instead
204204
= note: `#[warn(unsupported_calling_conventions)]` on by default
205205

206-
warning: use of calling convention not supported on this target
206+
warning: "cdecl" is not a supported ABI for the current target
207207
--> $DIR/unsupported.rs:128:1
208208
|
209209
LL | extern "cdecl" {}
@@ -213,7 +213,7 @@ LL | extern "cdecl" {}
213213
= note: for more information, see issue #137018 <https://github.com/rust-lang/rust/issues/137018>
214214
= help: use `extern "C"` instead
215215

216-
warning: use of calling convention not supported on this target
216+
warning: "cdecl-unwind" is not a supported ABI for the current target
217217
--> $DIR/unsupported.rs:131:1
218218
|
219219
LL | extern "cdecl-unwind" {}
@@ -223,7 +223,7 @@ LL | extern "cdecl-unwind" {}
223223
= note: for more information, see issue #137018 <https://github.com/rust-lang/rust/issues/137018>
224224
= help: use `extern "C-unwind"` instead
225225

226-
warning: use of calling convention not supported on this target
226+
warning: "cdecl" is not a supported ABI for the current target
227227
--> $DIR/unsupported.rs:120:1
228228
|
229229
LL | extern "cdecl" fn cdecl() {}

tests/ui/abi/unsupported.x64_win.stderr

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ error[E0570]: `"thiscall"` is not a supported ABI for the current target
160160
LL | extern "thiscall" fn trait_fn(self) {
161161
| ^^^^^^^^^^
162162

163-
warning: use of calling convention not supported on this target
163+
warning: "stdcall" is not a supported ABI for the current target
164164
--> $DIR/unsupported.rs:105:19
165165
|
166166
LL | fn stdcall_ptr(f: extern "stdcall" fn()) {
@@ -171,7 +171,7 @@ LL | fn stdcall_ptr(f: extern "stdcall" fn()) {
171171
= help: if you need `extern "stdcall"` on win32 and `extern "C"` everywhere else, use `extern "system"`
172172
= note: `#[warn(unsupported_calling_conventions)]` on by default
173173

174-
warning: use of calling convention not supported on this target
174+
warning: "stdcall" is not a supported ABI for the current target
175175
--> $DIR/unsupported.rs:111:1
176176
|
177177
LL | extern "stdcall" {}
@@ -181,7 +181,7 @@ LL | extern "stdcall" {}
181181
= note: for more information, see issue #137018 <https://github.com/rust-lang/rust/issues/137018>
182182
= help: if you need `extern "stdcall"` on win32 and `extern "C"` everywhere else, use `extern "system"`
183183

184-
warning: use of calling convention not supported on this target
184+
warning: "stdcall-unwind" is not a supported ABI for the current target
185185
--> $DIR/unsupported.rs:115:1
186186
|
187187
LL | extern "stdcall-unwind" {}
@@ -191,7 +191,7 @@ LL | extern "stdcall-unwind" {}
191191
= note: for more information, see issue #137018 <https://github.com/rust-lang/rust/issues/137018>
192192
= help: if you need `extern "stdcall-unwind"` on win32 and `extern "C-unwind"` everywhere else, use `extern "system-unwind"`
193193

194-
warning: use of calling convention not supported on this target
194+
warning: "cdecl" is not a supported ABI for the current target
195195
--> $DIR/unsupported.rs:123:17
196196
|
197197
LL | fn cdecl_ptr(f: extern "cdecl" fn()) {
@@ -201,7 +201,7 @@ LL | fn cdecl_ptr(f: extern "cdecl" fn()) {
201201
= note: for more information, see issue #137018 <https://github.com/rust-lang/rust/issues/137018>
202202
= help: use `extern "C"` instead
203203

204-
warning: use of calling convention not supported on this target
204+
warning: "cdecl" is not a supported ABI for the current target
205205
--> $DIR/unsupported.rs:128:1
206206
|
207207
LL | extern "cdecl" {}
@@ -211,7 +211,7 @@ LL | extern "cdecl" {}
211211
= note: for more information, see issue #137018 <https://github.com/rust-lang/rust/issues/137018>
212212
= help: use `extern "C"` instead
213213

214-
warning: use of calling convention not supported on this target
214+
warning: "cdecl-unwind" is not a supported ABI for the current target
215215
--> $DIR/unsupported.rs:131:1
216216
|
217217
LL | extern "cdecl-unwind" {}
@@ -221,7 +221,7 @@ LL | extern "cdecl-unwind" {}
221221
= note: for more information, see issue #137018 <https://github.com/rust-lang/rust/issues/137018>
222222
= help: use `extern "C-unwind"` instead
223223

224-
warning: use of calling convention not supported on this target
224+
warning: "cdecl" is not a supported ABI for the current target
225225
--> $DIR/unsupported.rs:160:1
226226
|
227227
LL | extern "cdecl" {}
@@ -231,7 +231,7 @@ LL | extern "cdecl" {}
231231
= note: for more information, see issue #137018 <https://github.com/rust-lang/rust/issues/137018>
232232
= help: use `extern "C"` instead
233233

234-
warning: use of calling convention not supported on this target
234+
warning: "stdcall" is not a supported ABI for the current target
235235
--> $DIR/unsupported.rs:101:1
236236
|
237237
LL | extern "stdcall" fn stdcall() {}
@@ -241,7 +241,7 @@ LL | extern "stdcall" fn stdcall() {}
241241
= note: for more information, see issue #137018 <https://github.com/rust-lang/rust/issues/137018>
242242
= help: if you need `extern "stdcall"` on win32 and `extern "C"` everywhere else, use `extern "system"`
243243

244-
warning: use of calling convention not supported on this target
244+
warning: "cdecl" is not a supported ABI for the current target
245245
--> $DIR/unsupported.rs:120:1
246246
|
247247
LL | extern "cdecl" fn cdecl() {}

tests/ui/linkage-attr/raw-dylib/windows/unsupported-abi.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
warning: use of calling convention not supported on this target
1+
warning: "stdcall" is not a supported ABI for the current target
22
--> $DIR/unsupported-abi.rs:13:1
33
|
44
LL | / extern "stdcall" {

0 commit comments

Comments
 (0)