Skip to content

Commit

Permalink
Rollup merge of rust-lang#131675 - tdittr:update-unsupported-abi-mess…
Browse files Browse the repository at this point in the history
…age, r=compiler-errors

Update lint message for ABI not supported

Tracking issue: rust-lang#130260

As requested in rust-lang#128784 (review) I updated the error message.

I could also change it to be the same message as if it was a hard error on a normal function:

> "`{abi}` is not a supported ABI for the current target"

Or would that get confusing when people try to google the error message?

r? compiler-errors
  • Loading branch information
matthiaskrgr authored Oct 14, 2024
2 parents 32beeaf + b6b6c12 commit 344a4ad
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 57 deletions.
6 changes: 3 additions & 3 deletions compiler/rustc_hir_analysis/src/check/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ pub fn check_abi_fn_ptr(tcx: TyCtxt<'_>, hir_id: hir::HirId, span: Span, abi: Ab
Some(true) => (),
Some(false) | None => {
tcx.node_span_lint(UNSUPPORTED_FN_PTR_CALLING_CONVENTIONS, hir_id, span, |lint| {
lint.primary_message(
"use of calling convention not supported on this target on function pointer",
);
lint.primary_message(format!(
"the calling convention {abi} is not supported on this target"
));
});
}
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_lint_defs/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3859,7 +3859,7 @@ declare_lint! {
/// This will produce:
///
/// ```text
/// warning: use of calling convention not supported on this target on function pointer
/// warning: the calling convention `"stdcall"` is not supported on this target
/// --> $DIR/unsupported.rs:34:15
/// |
/// LL | fn stdcall_ptr(f: extern "stdcall" fn()) {
Expand Down
20 changes: 10 additions & 10 deletions tests/ui/abi/unsupported.aarch64.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
warning: use of calling convention not supported on this target on function pointer
warning: the calling convention "ptx-kernel" is not supported on this target
--> $DIR/unsupported.rs:35:15
|
LL | fn ptx_ptr(f: extern "ptx-kernel" fn()) {
Expand All @@ -14,7 +14,7 @@ error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target
LL | extern "ptx-kernel" {}
| ^^^^^^^^^^^^^^^^^^^^^^

warning: use of calling convention not supported on this target on function pointer
warning: the calling convention "aapcs" is not supported on this target
--> $DIR/unsupported.rs:49:17
|
LL | fn aapcs_ptr(f: extern "aapcs" fn()) {
Expand All @@ -29,7 +29,7 @@ error[E0570]: `"aapcs"` is not a supported ABI for the current target
LL | extern "aapcs" {}
| ^^^^^^^^^^^^^^^^^

warning: use of calling convention not supported on this target on function pointer
warning: the calling convention "msp430-interrupt" is not supported on this target
--> $DIR/unsupported.rs:71:18
|
LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) {
Expand All @@ -44,7 +44,7 @@ error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target
LL | extern "msp430-interrupt" {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: use of calling convention not supported on this target on function pointer
warning: the calling convention "avr-interrupt" is not supported on this target
--> $DIR/unsupported.rs:81:15
|
LL | fn avr_ptr(f: extern "avr-interrupt" fn()) {
Expand All @@ -59,7 +59,7 @@ error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target
LL | extern "avr-interrupt" {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^

warning: use of calling convention not supported on this target on function pointer
warning: the calling convention "riscv-interrupt-m" is not supported on this target
--> $DIR/unsupported.rs:94:17
|
LL | fn riscv_ptr(f: extern "riscv-interrupt-m" fn()) {
Expand All @@ -74,7 +74,7 @@ error[E0570]: `"riscv-interrupt-m"` is not a supported ABI for the current targe
LL | extern "riscv-interrupt-m" {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: use of calling convention not supported on this target on function pointer
warning: the calling convention "x86-interrupt" is not supported on this target
--> $DIR/unsupported.rs:116:15
|
LL | fn x86_ptr(f: extern "x86-interrupt" fn()) {
Expand All @@ -89,7 +89,7 @@ error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target
LL | extern "x86-interrupt" {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^

warning: use of calling convention not supported on this target on function pointer
warning: the calling convention "thiscall" is not supported on this target
--> $DIR/unsupported.rs:139:20
|
LL | fn thiscall_ptr(f: extern "thiscall" fn()) {
Expand All @@ -104,7 +104,7 @@ error[E0570]: `"thiscall"` is not a supported ABI for the current target
LL | extern "thiscall" {}
| ^^^^^^^^^^^^^^^^^^^^

warning: use of calling convention not supported on this target on function pointer
warning: the calling convention "stdcall" is not supported on this target
--> $DIR/unsupported.rs:170:19
|
LL | fn stdcall_ptr(f: extern "stdcall" fn()) {
Expand All @@ -123,7 +123,7 @@ LL | extern "stdcall" {}
= note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678>
= note: `#[warn(unsupported_calling_conventions)]` on by default

warning: use of calling convention not supported on this target on function pointer
warning: the calling convention "C-cmse-nonsecure-call" is not supported on this target
--> $DIR/unsupported.rs:195:21
|
LL | fn cmse_call_ptr(f: extern "C-cmse-nonsecure-call" fn()) {
Expand All @@ -132,7 +132,7 @@ LL | fn cmse_call_ptr(f: extern "C-cmse-nonsecure-call" fn()) {
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>

warning: use of calling convention not supported on this target on function pointer
warning: the calling convention "C-cmse-nonsecure-entry" is not supported on this target
--> $DIR/unsupported.rs:203:22
|
LL | fn cmse_entry_ptr(f: extern "C-cmse-nonsecure-entry" fn()) {
Expand Down
18 changes: 9 additions & 9 deletions tests/ui/abi/unsupported.arm.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
warning: use of calling convention not supported on this target on function pointer
warning: the calling convention "ptx-kernel" is not supported on this target
--> $DIR/unsupported.rs:35:15
|
LL | fn ptx_ptr(f: extern "ptx-kernel" fn()) {
Expand All @@ -14,7 +14,7 @@ error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target
LL | extern "ptx-kernel" {}
| ^^^^^^^^^^^^^^^^^^^^^^

warning: use of calling convention not supported on this target on function pointer
warning: the calling convention "msp430-interrupt" is not supported on this target
--> $DIR/unsupported.rs:71:18
|
LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) {
Expand All @@ -29,7 +29,7 @@ error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target
LL | extern "msp430-interrupt" {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: use of calling convention not supported on this target on function pointer
warning: the calling convention "avr-interrupt" is not supported on this target
--> $DIR/unsupported.rs:81:15
|
LL | fn avr_ptr(f: extern "avr-interrupt" fn()) {
Expand All @@ -44,7 +44,7 @@ error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target
LL | extern "avr-interrupt" {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^

warning: use of calling convention not supported on this target on function pointer
warning: the calling convention "riscv-interrupt-m" is not supported on this target
--> $DIR/unsupported.rs:94:17
|
LL | fn riscv_ptr(f: extern "riscv-interrupt-m" fn()) {
Expand All @@ -59,7 +59,7 @@ error[E0570]: `"riscv-interrupt-m"` is not a supported ABI for the current targe
LL | extern "riscv-interrupt-m" {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: use of calling convention not supported on this target on function pointer
warning: the calling convention "x86-interrupt" is not supported on this target
--> $DIR/unsupported.rs:116:15
|
LL | fn x86_ptr(f: extern "x86-interrupt" fn()) {
Expand All @@ -74,7 +74,7 @@ error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target
LL | extern "x86-interrupt" {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^

warning: use of calling convention not supported on this target on function pointer
warning: the calling convention "thiscall" is not supported on this target
--> $DIR/unsupported.rs:139:20
|
LL | fn thiscall_ptr(f: extern "thiscall" fn()) {
Expand All @@ -89,7 +89,7 @@ error[E0570]: `"thiscall"` is not a supported ABI for the current target
LL | extern "thiscall" {}
| ^^^^^^^^^^^^^^^^^^^^

warning: use of calling convention not supported on this target on function pointer
warning: the calling convention "stdcall" is not supported on this target
--> $DIR/unsupported.rs:170:19
|
LL | fn stdcall_ptr(f: extern "stdcall" fn()) {
Expand All @@ -108,7 +108,7 @@ LL | extern "stdcall" {}
= note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678>
= note: `#[warn(unsupported_calling_conventions)]` on by default

warning: use of calling convention not supported on this target on function pointer
warning: the calling convention "C-cmse-nonsecure-call" is not supported on this target
--> $DIR/unsupported.rs:195:21
|
LL | fn cmse_call_ptr(f: extern "C-cmse-nonsecure-call" fn()) {
Expand All @@ -117,7 +117,7 @@ LL | fn cmse_call_ptr(f: extern "C-cmse-nonsecure-call" fn()) {
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>

warning: use of calling convention not supported on this target on function pointer
warning: the calling convention "C-cmse-nonsecure-entry" is not supported on this target
--> $DIR/unsupported.rs:203:22
|
LL | fn cmse_entry_ptr(f: extern "C-cmse-nonsecure-entry" fn()) {
Expand Down
14 changes: 7 additions & 7 deletions tests/ui/abi/unsupported.i686.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
warning: use of calling convention not supported on this target on function pointer
warning: the calling convention "ptx-kernel" is not supported on this target
--> $DIR/unsupported.rs:35:15
|
LL | fn ptx_ptr(f: extern "ptx-kernel" fn()) {
Expand All @@ -14,7 +14,7 @@ error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target
LL | extern "ptx-kernel" {}
| ^^^^^^^^^^^^^^^^^^^^^^

warning: use of calling convention not supported on this target on function pointer
warning: the calling convention "aapcs" is not supported on this target
--> $DIR/unsupported.rs:49:17
|
LL | fn aapcs_ptr(f: extern "aapcs" fn()) {
Expand All @@ -29,7 +29,7 @@ error[E0570]: `"aapcs"` is not a supported ABI for the current target
LL | extern "aapcs" {}
| ^^^^^^^^^^^^^^^^^

warning: use of calling convention not supported on this target on function pointer
warning: the calling convention "msp430-interrupt" is not supported on this target
--> $DIR/unsupported.rs:71:18
|
LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) {
Expand All @@ -44,7 +44,7 @@ error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target
LL | extern "msp430-interrupt" {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: use of calling convention not supported on this target on function pointer
warning: the calling convention "avr-interrupt" is not supported on this target
--> $DIR/unsupported.rs:81:15
|
LL | fn avr_ptr(f: extern "avr-interrupt" fn()) {
Expand All @@ -59,7 +59,7 @@ error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target
LL | extern "avr-interrupt" {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^

warning: use of calling convention not supported on this target on function pointer
warning: the calling convention "riscv-interrupt-m" is not supported on this target
--> $DIR/unsupported.rs:94:17
|
LL | fn riscv_ptr(f: extern "riscv-interrupt-m" fn()) {
Expand All @@ -74,7 +74,7 @@ error[E0570]: `"riscv-interrupt-m"` is not a supported ABI for the current targe
LL | extern "riscv-interrupt-m" {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: use of calling convention not supported on this target on function pointer
warning: the calling convention "C-cmse-nonsecure-call" is not supported on this target
--> $DIR/unsupported.rs:195:21
|
LL | fn cmse_call_ptr(f: extern "C-cmse-nonsecure-call" fn()) {
Expand All @@ -83,7 +83,7 @@ LL | fn cmse_call_ptr(f: extern "C-cmse-nonsecure-call" fn()) {
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>

warning: use of calling convention not supported on this target on function pointer
warning: the calling convention "C-cmse-nonsecure-entry" is not supported on this target
--> $DIR/unsupported.rs:203:22
|
LL | fn cmse_entry_ptr(f: extern "C-cmse-nonsecure-entry" fn()) {
Expand Down
18 changes: 9 additions & 9 deletions tests/ui/abi/unsupported.riscv32.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
warning: use of calling convention not supported on this target on function pointer
warning: the calling convention "ptx-kernel" is not supported on this target
--> $DIR/unsupported.rs:35:15
|
LL | fn ptx_ptr(f: extern "ptx-kernel" fn()) {
Expand All @@ -14,7 +14,7 @@ error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target
LL | extern "ptx-kernel" {}
| ^^^^^^^^^^^^^^^^^^^^^^

warning: use of calling convention not supported on this target on function pointer
warning: the calling convention "aapcs" is not supported on this target
--> $DIR/unsupported.rs:49:17
|
LL | fn aapcs_ptr(f: extern "aapcs" fn()) {
Expand All @@ -29,7 +29,7 @@ error[E0570]: `"aapcs"` is not a supported ABI for the current target
LL | extern "aapcs" {}
| ^^^^^^^^^^^^^^^^^

warning: use of calling convention not supported on this target on function pointer
warning: the calling convention "msp430-interrupt" is not supported on this target
--> $DIR/unsupported.rs:71:18
|
LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) {
Expand All @@ -44,7 +44,7 @@ error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target
LL | extern "msp430-interrupt" {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: use of calling convention not supported on this target on function pointer
warning: the calling convention "avr-interrupt" is not supported on this target
--> $DIR/unsupported.rs:81:15
|
LL | fn avr_ptr(f: extern "avr-interrupt" fn()) {
Expand All @@ -59,7 +59,7 @@ error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target
LL | extern "avr-interrupt" {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^

warning: use of calling convention not supported on this target on function pointer
warning: the calling convention "x86-interrupt" is not supported on this target
--> $DIR/unsupported.rs:116:15
|
LL | fn x86_ptr(f: extern "x86-interrupt" fn()) {
Expand All @@ -74,7 +74,7 @@ error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target
LL | extern "x86-interrupt" {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^

warning: use of calling convention not supported on this target on function pointer
warning: the calling convention "thiscall" is not supported on this target
--> $DIR/unsupported.rs:139:20
|
LL | fn thiscall_ptr(f: extern "thiscall" fn()) {
Expand All @@ -89,7 +89,7 @@ error[E0570]: `"thiscall"` is not a supported ABI for the current target
LL | extern "thiscall" {}
| ^^^^^^^^^^^^^^^^^^^^

warning: use of calling convention not supported on this target on function pointer
warning: the calling convention "stdcall" is not supported on this target
--> $DIR/unsupported.rs:170:19
|
LL | fn stdcall_ptr(f: extern "stdcall" fn()) {
Expand All @@ -108,7 +108,7 @@ LL | extern "stdcall" {}
= note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678>
= note: `#[warn(unsupported_calling_conventions)]` on by default

warning: use of calling convention not supported on this target on function pointer
warning: the calling convention "C-cmse-nonsecure-call" is not supported on this target
--> $DIR/unsupported.rs:195:21
|
LL | fn cmse_call_ptr(f: extern "C-cmse-nonsecure-call" fn()) {
Expand All @@ -117,7 +117,7 @@ LL | fn cmse_call_ptr(f: extern "C-cmse-nonsecure-call" fn()) {
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #130260 <https://github.com/rust-lang/rust/issues/130260>

warning: use of calling convention not supported on this target on function pointer
warning: the calling convention "C-cmse-nonsecure-entry" is not supported on this target
--> $DIR/unsupported.rs:203:22
|
LL | fn cmse_entry_ptr(f: extern "C-cmse-nonsecure-entry" fn()) {
Expand Down
Loading

0 comments on commit 344a4ad

Please sign in to comment.