Skip to content

Commit 826fbad

Browse files
committed
Add Rustup installation instructions to README
Now that cranelift is distributed with Rustup, I find myself constantly searching for the rust-lang/rust#81746 PR. I think that it would be useful to also describe the Rustup installation/usage instructions here in README.
1 parent 82487a9 commit 826fbad

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

Readme.md

+28
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,34 @@ This has the potential to improve compilation times in debug mode.
55
If your project doesn't use any of the things listed under "Not yet supported", it should work fine.
66
If not please open an issue.
77

8+
## Download using Rustup
9+
The Cranelift codegen backend is now distributed in nightly builds on Linux and x86_64 macOS. If you want to
10+
install it using Rustup, you can do that by running:
11+
12+
```bash
13+
$ rustup component add rustc-codegen-cranelift-preview --toolchain nightly
14+
```
15+
16+
Once it is installed, you can enable it with one of the following approaches:
17+
- `CARGO_PROFILE_DEV_CODEGEN_BACKEND=cranelift cargo +nightly build -Zcodegen-backend`
18+
- `RUSTFLAGS="-Zcodegen-backend=cranelift" cargo +nightly build`
19+
- Add the following to `.cargo/config.toml`:
20+
```toml
21+
[unstable]
22+
codegen-backend = true
23+
24+
[profile.dev]
25+
codegen-backend = "cranelift"
26+
```
27+
- Add the following to `Cargo.toml`:
28+
```toml
29+
# This line needs to come before anything else in Cargo.toml
30+
cargo-features = ["codegen-backend"]
31+
32+
[profile.dev]
33+
codegen-backend = "cranelift"
34+
```
35+
836
## Building and testing
937

1038
```bash

0 commit comments

Comments
 (0)