-
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
Add x {check,build,doc} {compiler,library}
aliases.
#95504
Conversation
While working on rust-lang#95503, I realized that this will interfere with existing command lines: Currently people run `x build library/std` expecting it to be added to the sysroot, but after that change, it will *only* build `libstd` without making it available for the toolchain. It's debatable whether that's a breaking change that will be accepted; if so, this PR is absolutely necessary to make sure there's a command for "build the standard library and add it to the sysroot". Even if not, though, I think `x build library` is more clear about what actually happens than the current `x build library/std`. For consistency, also add support for `compiler` and all other command variants. Note that `doc compiler` was already supported, so in a sense this is just fixing an existing inconsistency. I plan to change the dev-guide and various instructions in the README to `build library` once this is merged.
(rust-highfive has picked a reviewer for you, use r? to override) |
x {check,build,doc} {compiler/library}
aliases.x {check,build,doc} {compiler,library}
aliases.
Would it make sense to add a |
@mark-i-m |
What is different that surprises you? |
@jyn514 This... |
It's not clear to me why we can't make crates available in the sysroot as they get built (effectively), rather than at the end of a given step. x.py build library/std making core, alloc, and std available in the sysroot but not building proc_macro and test seems fine to me, for example. I'm not sure there's a rationale I can put my finger on yet but supporting the sub-workspace aliases (library, compiler) feels off to me (including where they're available today). I think the primary reason here is that conceptually there's no such concept at the Cargo level, whereas library/std maps to a Cargo understood concept (a crate). That feels to some extent like rationale in search of rationale rather than a good reason though, so it's something I want to think more on. It also dilutes the current mapping of "what paths can I use" to some extent, though that's maybe OK too. It sounds like the expected motivation here is likely addressed by instead making library/std map to "std and into sysroot", which seems more logical and easily explainable to me, and I would hope isn't actually that hard. So maybe we can just close this PR? Happy to hear objections or thoughts on any of the above. |
Ooh, this is an excellent idea! It solves my original problem completely and it also seems like the intuitive behavior :) I'll do that regardless of whether we add the new aliases or not.
Another main motivation I had was making commands more consistent. Right now, these work:
and these break:
It looks like nothing uses I also find it strange that
@rustbot ready |
Yeah, this is confusing and unfortunate. I don't think where there are and aren't aliases for the 'directories' was picked intentionally; it may make sense to add library and compiler throughout as roots for those respective trees. At the same time, at least for compiler, it probably makes sense to actually attach that to "fully assemble" rather than just building (i.e., copy bin/rustc). I guess maybe that's implicit -- I forget how our assembling works precisely today. I think the doc vs. check/build deviation is somewhat of a question of character -- for build and check, you don't really have any choice to build "up to" that crate (in the crate graph). For doc, you can build docs for any given crate (right?), you don't need the dependencies documented too. I'm not well-versed enough in generating docs locally (I've very rarely done it) so it's hard for me to gauge whether the expectation there is met. My intuition is that most folks generating docs locally are doing so after editing them, not to view docs "in general", which implies that the by-crate behavior there is the correct one, and maybe a reasonable thing to deviate from build/check with. I think my opinion is that I'm not really sure here and am willing to here a concrete proposal, but my current thinking is to do this:
This unifies things for the most part and I think works out OK -- and corresponds(?) to the behavior you'd get from native Cargo with What do you think about this? Definitely not feeling extremely strong about it myself, very open to changing it. |
This is true, yes. You still have to check the dependencies, but rustdoc can't emit metadata and so the only difference is whether it will generate relative links to the dependencies or not.
👍 yup,
Yes, exactly! This is how #95503 works under the hood, it's just passing I like your suggestion to unify the behavior! I think that will be the end behavior after #95503 :) but I'll make sure to test in that PR.
That's what I've implemented here, I think. If you want, I can wait to merge it until #95503 lands - don't have a strong opinion on the ordering. @rustbot ready |
I haven't looked at the code just now, but at least the PR description needs to be updated (probably easiest to copy my proposal comment - since it sounds like that's the end state). Particularly want to avoid the sysroot no-copy line since that'll be confusing looking back on it. Presuming code is good and implements (as you say) proposed unification, I see no reason not to merge this before the other PR that makes it more necessary. |
Thanks, done. |
@bors r+ I think we can leave install to future work (and probably just not touch it). |
📌 Commit 9f38ce0 has been approved by |
…askrgr Rollup of 5 pull requests Successful merges: - rust-lang#94893 (diagnostics: regression test for `<usize as Iterator>::rev`) - rust-lang#95504 (Add `x {check,build,doc} {compiler,library}` aliases.) - rust-lang#96237 (compiletest: combine `--*-python` args) - rust-lang#96303 (Improve bootstrap tests) - rust-lang#96352 (Improve span for `consider adding an explicit lifetime bound` suggestions under NLL) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
While working on #95503, I realized that it will interfere with existing command lines:
Currently people run
x build library/std
expecting it to "add all library crates to the sysroot",but after that change, it will only build
libstd
and its dependencies (and add them to the sysroot), not libtest or libproc_macro.That will work for local testing in most cases, but could be confusing. Even if not, though, I think
x build library
is more clear about what actually happens than the currentx build library/std
.The intended end goal is something like:
x.py build library
). Addx {check,build,doc} {compiler,library}
aliases. #95504Note that this is already implemented today for the
doc
command and seems to work pretty well in practice.I plan to change the dev-guide and various instructions in the README to
build library
once this is merged.@rustbot label +A-rustbuild