Rustup default toolchain symlink in $RUSTUP_HOME/toolchains?

It would be useful to have a default toolchain symlink available in $RUSTUP_HOME/toolchains to add to the PATH in shell config in order to avoid needing to reload shell configuration after running rustup default <toolchain>. Instead the symlink could be changed (similar to how nix manages the environment) to point to the other toolchain, thus the existing entry in the PATH would already be pointing to the correct versions of rustc, etc.

I’m not sure about Windows, but as far as linux and macOS are concerned, this seems like it would be a fairly simple feature to implement.

Do other people think this would be a useful feature for rustup?

I can implement this if there is consensus that this feature would be useful and a patch doing this would be accepted to rustup.rs.

Your PATH shouldn’t be pointing into a toolchain directory - it should point to ~/.cargo/bin where there are binaries that route to the appropriate toolchain.

1 Like

Ah okay.

What about other components like rust-src, for use with racer though. These are not stored in the .cargo directory, thus shell config must be refreshed.

Racer automatically determines the location of the rust-src component, by calling rustc --print sysroot, which will automatically be forwarded by rustup to the correct toolchain’s rustc.

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.