Append ~/.rustup/toolchains/bin
to PATH when running a proxy
#3389
Labels
~/.rustup/toolchains/bin
to PATH when running a proxy
#3389
Problem you are trying to solve
I am writing a new rustc_driver tool (say it's called
foo
). I want to be able to have multiple versions, so I've put it in the toolchain directory instead of the per-user ~/.cargo/bin (which only allows a single version). Additionally, I want to be able to run it ascargo +nightly foo
, so I have acargo-foo
binary which works like cargo-clippy, setting RUSTC_WORKSPACE_WRAPPER.90% percent of this already works.
cargo +nightly foo
runs the rustup proxy, which sets RUSTUP_TOOLCHAIN and runs the correct version of cargo, which callscargo-foo
. Here's the problem:cargo-foo
is not actually in PATH. It's in/Users/jyn/.local/lib/rustup/toolchains/stage1/bin/cargo-foo
, not ~/.cargo/bin. To make this work, I have to write a thirdcargo-foo
binary to go in ~/.cargo/bin and dispatch based on RUSTUP_TOOLCHAIN.Solution you'd like
It would be really nice if rustup would add
/Users/jyn/.local/lib/rustup/toolchains/stage1/bin
to PATH so that I don't need to write this third binary. That would make it fully scoped to the toolchain directory so there's no global setup needed and I don't have to worry about differences between the proxy in different versions.Notes
Unfortunately, this has caused issues in the past; #3178 has a very good writeup. I think as long as we always append the directory to the path, so that it's only used if there's no proxy in ~/.cargo/bin, this should work ok, but it's a complicated space.
The text was updated successfully, but these errors were encountered: