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

Configuration setting to select toolchain (nightly) #8152

Closed
binkley opened this issue Apr 24, 2020 · 8 comments
Closed

Configuration setting to select toolchain (nightly) #8152

binkley opened this issue Apr 24, 2020 · 8 comments
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`

Comments

@binkley
Copy link

binkley commented Apr 24, 2020

Describe the problem you are trying to solve

I feel my issue might already be covered in another issue, or be a non-issue, however I was not able to find the right issue in GitHub. Apologies if this is a duplicate.

I would like local per-project configuration on which toolchain to use (stable, beta, nightly). I am making use of the feature macro in a particular project, and when I cd to that project, I would like to type just cargo build rather than cargo +nightly build.

Describe the solution you'd like

I am looking for a setting in ./.cargo/config for my local directory which sets the toolchain to "nightly". This may exist! However, reading https://doc.rust-lang.org/cargo/reference/config.html I did not spot a setting to configure.

Notes

My project is here: https://github.com/binkley/spikes/tree/master/rust-green-threads

@binkley binkley added the C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` label Apr 24, 2020
@ehuss
Copy link
Contributor

ehuss commented Apr 24, 2020

rustup has several override features. You can either add a rust-toolchain file or use per-directory overrides.

@Eh2406
Copy link
Contributor

Eh2406 commented Apr 24, 2020

So that is a rustup feature, not strictly a Cargo thing. You are looking for rustup override set nightly or the .toolchain file. ... and Eric beat me to it.

@binkley
Copy link
Author

binkley commented Apr 24, 2020

@ehuss Fantastic, thank you! Now cargo build works just fine.

Two requests/questions:

  • git status does not show any changes. How would one cloning a repository needing nightly builds pick this up automatically?
  • The documentation on this (https://doc.rust-lang.org/cargo/reference/config.html) does reference what you describe, but only obliquely. Could the documentation improve here? How would I improve the documentation?

@ehuss
Copy link
Contributor

ehuss commented Apr 24, 2020

git status does not show any changes. How would one cloning a repository needing nightly builds pick this up automatically?

I'm not sure I understand the question. If you add and commit a rust-toolchain file to your repository, anyone checking it out should pick it up and start using that toolchain.

Could the documentation improve here?

Yea, we have an open issue (#8058) to improve it. It is a little awkward because rustup is a completely separate tool, and not everyone uses it, so it is not directly related to cargo per se. But I'd definitely like to make the documentation clearer and more discoverable.

@binkley
Copy link
Author

binkley commented Apr 24, 2020

@ehuss I'm looking for something like a .cargo/config which I can commit to a repository. The goal would be that when one clones a git repository needing the nightly toolchain, no more effort from them is required than just cargo build.

(See #8058 on documentation)

@sfackler
Copy link
Member

sfackler commented Apr 24, 2020

I'm looking for something like a .cargo/config which I can commit to a repository. The goal would be that when one clones a git repository needing the nightly toolchain, no more effort from them is required than just cargo build.

If you add and commit a rust-toolchain file to your repository, anyone checking it out should pick it up and start using that toolchain.

@binkley
Copy link
Author

binkley commented Apr 25, 2020

@sfackler Fantastic, just what I was looking for! Thank you

@binkley binkley closed this as completed Apr 25, 2020
@brandonros
Copy link

I'm looking for something like a .cargo/config which I can commit to a repository. The goal would be that when one clones a git repository needing the nightly toolchain, no more effort from them is required than just cargo build.

If you add and commit a rust-toolchain file to your repository, anyone checking it out should pick it up and start using that toolchain.

@sfackler am I doing something wrong here? #10743

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
Projects
None yet
Development

No branches or pull requests

5 participants