This can be done by installing the nightly specified in
rust-toolchain.toml and then pointing the CARGO, RUSTC and RUSTDOC env
vars to the right executables.
By avoiding some redundant rustc calls and stripping debuginfo for
wrappers. ./y.rs build --sysroot none now runs 44% faster.
Benchmark 1: ./y_before.bin build --sysroot none
Time (mean ± σ): 2.200 s ± 0.038 s [User: 2.140 s, System: 0.653 s]
Range (min … max): 2.171 s … 2.303 s 10 runs
Benchmark 2: ./y_after.bin build --sysroot none
Time (mean ± σ): 1.528 s ± 0.020 s [User: 1.388 s, System: 0.490 s]
Range (min … max): 1.508 s … 1.580 s 10 runs
Summary
'./y_after.bin build --sysroot none' ran
1.44 ± 0.03 times faster than './y_before.bin build --sysroot none'