@@ -54,20 +54,36 @@ The repository ships with `.cargo/config.toml` configured to use all available C
5454(` build.jobs = "default" ` ). You can override this locally with ` CARGO_BUILD_JOBS=8 ` (or any integer) when
5555you want a smaller build footprint.
5656
57- To enable nightly-only parallel rustc and a faster linker, set the environment variables below:
57+ Nightly-only parallel rustc is enabled by default when you use the nightly toolchain file
58+ (` rust-toolchain-nightly.toml ` ), which sets ` PLATFORM_NIGHTLY_RUSTFLAGS="-Z threads=0" ` . If you opt into
59+ nightly via ` RUSTUP_TOOLCHAIN=nightly ` or ` cargo +nightly ` , you can still enable parallel rustc by setting
60+ ` PLATFORM_NIGHTLY_RUSTFLAGS ` manually.
61+
62+ Fast linker support is opt-in via environment variables. Supported linkers:
63+
64+ - ** Linux** : ` mold ` , ` lld `
65+ - ** macOS** : ` lld ` , ` zld `
5866
5967``` bash
6068# Nightly parallel rustc (requires nightly toolchain)
6169export RUSTUP_TOOLCHAIN=nightly
6270export PLATFORM_NIGHTLY_RUSTFLAGS=" -Z threads=0"
6371
6472# Fast linker (install one of mold or lld, then select it)
65- export PLATFORM_LINKER_RUSTFLAGS=" -C link-arg=-fuse-ld=mold"
66- # export PLATFORM_LINKER_RUSTFLAGS="-C link-arg=-fuse-ld=lld"
73+ export PLATFORM_FAST_LINKER_RUSTFLAGS=" -C link-arg=-fuse-ld=mold"
74+ # export PLATFORM_FAST_LINKER_RUSTFLAGS="-C link-arg=-fuse-ld=lld"
75+
76+ # macOS linker selection
77+ # export PLATFORM_FAST_LINKER_RUSTFLAGS_DARWIN="-C link-arg=-fuse-ld=lld"
78+ # export PLATFORM_FAST_LINKER_RUSTFLAGS_DARWIN="-C link-arg=-fuse-ld=zld"
6779
6880cargo build
6981```
7082
83+ Opt out of parallel rustc by unsetting ` PLATFORM_NIGHTLY_RUSTFLAGS ` or setting it to an empty string.
84+ To override the default fast-linker flags, set ` PLATFORM_LINKER_RUSTFLAGS ` (Linux) or
85+ ` PLATFORM_LINKER_RUSTFLAGS_DARWIN ` (macOS).
86+
7187Fast linker prerequisites (Ubuntu/Debian):
7288
7389``` bash
@@ -81,14 +97,14 @@ sudo apt-get install -y lld
8197
8298CI runs stable by default. To run nightly builds/tests, trigger the workflow manually and set
8399` run_nightly=true ` in the GitHub Actions workflow dispatch input. The nightly job sets
84- ` PLATFORM_NIGHTLY_RUSTFLAGS ` and ` PLATFORM_LINKER_RUSTFLAGS ` automatically.
100+ ` PLATFORM_NIGHTLY_RUSTFLAGS ` and ` PLATFORM_FAST_LINKER_RUSTFLAGS ` automatically.
85101
86102Example for a custom CI step:
87103
88104``` bash
89105export RUSTUP_TOOLCHAIN=nightly
90106export PLATFORM_NIGHTLY_RUSTFLAGS=" -Z threads=0"
91- export PLATFORM_LINKER_RUSTFLAGS =" -C link-arg=-fuse-ld=mold"
107+ export PLATFORM_FAST_LINKER_RUSTFLAGS =" -C link-arg=-fuse-ld=mold"
92108cargo test
93109```
94110
@@ -99,7 +115,7 @@ Dockerfiles are only used for Docker-backed test harnesses. The validator runs d
99115``` bash
100116docker build \
101117 --build-arg INSTALL_FAST_LINKER=mold \
102- --build-arg PLATFORM_LINKER_RUSTFLAGS =" -C link-arg=-fuse-ld=mold" \
118+ --build-arg PLATFORM_FAST_LINKER_RUSTFLAGS =" -C link-arg=-fuse-ld=mold" \
103119 --build-arg PLATFORM_NIGHTLY_RUSTFLAGS=" -Z threads=0" \
104120 -t platform:nightly .
105121```
0 commit comments