Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mechanism to switch ~/.cargo/config.toml/.cargo/config.toml based on channel #4047

Open
j-n-f opened this issue Oct 13, 2024 · 0 comments
Open

Comments

@j-n-f
Copy link

j-n-f commented Oct 13, 2024

Problem you are trying to solve

There are some options I like to enable globally when using cargo (via cargo's config.toml):

  1. rustflags = ["-C", "link-arg=-fuse-ld=/usr/sbin/mold"] (for all channels)
  2. rustflags = ["-Z", "threads=<N>"] (for nightly only)

I've tried:

  1. To set RUSTFLAGS via rust-toolchain.toml (not an option)
  2. To specify channel in cargo's config.toml (not possible, cargo doesn't understand the idea of multiple toolchains)
  3. To set a .cargo/config.toml in each individual crate (inefficient, and if I decide to try using +stable in a +nightly-configured crate, I get an error)

-Z threads=<N> will eventually land in stable, but I can envision similar feature incompatibilities between the channels in the future.

Solution you'd like

Much like the cargo binary is swapped out by rustup, I'd like an option to swap out config.toml files as if I really was using a fully isolated and separate toolchain.

It could be that rustup has an equivalent location to where cargo will look for config.toml for each toolchain, but it's not clear if this file will be preserved between installation/updates/removal.

Notes

I can see a few ways to approach this, but they all have pros/cons so I'm curious to hear from rustup devs what their thoughts are.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant