Skip to content

Tracking issue for future-incompatibility lint unsupported_calling_conventions #87678

Closed
@nagisa

Description

@nagisa
Member

This is the summary issue for the unsupported_calling_conventions future-incompatibility warning and other related errors. The goal of this page is describe why this change was made and how you can fix code that is affected by it. It also provides a place to ask questions or register a complaint if you feel the change should not be made. For more information on the policy around future-compatibility warnings, see our breaking change policy guidelines.

What is the warning for?

The unsupported_calling_conventions lint is output whenever there is an use of the stdcall, fastcall, thiscall, vectorcall calling conventions (or their unwind variants) on targets that cannot meaningfully be supported for the requested target.

For example stdcall does not make much sense for a x86_64 or, more apparently, powerpc code, because this calling convention was never specified for those targets.

Historically MSVC toolchains have fallen back to the regular C calling convention for targets other than x86, but Rust doesn't really see a similar need to introduce a similar hack across many more targets. That said, for now we are keeping the fallback behavior on Windows targets, for compatibility with MSVC.

Example

extern "stdcall" fn stdcall() {}

This will produce:

warning: use of calling convention not supported on this target
  --> $DIR/unsupported.rs:39:1
   |
LL | extern "stdcall" fn stdcall() {}
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `#[warn(unsupported_calling_conventions)]` on by default
   = 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 ...

On most of the targets the behaviour of stdcall and similar calling conventions is not defined at all, but was previously accepted due to a bug in the implementation of the compiler.

Recommendations

Use #[cfg(…)] annotations to ensure that the ABI identifiers are only used in combination with targets for which the requested ABI is well specified.

When will this warning become a hard error?

At the beginning of each 6-week release cycle, the Rust compiler team will review the set of outstanding future compatibility warnings and nominate some of them for Final Comment Period. Toward the end of the cycle, we will review any comments and make a final determination whether to convert the warning into a hard error or remove it entirely.

Activity

self-assigned this
on Aug 1, 2021
added
I-prioritizeIssue: Indicates that prioritization has been requested for this issue.
on Aug 1, 2021
removed
I-prioritizeIssue: Indicates that prioritization has been requested for this issue.
on Aug 12, 2021
added this to the 1.55.0 milestone on Aug 27, 2021
Mark-Simulacrum

Mark-Simulacrum commented on Aug 27, 2021

@Mark-Simulacrum
Member

@nagisa do you think you'll get a chance to fix this before the next release? We have approximately one week before ideally all backports are in.

changed the title [-]`UNSUPPORTED_CALLING_CONVENTIONS` future compat link needs a tracking issue[/-] [+]Tracking issue for `UNSUPPORTED_CALLING_CONVENTIONS` future compatibility lint[/+] on Aug 27, 2021
added
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFC
and removed
C-bugCategory: This is a bug.
on Aug 27, 2021
added
I-prioritizeIssue: Indicates that prioritization has been requested for this issue.
on Aug 27, 2021
removed
I-prioritizeIssue: Indicates that prioritization has been requested for this issue.
on Aug 27, 2021

49 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ABIArea: Concerning the application binary interface (ABI)A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.C-future-incompatibilityCategory: Future-incompatibility lintsC-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    Status

    Idea

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @RalfJung@nagisa@tmandry@Mark-Simulacrum@apiraino

      Issue actions

        Tracking issue for future-incompatibility lint `unsupported_calling_conventions` · Issue #87678 · rust-lang/rust