Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
49 changes: 23 additions & 26 deletions compiler/rustc_public/README.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,42 @@
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/rustc_public/getting-started.html)
See the rustc_public ["Getting Started"](https://rust-lang.github.io/rustc_public/getting-started.html)
guide for more information.

## Stable MIR Design
## Design

The stable-mir will follow a similar approach to proc-macro2. Its
The rustc_public will follow a similar approach to proc-macro2. Its
Comment thread
celinval marked this conversation as resolved.
Outdated
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 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 form.

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

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
Loading