Skip to content

Commit 999c1ad

Browse files
RalfJungworkingjubilee
authored andcommitted
unsupported_calling_conventions: print which ABI this is about
1 parent c314a5b commit 999c1ad

File tree

8 files changed

+62
-60
lines changed

8 files changed

+62
-60
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: 8 additions & 8 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() {}
@@ -273,7 +273,7 @@ error: aborting due to 37 previous errors; 4 warnings emitted
273273

274274
For more information about this error, try `rustc --explain E0570`.
275275
Future incompatibility report: Future breakage diagnostic:
276-
warning: use of calling convention not supported on this target
276+
warning: "cdecl" is not a supported ABI for the current target
277277
--> $DIR/unsupported.rs:123:17
278278
|
279279
LL | fn cdecl_ptr(f: extern "cdecl" fn()) {
@@ -285,7 +285,7 @@ LL | fn cdecl_ptr(f: extern "cdecl" fn()) {
285285
= note: `#[warn(unsupported_calling_conventions)]` on by default
286286

287287
Future breakage diagnostic:
288-
warning: use of calling convention not supported on this target
288+
warning: "cdecl" is not a supported ABI for the current target
289289
--> $DIR/unsupported.rs:128:1
290290
|
291291
LL | extern "cdecl" {}
@@ -297,7 +297,7 @@ LL | extern "cdecl" {}
297297
= note: `#[warn(unsupported_calling_conventions)]` on by default
298298

299299
Future breakage diagnostic:
300-
warning: use of calling convention not supported on this target
300+
warning: "cdecl-unwind" is not a supported ABI for the current target
301301
--> $DIR/unsupported.rs:131:1
302302
|
303303
LL | extern "cdecl-unwind" {}
@@ -309,7 +309,7 @@ LL | extern "cdecl-unwind" {}
309309
= note: `#[warn(unsupported_calling_conventions)]` on by default
310310

311311
Future breakage diagnostic:
312-
warning: use of calling convention not supported on this target
312+
warning: "cdecl" is not a supported ABI for the current target
313313
--> $DIR/unsupported.rs:120:1
314314
|
315315
LL | extern "cdecl" fn cdecl() {}

tests/ui/abi/unsupported.arm.stderr

Lines changed: 8 additions & 8 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() {}
@@ -255,7 +255,7 @@ error: aborting due to 34 previous errors; 4 warnings emitted
255255

256256
For more information about this error, try `rustc --explain E0570`.
257257
Future incompatibility report: Future breakage diagnostic:
258-
warning: use of calling convention not supported on this target
258+
warning: "cdecl" is not a supported ABI for the current target
259259
--> $DIR/unsupported.rs:123:17
260260
|
261261
LL | fn cdecl_ptr(f: extern "cdecl" fn()) {
@@ -267,7 +267,7 @@ LL | fn cdecl_ptr(f: extern "cdecl" fn()) {
267267
= note: `#[warn(unsupported_calling_conventions)]` on by default
268268

269269
Future breakage diagnostic:
270-
warning: use of calling convention not supported on this target
270+
warning: "cdecl" is not a supported ABI for the current target
271271
--> $DIR/unsupported.rs:128:1
272272
|
273273
LL | extern "cdecl" {}
@@ -279,7 +279,7 @@ LL | extern "cdecl" {}
279279
= note: `#[warn(unsupported_calling_conventions)]` on by default
280280

281281
Future breakage diagnostic:
282-
warning: use of calling convention not supported on this target
282+
warning: "cdecl-unwind" is not a supported ABI for the current target
283283
--> $DIR/unsupported.rs:131:1
284284
|
285285
LL | extern "cdecl-unwind" {}
@@ -291,7 +291,7 @@ LL | extern "cdecl-unwind" {}
291291
= note: `#[warn(unsupported_calling_conventions)]` on by default
292292

293293
Future breakage diagnostic:
294-
warning: use of calling convention not supported on this target
294+
warning: "cdecl" is not a supported ABI for the current target
295295
--> $DIR/unsupported.rs:120:1
296296
|
297297
LL | extern "cdecl" fn cdecl() {}

tests/ui/abi/unsupported.riscv32.stderr

Lines changed: 8 additions & 8 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() {}
@@ -255,7 +255,7 @@ error: aborting due to 34 previous errors; 4 warnings emitted
255255

256256
For more information about this error, try `rustc --explain E0570`.
257257
Future incompatibility report: Future breakage diagnostic:
258-
warning: use of calling convention not supported on this target
258+
warning: "cdecl" is not a supported ABI for the current target
259259
--> $DIR/unsupported.rs:123:17
260260
|
261261
LL | fn cdecl_ptr(f: extern "cdecl" fn()) {
@@ -267,7 +267,7 @@ LL | fn cdecl_ptr(f: extern "cdecl" fn()) {
267267
= note: `#[warn(unsupported_calling_conventions)]` on by default
268268

269269
Future breakage diagnostic:
270-
warning: use of calling convention not supported on this target
270+
warning: "cdecl" is not a supported ABI for the current target
271271
--> $DIR/unsupported.rs:128:1
272272
|
273273
LL | extern "cdecl" {}
@@ -279,7 +279,7 @@ LL | extern "cdecl" {}
279279
= note: `#[warn(unsupported_calling_conventions)]` on by default
280280

281281
Future breakage diagnostic:
282-
warning: use of calling convention not supported on this target
282+
warning: "cdecl-unwind" is not a supported ABI for the current target
283283
--> $DIR/unsupported.rs:131:1
284284
|
285285
LL | extern "cdecl-unwind" {}
@@ -291,7 +291,7 @@ LL | extern "cdecl-unwind" {}
291291
= note: `#[warn(unsupported_calling_conventions)]` on by default
292292

293293
Future breakage diagnostic:
294-
warning: use of calling convention not supported on this target
294+
warning: "cdecl" is not a supported ABI for the current target
295295
--> $DIR/unsupported.rs:120:1
296296
|
297297
LL | extern "cdecl" fn cdecl() {}

tests/ui/abi/unsupported.riscv64.stderr

Lines changed: 8 additions & 8 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() {}
@@ -255,7 +255,7 @@ error: aborting due to 34 previous errors; 4 warnings emitted
255255

256256
For more information about this error, try `rustc --explain E0570`.
257257
Future incompatibility report: Future breakage diagnostic:
258-
warning: use of calling convention not supported on this target
258+
warning: "cdecl" is not a supported ABI for the current target
259259
--> $DIR/unsupported.rs:123:17
260260
|
261261
LL | fn cdecl_ptr(f: extern "cdecl" fn()) {
@@ -267,7 +267,7 @@ LL | fn cdecl_ptr(f: extern "cdecl" fn()) {
267267
= note: `#[warn(unsupported_calling_conventions)]` on by default
268268

269269
Future breakage diagnostic:
270-
warning: use of calling convention not supported on this target
270+
warning: "cdecl" is not a supported ABI for the current target
271271
--> $DIR/unsupported.rs:128:1
272272
|
273273
LL | extern "cdecl" {}
@@ -279,7 +279,7 @@ LL | extern "cdecl" {}
279279
= note: `#[warn(unsupported_calling_conventions)]` on by default
280280

281281
Future breakage diagnostic:
282-
warning: use of calling convention not supported on this target
282+
warning: "cdecl-unwind" is not a supported ABI for the current target
283283
--> $DIR/unsupported.rs:131:1
284284
|
285285
LL | extern "cdecl-unwind" {}
@@ -291,7 +291,7 @@ LL | extern "cdecl-unwind" {}
291291
= note: `#[warn(unsupported_calling_conventions)]` on by default
292292

293293
Future breakage diagnostic:
294-
warning: use of calling convention not supported on this target
294+
warning: "cdecl" is not a supported ABI for the current target
295295
--> $DIR/unsupported.rs:120:1
296296
|
297297
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: 8 additions & 8 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() {}
@@ -237,7 +237,7 @@ error: aborting due to 31 previous errors; 4 warnings emitted
237237

238238
For more information about this error, try `rustc --explain E0570`.
239239
Future incompatibility report: Future breakage diagnostic:
240-
warning: use of calling convention not supported on this target
240+
warning: "cdecl" is not a supported ABI for the current target
241241
--> $DIR/unsupported.rs:123:17
242242
|
243243
LL | fn cdecl_ptr(f: extern "cdecl" fn()) {
@@ -249,7 +249,7 @@ LL | fn cdecl_ptr(f: extern "cdecl" fn()) {
249249
= note: `#[warn(unsupported_calling_conventions)]` on by default
250250

251251
Future breakage diagnostic:
252-
warning: use of calling convention not supported on this target
252+
warning: "cdecl" is not a supported ABI for the current target
253253
--> $DIR/unsupported.rs:128:1
254254
|
255255
LL | extern "cdecl" {}
@@ -261,7 +261,7 @@ LL | extern "cdecl" {}
261261
= note: `#[warn(unsupported_calling_conventions)]` on by default
262262

263263
Future breakage diagnostic:
264-
warning: use of calling convention not supported on this target
264+
warning: "cdecl-unwind" is not a supported ABI for the current target
265265
--> $DIR/unsupported.rs:131:1
266266
|
267267
LL | extern "cdecl-unwind" {}
@@ -273,7 +273,7 @@ LL | extern "cdecl-unwind" {}
273273
= note: `#[warn(unsupported_calling_conventions)]` on by default
274274

275275
Future breakage diagnostic:
276-
warning: use of calling convention not supported on this target
276+
warning: "cdecl" is not a supported ABI for the current target
277277
--> $DIR/unsupported.rs:120:1
278278
|
279279
LL | extern "cdecl" fn cdecl() {}

0 commit comments

Comments
 (0)