Files
rust/compiler/rustc_public
Jonathan Brouwer e1b8be29ff Rollup merge of #160859 - Jamesbarford:feat/fb16-pt1, r=folkertdev,tgross35
`core::num::f16b` Rust's 16bit Brain Float

Implements the [RFC: f16b type](https://github.com/rust-lang/rfcs/pull/3983). Best reviewed commit by commit, happy to split into separate PRs if that is deemed easier to review. However the line count and surface area is, in my opinion, reasonably small.

Adds;
- ABI plumbing for the `f16b` along with `bfloat` lang item to work with LLVM, GCC is explicitly `unimplemented!(...)`
- `f16b` feature gate, page for `f16b` on libruscdoc and a `struct bf16` in `core::num`
- Tests
- Treat `f16b` as a scalar primitive for scalable vectors

Issues;
- [Tracking Issue](https://github.com/rust-lang/rust/issues/160630)
- [RFC](https://github.com/rust-lang/rfcs/pull/3983)
2026-09-21 15:19:23 +02:00
..

This crate is currently developed in-tree together with the compiler.

Our goal is to start publishing rustc_public into crates.io. Until then, users will use this as any other rustc crate, by installing the rustup component rustc-dev, and declaring rustc-public as an external crate.

See the rustc_public "Getting Started" guide for more information.

Design

The rustc_public crate will follow a similar approach to proc-macro2. Its implementation is split between two main crates:

  • rustc_public: Public crate, to be published on crates.io, which will contain the "stable" data structure as well as calls to rustc_public_bridge APIs. The translation between public and internal constructs is also done in this crate.
  • rustc_public_bridge: This crate implements the public APIs to the compiler. It is responsible for gathering all the information requested, and providing the data in its unstable internal form.

I.e., tools will depend on rustc_public crate, which will invoke the compiler using APIs defined in rustc_public_bridge.

I.e.:

    ┌────────────────────────────┐           ┌───────────────────────────┐
    │      External Tool         │           │         Rust Compiler     │
    │            ┌────────────┐  │           │ ┌────────┐                │
    │            │            │  │           │ │        │                │
    │            │rustc_public│  │           │ │rustc   │                │
    │            │            │  ├──────────►| │public  │                │
    │            │            │  │◄──────────┤ │bridge  │                │
    │            │            │  │           │ │        │                │
    │            │            │  │           │ │        │                │
    │            └────────────┘  │           │ └────────┘                │
    └────────────────────────────┘           └───────────────────────────┘

More details can be found here: https://hackmd.io/XhnYHKKuR6-LChhobvlT-g?view