Skip to content

Commit e1825d5

Browse files
committed
rename stable_mir to rustc_public, and rustc_smir to rustc_public_bridge
0 parents  commit e1825d5

29 files changed

+10886
-0
lines changed

Cargo.toml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[package]
2+
name = "rustc_public"
3+
version = "0.1.0-preview"
4+
edition = "2024"
5+
6+
[dependencies]
7+
# tidy-alphabetical-start
8+
rustc_abi = { path = "../rustc_abi" }
9+
rustc_hir = { path = "../rustc_hir" }
10+
rustc_middle = { path = "../rustc_middle" }
11+
rustc_public_bridge = { path = "../rustc_public_bridge" }
12+
rustc_session = { path = "../rustc_session" }
13+
rustc_span = { path = "../rustc_span" }
14+
rustc_target = { path = "../rustc_target" }
15+
scoped-tls = "1.0"
16+
serde = { version = "1.0.125", features = [ "derive" ] }
17+
tracing = "0.1"
18+
# tidy-alphabetical-end
19+
20+
[features]
21+
# Provides access to APIs that expose internals of the rust compiler.
22+
# APIs enabled by this feature are unstable. They can be removed or modified
23+
# at any point and they are not included in the crate's semantic versioning.
24+
rustc_internal = []

README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
This crate is currently developed in-tree together with the compiler.
2+
3+
Our goal is to start publishing `stable_mir` into crates.io.
4+
Until then, users will use this as any other rustc crate, by installing
5+
the rustup component `rustc-dev`, and declaring `stable-mir` as an external crate.
6+
7+
See the StableMIR ["Getting Started"](https://rust-lang.github.io/project-stable-mir/getting-started.html)
8+
guide for more information.
9+
10+
## Stable MIR Design
11+
12+
The stable-mir will follow a similar approach to proc-macro2. Its
13+
implementation is split between two main crates:
14+
15+
- `stable_mir`: Public crate, to be published on crates.io, which will contain
16+
the stable data structure as well as calls to `rustc_smir` APIs. The
17+
translation between stable and internal constructs will also be done in this crate,
18+
however, this is currently implemented in the `rustc_smir` crate.[^translation].
19+
- `rustc_smir`: This crate implements the public APIs to the compiler.
20+
It is responsible for gathering all the information requested, and providing
21+
the data in its unstable form.
22+
23+
[^translation]: This is currently implemented in the `rustc_smir` crate,
24+
but we are working to change that.
25+
26+
I.e.,
27+
tools will depend on `stable_mir` crate,
28+
which will invoke the compiler using APIs defined in `rustc_smir`.
29+
30+
I.e.:
31+
32+
```
33+
┌──────────────────────────────────┐ ┌──────────────────────────────────┐
34+
│ External Tool ┌──────────┐ │ │ ┌──────────┐ Rust Compiler │
35+
│ │ │ │ │ │ │ │
36+
│ │stable_mir| │ │ │rustc_smir│ │
37+
│ │ │ ├──────────►| │ │ │
38+
│ │ │ │◄──────────┤ │ │ │
39+
│ │ │ │ │ │ │ │
40+
│ │ │ │ │ │ │ │
41+
│ └──────────┘ │ │ └──────────┘ │
42+
└──────────────────────────────────┘ └──────────────────────────────────┘
43+
```
44+
45+
More details can be found here:
46+
https://hackmd.io/XhnYHKKuR6-LChhobvlT-g?view

rust-toolchain.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[toolchain]
2+
channel = "nightly-2023-06-14"
3+
components = [ "rustfmt", "rustc-dev" ]

0 commit comments

Comments
 (0)