Skip to content

rustc book should document the ABIs rustc supports #83151

@mcclure

Description

@mcclure

I am learning Rust. While reading the Rust reference, I learned about the interesting "ABI" feature, where extern "anystring" before a function or { } bare block containing functions will declare functions using a special ABI other than "Rust". However I found a problem, which is that there was no list of ABI strings. The reference has a partial list of ABIs but it is incomplete and does not clarify on what platforms those ABI strings are supported.

I created an issue about this on the Reference repo and after some discussion my opinion, as well as what I perceive to be the consensus in that issue thread, is that the most appropriate place to document the ABI strings would be the rustc book. (There are some ABIs already documented in the reference which are appropriate for callout in the reference— three ABIs "Rust" "C" "system" which all implementations are required to implement, and several defined ABIs that "system" is guaranteed to alias to— but other than those language-reference-required ABIs, which ABI strings are supported and what they do are implementation-defined. As rustc is an implementation [the implementation] this means that the complete list should be documented by rustc.)

However if I look in the rustc book and search the book for the word "abi", I find no discussion of the ABI strings.

Apparently people who need this information currently are consulting the Rust source directly, but I feel strongly the source is not an adequate replacement for documentation as it is difficult to find, difficult to read, and contains no details about where the ABIs are available or what they do.

My "expected behavior" is that there should be a section defining the full list of rustc's supported ABI strings in the rustc book, probably a top-level section or a subsection under section 6. For each ABI, this section should list:

  • What does the ABI do?
  • On what platforms and ISAs (x86_32 Windows, x86_64 Windows, Mac, etc) is the ABI available?
  • Is the ABI legal on function items or only extern blocks? (For example it was explained to me in the Rust reference issue that ABI "rust-intrinsic" is only allowed on extern blocks.)
  • Is support for the ABI stable or unstable? (The Rust reference does not document unstable language features because it is paired with an entire separate book documenting the unstable features, but the rustc book does not have this kind of split and has nowhere else documentation for the unstable features could go.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language team

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions