Getting Started
The StableMIR APIs are currently exposed as a crate in the compiler named stable_mir
1.
This crate includes the definition of structures and methods to be stabilized,
which are expected to become the stable APIs in the compiler.
These APIs were designed to provide information about a Rust crate, including the body of functions, as well as type and layout information.
This chapter has two sections directed at different use cases.
- If you already have a crate that uses some of the Rust compiler libraries, and you are interested in migrating them to the StableMIR APIs, you can find more details about your use case at the Migrating to StableMIR section.
- If you are starting your integration with the Rust compiler via StableMIR, we recommend reading through the Initial Integration chapter.
We also include a Tips and Tricks section that is related to a few common obstacles tool writers
encounter,
that is not directly related to the stable_mir
crate and APIs.
Our repository also includes a little demo crate that
demonstrate how stable_mir
crate can be used to analyze the main function of a crate.
The latest crate documentation can be found in the nightly documentation here
We are planning to release the stable_mir
crate into crates.io in the near future.
See issue #0030 for the current release status.