-
Notifications
You must be signed in to change notification settings - Fork 888
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
Allow specifying multiple toolchains in rust-toolchain.toml
file, with first as default, with auto-installation for all.
#3546
Comments
@CinchBlue Hi, thanks for filing this issue! I share your usage and your concern (I even have @rbtcollins @djc what do you think? |
This proposal doesn't make sense to me, as it's not obvious how or when the |
Let me clarify this use case a bit: the intention is to tell users to install My personal suggestion for @CinchBlue is this: configure a |
I understand this much. What I don't understand is what the |
Oh, nothing more than informing the user that this My reasoning is that since there's no ideal way of expressing "we want |
If someone wants to design a system tied into the proxies, so that 'cargo fmt' and 'rustfmt' both run the correct toolchain for this multi-toolchain case, then I think we can go through a mini RFP process to figure out all the interactions. As it is I share @djc 's concern : this extra key is not coupled to any user behaviour - it is no different to documentation, except for this eager-install aspect, and I'm not sure that implicit eager-install is a good idea - outside of disconnected use, I don't understand the benefit today. And the cost is likely substantial. We are, already, on a slow path to remove implicit install completely. |
This is what I was doing before, but if you tell people to run that, you'll will inevitably end up with multiple versions of The question is where do you "canonize" the correct Rust toolchain to "pin" for a given repo? Right now, it is Right now, I manually maintain a |
@CinchBlue I understand your disappointment here and I fully recognize that the current situation should be improved. That's why I said it is a personal suggestion: it's a workaround and I'm not satisfied with sticking to it. However, I think we still need some more thinking in terms of feature design. It certainly cannot be shipped to end users in its current state. |
What is needed to get this to a workable, shippable state? Are there prior issues, threads, or lists I can see or that can be drafted here with discussion? |
I'm not aware of any prior issues/threads/lists for this, but maybe others have more context. I'm open to the idea that there should be options to enable configuring multiple toolchains in @rbtcollins I think this basically aligns with your notes in #3546 (comment)? Any thoughts/suggestions/caveats/feedback? |
Also, you can reproduce inconsistencies with this setup: $ rustup show -v
Default host: aarch64-unknown-linux-gnu
rustup home: /home/ubuntu/.rustup
installed toolchains
--------------------
nightly-2023-11-24-aarch64-unknown-linux-gnu
rustc 1.76.0-nightly (a1a37735c 2023-11-23)
nightly-2023-11-26-aarch64-unknown-linux-gnu
rustc 1.76.0-nightly (f5dc2653f 2023-11-25) # .rustfmt.toml
# Which version of the formatting rules to use. Version::One is backwards-compatible with Rustfmt 1.0.
# Other versions are only backwards compatible within a major version number.
version = "Two"
# Set a specific version of cargo-fmt for the CI
# required_version = "1.7.0"
edition = "2021"
unstable_features = true
format_generated_files = false
group_imports = "StdExternalCrate"
reorder_imports = true
imports_granularity = "Crate"
indent_style = "Block" Running |
As I've explained more in-depth in #3577 (closed as duplicate), another use case for this would be to allow switching between e.g. As for using it, rustup will resolve e.g. My initial proposed fix was adding an entry to the |
I'm not sure exactly what you mean by the |
Originally posted by @RivenSkaye in #3577 (comment) I think you're referring to the problem of compiling to multiple Windows target triples. I think this section of the user guide might help with your situation?
I don't use Windows personally, but I believe you can do all of your development work within the |
That was my initial proposed fix in the other issue; similar in idea to the proposed
Last I checked, using the GNU toolchain ended up linking in the usual MinGW libraries even on MSVC targets resulting in much bigger binaries. Running new compiles and comparisons to check rn |
Well, seems like that is an issue of the past. I'm actually getting slightly smaller binary outputs now with a negligible difference for real-world cases, which made for a pleasant surprise today. That leaves just the angles mentioned in the original question and the additional pinning multiple for CI and collaboration. Sorry for the interruptions here. For reference, the last time I checked was just before the last big GCC update hit MSYS2/MinGW64 so it has been a while. |
@RivenSkaye No worries, glad to hear that your problem is resolved! |
Mmh i have just run into this issue myself and reading this gave me an idea: [toolchain]
channel = "stable" # this is essentially the default toolchain
# channel for this component isn't specified, will use stable
[[toolchain.components]]
name = "clippy"
# channel is nightly, so nightly rust will be used for this component
[[toolchain.components]]
name = "rustfmt"
channel = "nightly" |
I imagined this more like named toolchains. Reserved names like "stable", "nightly-YYYY-MM-DD" etc. aren't allowed. Smth like this: # Default toolchain
[toolchain]
channel = "stable"
# Additional toolchain
[[toolchain.lint]]
channel = "nightly-2024-02-07" Then, it will be used this way: # Will use pinned nightly for toolchain "lint"
cargo +lint fmt |
I like this idea. I think the key name should be not the same as |
@CinchBlue The name's just a stub. Not even sure that the same key can be used as both simple entry and "list" declaration. |
I would also really love a way to specify multiple toolchains (with different names, one being the unnamed default) that are all installed (or the named ones could even be lazily installed when the name is first used). In my usecase, I have a workspace that uses stable but builds a few WASM modules using nightly since I need to use |
@djc msrv is already specified in Cargo.toml; I think something like a virtual toolchain that consults that and then uses that toolchain would be better - otherwise we'd have no source of truth for it. @juntyr for your case it seems like a rust-toolchain that specifies a nightly version that is stable for your needs, and then build everything with it, would meet your current needs. For everyone here - the path forward depends on someone sitting down and writing a spec for the desired behaviour. It needs to take into consideration the following impacts:
|
Thank you for considering my use case! While only using nightly certainly is a way to build the full project using just one toolchain, in this particular project I only want to use stable features (and e.g. rust-lang/rust#120804 has shown that just using a nightly tool chain can produce spooky side effects when some dependency crate detects it and enables nightly features based on it). Aside from the proposed multi-toolchain toml config, other solutions to my use case would be (a) a way to build everything with the nightly compiler but to deny any crate from enabling nightly features [is there a way to do this?] or (b) to link a prebuilt std with immediate panic abort so I can continue using just a stable compiler. Perhaps you know if either of those is already possible? |
Problem you are trying to solve
When running a project, often times, one wants to use
nightly
features fromrustfmt
, while also keeping astable
version for builds + deploys.Solution you'd like
Allow a second key called
[[other-toolchain]]
to specify non-default toolchains. This should be backwards-compatible with the currentrust-toolchain
format:Notes
No response
The text was updated successfully, but these errors were encountered: