-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
bootstrap: add rust-toolchain to the root directory #94830
Conversation
Helps with rust-lang#94829. This doesn't solve "bootstrap uses beta rustc but nightly rustfmt", but in practice there should be very little difference between two. Users can still override the toolchain used with `cargo +nightly` or similar.
(rust-highfive has picked a reviewer for you, use r? to override) |
I think src/tools/bump-stage0 should also adjust this file before we introduce it -- hopefully not too difficult to implement, I think we already have a toml library there. (And just hard-coding string formatting would also be fine). Can you say a little more about the expected effects of adding this? I imagine that editor tooling for example (e.g., rust-analyzer) might be better off if it was using a nightly rather than beta, since cfg(bootstrap) is typically not set in the environment and so nightly will likely work but beta may not (leading to worse autocompletion). Obviously that particular side effect, if real, is fixable by flipping the bootstrap cfg (i.e., making it cfg(next) or something). Given that we're not fully ready for users to make use of it yet (right?), it seems like adding it might be a little premature. I'm particularly uncertain about beta rustfmt - I would expect that to not work at all, as our rustfmt.toml uses unstable features (or x.py fmt, I forget). |
Indeed. Some files get formatted differently when trying to use a non-nightly rustfmt. |
👍
You're right, that's indeed an issue currently. Flipping the cfgs is one possible fix; another is to add I don't think there should be a ton of other side-effects - the only other workflow I've heard mentioned (by @ehuss) that doesn't go through x.py is running
bootstrap completely ignores rust-toolchain. This only affects people using |
@rustbot ready |
err wait I missed the part where I implement the parsing in @rustbot label: -S-waiting-on-review +S-waiting-on-author |
In that case |
oh, good point - I'll remove that :) I think I may still need to add some logic to rustbuild to download nightly rustfmt in that case actually. So @Mark-Simulacrum is right and this is premature until rustbuild manages rustfmt. |
Editor tooling should still use |
FWIW, my primary worry is in-editor rustfmt invocations. I think today people need to mostly manually override that, which should still work even after we add rust-toolchain, but it would be amazing if that just magically did the right thing. Those typically don't invoke cargo fmt I think, instead invoking rustfmt directly. |
I use tools that call things like |
I agree, and I've opened #95136 to support that in bootstrap without having to wait for rustup support. I don't think that particular issue should block this PR, since it doesn't regress anything for rustfmt. I promise to get that working before I start recommending
@ehuss can you talk a little bit more about that? What tools are you using? If they only need |
When I do weekly updates, I use a tool that calls This will come up for anyone who uses I also use cargo as-is for simple tools in the I can set a directory override to work around this. I'm just pointing out that this may be a new source of friction for some people.
In 99.9% of situations it isn't important which rustfmt is being used. I can't recall a bootstrap bump causing format changes happening within the past few years. |
We are not planning to take this path - see https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/bootstrap.20user.20survey/near/283897117. |
Helps with #94829.
This doesn't solve "bootstrap uses beta rustc but nightly rustfmt",
but in practice there should be very little difference between two.
Users can still override the toolchain used with
cargo +nightly
or similar.