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

Consider using the host beta toolchain if it already exists at the right version #76419

Open
jyn514 opened this issue Sep 6, 2020 · 14 comments
Labels
A-contributor-roadblock Area: Makes things more difficult for new contributors to rust itself C-enhancement Category: An issue proposing an enhancement or a PR with one. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@jyn514
Copy link
Member

jyn514 commented Sep 6, 2020

Currently, if you have beta installed via rustup, x.py will download it again when building for the first time. It would be great to avoid this needless download. It would also have the benefit that x.py clean wouldn't require redownloading things from the internet.

Possible implementation: try both rustc --version and rustc +beta --version; use the first that is the right version and download beta otherwise. The version should be an exact match (beta 1.xx.0, not just beta or 1.xx.0).

@jyn514 jyn514 added C-enhancement Category: An issue proposing an enhancement or a PR with one. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Sep 6, 2020
@tesuji
Copy link
Contributor

tesuji commented Sep 7, 2020

Should nightly rustc newer than beta be considered too ?

@jyn514
Copy link
Member Author

jyn514 commented Sep 7, 2020

I would prefer not because that's a silent change in behavior and you might run into bugs. If you have rustc = "..." in config.toml, though, it definitely makes sense to use that version if it exists.

@cuviper
Copy link
Member

cuviper commented Sep 9, 2020

I'm skeptical that this should be done automatically, but you can do it manually:

./configure --local-rust-root=$(rustc +beta --print=sysroot)

@jyn514
Copy link
Member Author

jyn514 commented Sep 9, 2020

It seems a waste to redownload the toolchain if it already exists, though. Glad to know it's so easy to implement!

@jyn514
Copy link
Member Author

jyn514 commented Sep 12, 2020

@matklad mentioned in https://matklad.github.io/2020/09/12/rust-in-2021.html that all of this - pinning the version and downloading automatically only if necessary - could be done by a rust-toolchain file in the root of the repository. That would make it easy to opt-out too: just delete the file.

@Mark-Simulacrum
Copy link
Member

"Just delete the file" means a permanent problem for your git status, which isn't great - but do we know why people would want to opt-out? I think it's a pretty good solution to replace (most of) stage0.txt.

@jyn514
Copy link
Member Author

jyn514 commented Sep 12, 2020

I'm not sure, @cuviper mentioned it in #76419 (comment).

@jyn514 jyn514 added the A-contributor-roadblock Area: Makes things more difficult for new contributors to rust itself label Sep 15, 2020
@jyn514
Copy link
Member Author

jyn514 commented Sep 29, 2020

One issue with rust-toolchain is I don't think it allows having separate toolchains for different components at the same time. stage0.txt uses a beta compiler but a nightly rustfmt - @kinnison, @rbtcollins, @workingjubilee is there any plan to support that? Would you take a PR implementing it?

@matklad

This comment has been minimized.

@Mark-Simulacrum

This comment has been minimized.

@rbtcollins
Copy link
Contributor

We also have a toml based overrides file coming in the next release; that documentation doesn't cover it though; I'm not sure where master docs are published at this time.

With regards the rustfmt and compiler toolchain variation; that seems like something we could discuss; though not until the toml structured overrides file has landed. I'd consider it a separate bug and something to design with thought to complications for other projects, support cost, cognitive load etc. But I suspect actually we could make a pretty nice general feature for it, as a number of rust tools rustup installs are indeed pretty separate to the toolchain as a whole.

@kinnison
Copy link
Contributor

Another option is to invoke rustfmt +nightly if that is plausible.

@jyn514
Copy link
Member Author

jyn514 commented Mar 11, 2022

Another option is to invoke rustfmt +nightly if that is plausible.

The drawback to this is it assumes you're using rustup and gives a hard error otherwise. It should still be possible to bootstrap with a standalone toolchain, it will just be slightly less user friendly.

@jyn514
Copy link
Member Author

jyn514 commented Aug 1, 2022

One issue with rust-toolchain is I don't think it allows having separate toolchains for different components at the same time. stage0.txt uses a beta compiler but a nightly rustfmt

We'll be able to side-step this altogether if we download rustfmt on HEAD from CI like I suggested in #90672 (comment) (i.e. initial_rustfmt will go away completely).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-contributor-roadblock Area: Makes things more difficult for new contributors to rust itself C-enhancement Category: An issue proposing an enhancement or a PR with one. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

No branches or pull requests

7 participants