Custom Rust Toolchains

I recently set up a new computer and needed to create a rustup toolchain for my local build of the Rust compiler. Everytime I do this, I have to Google it so I’m leaving this here for future reference:

Linux

$ rustup toolchain link stage0 ~/code/rust/rust/build/x86_64-unknown-linux-gnu/stage0
$ rustup toolchain link stage1 ~/code/rust/rust/build/x86_64-unknown-linux-gnu/stage1
$ rustup toolchain link stage2 ~/code/rust/rust/build/x86_64-unknown-linux-gnu/stage2

macOS

$ rustup toolchain link stage0 ~/code/rust/rust/build/x86_64-apple-darwin/stage0
$ rustup toolchain link stage1 ~/code/rust/rust/build/x86_64-apple-darwin/stage1
$ rustup toolchain link stage2 ~/code/rust/rust/build/x86_64-apple-darwin/stage2

I usually put my Rust projects in ~/code/rust/ so you may need to adjust the paths for your computer.