create a rust-toolchain.toml file with channel="nightly" when the --nightly tag is set
sorry if the title is a bit too long; but this entire issue is basically title. I have no idea how this could be handled if there is already a rust-toolchain.toml file, but I think it would be nice if a new rust-toolchain.toml file is created atleast when there isn't one present; with
[toolchain]
channel = "nightly"
Also, I would happy to create a pull request for this
That's an interesting idea. I agree that it could be useful, but I'm not sure if it's in scope for cargo-wizard. Should every Cargo tool that interacts with nightly features configure toolchain file? :thinking:
Have you seen this behavior in other similar tools?
not really sure; I've never seen a tool that creates a rust-toolchain.toml file before. But, I don't think there's any reason to use the --nightly flag, if someones not using nightly, and I think using rust-toolchain.toml file is the easiest way to do this.
Also, since this is a configuration tool, some people might expect --nightly to actually switch the project to nightly, since just switching to nightly without using any of the nightly specific features could also lead to a compile time or performance improvement.
I suppose that using the nightly options without using a nightly compiler is not useful, yeah. That being said, I use nightly in some projects, but I never used rust-toolchain.toml so far, I just use rustup override instead.
According to the rustup book lists 5 ways to change the toolchain to nightly; out of those 2 are global and 1 is temporary so the remaining options are rustup override and creating a rust-toolchain.toml file. But out of those two think creating the rust-toolchain.toml file seems the simplest option, it doesn't change anything outside of the project directory and reverting is just as simple as deleting the file.
Ok. As long as there is a way to opt-out, I'd accept a PR for this :)
if a new rust-toolchain.toml file is created atleast when there isn't one present
If the rust-toolchain.toml present, could you replace the channel with nightly ?
My problems is using cargo-wizard to generate the fast compile config, which uses mold linker and cranelift backend.
But it failed due to not found the codegen-backends
rust-toolchain.toml:
[toolchain]
channel = "nightly-2024-10-19"
failed log:
error: failed to find a codegen-backends folder in the sysroot candidates:
* /root/.rustup/toolchains/nightly-2024-10-19-x86_64-unknown-linux-gnu
* /root/.rustup/toolchains/nightly-2024-10-19-x86_64-unknown-linux-gnu
Besides,nightly-2024-10-19-x86_64-unknown-linux-gnu had installed.
rustup show
Default host: x86_64-unknown-linux-gnu
rustup home: /root/.rustup
installed toolchains
--------------------
stable-x86_64-unknown-linux-gnu
nightly-2024-03-05-x86_64-unknown-linux-gnu
nightly-2024-04-23-x86_64-unknown-linux-gnu
nightly-2024-07-02-x86_64-unknown-linux-gnu
nightly-2024-08-11-x86_64-unknown-linux-gnu
nightly-2024-09-23-x86_64-unknown-linux-gnu
nightly-2024-10-11-x86_64-unknown-linux-gnu
nightly-2024-10-19-x86_64-unknown-linux-gnu
nightly-2024-11-09-x86_64-unknown-linux-gnu
nightly-x86_64-unknown-linux-gnu (default)
stage1
active toolchain
----------------
nightly-2024-10-19-x86_64-unknown-linux-gnu (overridden by '/root/workspace/greptimedb/rust-toolchain.toml')
rustc 1.84.0-nightly (e92993dbb 2024-10-18)
Please create a separate issue about that, thanks!
Please create a separate issue about that, thanks!
I had opened a new issue here https://github.com/Kobzol/cargo-wizard/issues/25.