#compiler #automatic #language #package #version #repository #rustc-abi

ra-ap-rustc_abi

Automatically published version of the package rustc_abi in the rust-lang/rust repository from commit 8417f8311fcb596030768a817e1e4eacb214b78e The publishing script for this crate lives at: https://github.com/rust-analyzer/rustc-auto-publish

73 breaking releases

new 0.89.0 Jan 5, 2025
0.88.0 Dec 29, 2024
0.87.0 Dec 22, 2024
0.80.0 Nov 24, 2024
0.20.0 Nov 21, 2023

#76 in Development tools

Download history 10130/week @ 2024-09-20 9485/week @ 2024-09-27 10711/week @ 2024-10-04 10306/week @ 2024-10-11 11132/week @ 2024-10-18 11305/week @ 2024-10-25 9762/week @ 2024-11-01 8760/week @ 2024-11-08 8757/week @ 2024-11-15 8630/week @ 2024-11-22 9974/week @ 2024-11-29 10405/week @ 2024-12-06 9580/week @ 2024-12-13 7622/week @ 2024-12-20 6818/week @ 2024-12-27 9269/week @ 2025-01-03

35,334 downloads per month
Used in 22 crates (3 directly)

MIT/Apache

290KB
6K SLoC

ABI handling for rustc

What is an "ABI"?

Literally, "application binary interface", which means it is everything about how code interacts, at the machine level, with other code. This means it technically covers all of the following:

  • object binary format for e.g. relocations or offset tables
  • in-memory layout of types
  • procedure calling conventions

When we discuss "ABI" in the context of rustc, we are probably discussing calling conventions. To describe those rustc_abi also covers type layout, as it must for values passed on the stack. Despite rustc_abi being about calling conventions, it is good to remember these usages exist. You will encounter all of them and more if you study target-specific codegen enough! Even in general conversation, when someone says "the Rust ABI is unstable", it may allude to either or both of

  • repr(Rust) types have a mostly-unspecified layout
  • extern "Rust" fn(A) -> R has an unspecified calling convention

Crate Goal

ABI is a foundational concept, so the rustc_abi crate serves as an equally foundational crate. It cannot carry all details relevant to an ABI: those permeate code generation and linkage. Instead, rustc_abi is intended to provide the interface for reasoning about the binary interface. It should contain traits and types that other crates then use in their implementation. For example, a platform's extern "C" fn calling convention will be implemented in rustc_target but rustc_abi contains the types for calculating layout and describing register-passing. This makes it easier to describe things in the same way across targets, codegen backends, and even other Rust compilers, such as rust-analyzer!

Dependencies

~0.7–1.4MB
~28K SLoC