Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Stable MIR Librarification Project Group
# Rustc Librarification Project Group (formerly Stable MIR)

<!--
Status badge advertising the project as being actively worked on. When the
Expand All @@ -15,14 +15,17 @@
relevant links to information about your group.
-->

Welcome to the repository for the Stable MIR Librarification Project Group! Our goal is to provide a stable
Welcome to the repository for the Rustc Librarification Project Group! Our goal is to provide a SemVer compliant
API based on the rust compiler mid-level intermediate representation (MIR) that can be used as the foundation
for development of tools that want to perform sophisticated analyses and make stronger guarantees about the
behavior of Rust programs.

To avoid confusion, we have renamed our project and our crates to `rustc_public` to better reflect our goal of providing
a public, SemVer compliant interface rather than a completely stable API.

This is the repository we use to organise and document our work.

If you are wondering how to use Stable MIR in your project, please check out the [Getting Started][tutorial] chapter.
If you are wondering how to use rustc_public in your project, please check out the [Getting Started][tutorial] chapter.

[gh-pages]: https://rust-lang.github.io/project-stable-mir

Expand Down
2 changes: 1 addition & 1 deletion book/book.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[book]
title = "Stable MIR Librarification Project"
title = "Rustc Librarification Project (formerly Stable MIR)"
language = "en"

[output.html]
Expand Down
14 changes: 7 additions & 7 deletions book/src/getting-started.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Getting Started

The StableMIR APIs are currently exposed as a crate in the compiler named `stable_mir`[^release].
This crate includes the definition of structures and methods to be stabilized,
which are expected to become the stable APIs in the compiler.
The supported APIs are currently exposed as a crate in the compiler named `rustc_public`[^release].
This crate includes the definition of structures and methods to provide a SemVer compliant interface,
which are expected to become the public 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.
Expand All @@ -17,13 +17,13 @@ This chapter has two sections directed at different use cases.

We also include a [Tips and Tricks](./tricks.md) section that is related to a few common obstacles tool writers
encounter,
that is not directly related to the `stable_mir` crate and APIs.
that is not directly related to the `rustc_public` crate and APIs.

Our repository also includes a little [demo crate](https://github.com/rust-lang/project-stable-mir/tree/main/demo) that
demonstrate how `stable_mir` crate can be used to analyze the main function of a crate.
demonstrate how `rustc_public` crate can be used to analyze the main function of a crate.

The latest crate documentation can be found in the
[nightly documentation here](https://doc.rust-lang.org/nightly/nightly-rustc/stable_mir/index.html)
[nightly documentation here](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_public/index.html)

[^release]: We are planning to release the `stable_mir` crate into crates.io in the near future.
[^release]: We are planning to release the `rustc_public` crate into crates.io in the near future.
See issue [#0030](https://github.com/rust-lang/project-stable-mir/issues/30) for the current release status.
2 changes: 1 addition & 1 deletion book/src/initial.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,4 @@ TODO

TODO

[`demo/`](https://github.com/rust-lang/project-stable-mir/tree/main/demo)
[`demo/`](https://github.com/rust-lang/project-stable-mir/tree/main/demo)
41 changes: 19 additions & 22 deletions rustc_public/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
This crate is currently developed in-tree together with the compiler.

Our goal is to start publishing `stable_mir` into crates.io.
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 `stable-mir` as an external crate.
the rustup component `rustc-dev`, and declaring `rustc-public` as an external crate.

See the StableMIR ["Getting Started"](https://rust-lang.github.io/project-stable-mir/getting-started.html)
guide for more information.
Expand All @@ -12,34 +12,31 @@ guide for more information.
The stable-mir will follow a similar approach to proc-macro2. Its
implementation is split between 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. The
translation between stable and internal constructs will also be done in this crate,
however, this is currently implemented in the `rustc_smir` crate.[^translation].
- `rustc_smir`: This crate implements the public APIs to the compiler.
- `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 stable 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 form.

[^translation]: This is currently implemented in the `rustc_smir` crate,
but we are working to change that.

I.e.,
tools will depend on `stable_mir` crate,
which will invoke the compiler using APIs defined in `rustc_smir`.
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 │
│ │ │ │ │ │ │ │
│ │stable_mir| │ │ │rustc_smir│ │
│ │ │ ├──────────►| │ │ │
│ │ │ │◄──────────┤ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ └──────────┘ │ │ └──────────┘ │
└──────────────────────────────────┘ └──────────────────────────────────┘
┌────────────────────────────┐ ┌───────────────────────────┐
│ External Tool │ │ Rust Compiler │
│ ┌────────────┐ │ │ ┌────────┐ │
│ │ │ │ │ │ │ │
│ │rustc_public│ │ │ │rustc │ │
│ │ │ ├──────────►| │public │ │
│ │ │ │◄──────────┤ │bridge │ │
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ └────────────┘ │ │ └────────┘ │
└────────────────────────────┘ └───────────────────────────┘
```

More details can be found here:
Expand Down
Loading