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

cargo run doesn't rebuild bootstrap binaries #95141

Closed
jyn514 opened this issue Mar 20, 2022 · 7 comments
Closed

cargo run doesn't rebuild bootstrap binaries #95141

jyn514 opened this issue Mar 20, 2022 · 7 comments
Assignees
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. E-help-wanted Call for participation: Help is requested to fix this issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@jyn514
Copy link
Member

jyn514 commented Mar 20, 2022

Currently, cargo run has a big footgun: if you modify src/bootstrap/bin/rustc.rs (or rustdoc.rs), it won't be rebuilt until you manually run cargo build --bins. I tried avoiding this in #94828 by running that automatically in bootstrap, but it discards various linker arguments and environment variables that prevent people from configuring the build.

A better solution is to introduce a binary that dispatches to different main functions, like rustup. If called as bootstrap it would run the main builder; if called as rustc or rustdoc it would run the logic currently in rustc.rs / rustdoc.rs; if called by any other name it should give a hard error.

cc #94828 (comment), #94829

I am happy to help mentor this work.

@rustbot label: +A-rustbuild +C-enhancement +E-mentor +E-help-wanted

@rustbot rustbot added T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) C-enhancement Category: An issue proposing an enhancement or a PR with one. E-help-wanted Call for participation: Help is requested to fix this issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. labels Mar 20, 2022
@fee1-dead
Copy link
Member

@rustbot claim

@bstrie
Copy link
Contributor

bstrie commented Mar 22, 2022

Coming from #94828, does the solution to this involve leveraging artifact dependencies somehow? I'd be very impressed if that worked.

@jyn514
Copy link
Member Author

jyn514 commented Mar 22, 2022

No, artifact dependencies are still unstable, so bootstrap can't use them yet.

@jyn514
Copy link
Member Author

jyn514 commented Mar 22, 2022

(of course, if anyone is interested in stabilizing artifact dependencies, this would still be a fun experiment to try out ...)

@bstrie
Copy link
Contributor

bstrie commented Mar 22, 2022

Ah, I was hopeful that something like this could help to exercise artifact dependencies to get them to stable sooner. :) Is the problem that artifact dependencies are unstable, or is the problem just that bootstrap is using a version of Rust that doesn't contain support for them? I'm not generally aware of unstable features being forbidden in the compiler.

@jyn514
Copy link
Member Author

jyn514 commented Mar 22, 2022

Not in the compiler, but in bootstrap itself: #92260 (comment)
(let's please move further discussion about stable vs unstable to zulip)

@jyn514
Copy link
Member Author

jyn514 commented May 25, 2022

I am planning to add a shim binary that should make this unnecessary (see https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/bootstrap.20user.20survey/near/283897117). The shim will use a pre-downloaded bootstrap from CI, which makes the approach here unnecessary. Until I implement downloadable bootstrap, I'll just live with the broken caching locally.

@jyn514 jyn514 closed this as not planned Won't fix, can't repro, duplicate, stale May 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. E-help-wanted Call for participation: Help is requested to fix this issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants