os-rust/compiler/stable_mir
Celina G. Val 0d300ac678 Update StableMIR doc to reflect current status
We no longer use git subtree, and we have 2 different crates.
2024-09-25 10:53:10 -07:00
..
src unify dyn* coercions with other pointer coercions 2024-09-24 22:17:55 +02:00
Cargo.toml add serde derive Serialize to stable_mir 2024-06-26 11:56:01 -04:00
README.md Update StableMIR doc to reflect current status 2024-09-25 10:53:10 -07:00
rust-toolchain.toml Split out the stable part of smir into its own crate to prevent accidental usage of forever unstable things 2023-09-25 14:38:27 +00:00

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

Our goal is to start publishing stable_mir into crates.io. Until then, users will use this as any other rustc crate, via extern crate.

Stable MIR Design

The stable-mir will follow a similar approach to proc-macro2. Its implementation is done using two main crates:

  • stable_mir: Public crate, to be published on crates.io, which will contain the stable data structure as well as calls to rustc_smir APIs and translation between stable and internal constructs.
  • rustc_smir: 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 form.

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

I.e.:

    ┌──────────────────────────────────┐           ┌──────────────────────────────────┐
    │   External Tool     ┌──────────┐ │           │ ┌──────────┐   Rust Compiler     │
    │                     │          │ │           │ │          │                     │
    │                     │stable_mir| │           │ │rustc_smir│                     │
    │                     │          │ ├──────────►| │          │                     │
    │                     │          │ │◄──────────┤ │          │                     │
    │                     │          │ │           │ │          │                     │
    │                     │          │ │           │ │          │                     │
    │                     └──────────┘ │           │ └──────────┘                     │
    └──────────────────────────────────┘           └──────────────────────────────────┘

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