rust-lang / rust-lang/rust

Tracking issue for unsupported_calling_conventions (cdecl, stdcall, fastcall)

Open
#137,018 37 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-ABI C-bug C-tracking-issue I-lang-radar O-windows T-compiler T-lang
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

View all comments

This is a tracking issue for the unsupported_calling_conventions lint. This lint warns against

  • Using extern "cdecl" on non-x86-32 targets. Use extern "C" instead, there is no difference in behavior.
  • Using extern "stdcall" or extern "fastcall" on non-x86-32 Windows targets. These ABIs are only defined for x86-32.
    • If you want to use "stdcall on x86-32-windows, C everywhere else", then use extern "system".
    • Otherwise, if you really need the same function both on x86-32 and on other targets but with a different ABI, consider using the fn_abi crate. Also we'd be interested to hear about your use-case, so please leave a comment below.

Implementation history:

Timeline:

  • This was introduced with Rust 1.89.
  • There's no timeline yet for when this will show up in cargo's future-compat reports, or be turned into a hard error. Since windows-sys needs an update to v0.60 to avoid the lint, we'll have to move really slowly here.
Original issue description

We generally accept stdcall on non-x86-32 Windows targets (while rejecting it on other non-x86-32 targets). See the discussion about this at https://github.com/rust-lang/rust/pull/86231#issuecomment-866325136 and https://github.com/rust-lang/rust/pull/86231#discussion_r663851615. However, @ChrisDenton points out that the raw-dylib feature is more strict here. That's an inconsistency that we should probably fix?

@ChrisDenton can you give an example of what exactly is being rejected by raw-dylib here?

2025-05-05: See here for the current latest proposal.

Cc @workingjubilee @rust-lang/lang @nagisa @petrochenkov

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the unsupported_calling_conventions lint description, the implementation history in PR #141435, and the linked raw-dylib discussion. Compare the stated cdecl, stdcall, and fastcall behavior with the current proposal; done means resolving the documented inconsistency and agreeing on the future lint or error timeline.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.