-
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
Use a separate workspace for the library crates #76533
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
I can confirm that running |
So you can mark this as closing #76446. |
|
Oh ... it still breaks in library/std though.
Do you know why it's not using the same Cargo.toml in both? |
Do vendored builds still work? I would think that'd need changes too. That's important for dist-src tarballs, for distros to do offline builds. |
Maybe it just needs Lines 1115 to 1124 in b4bdc07
|
☔ The latest upstream changes (presumably #76558) made this pull request unmergeable. Please resolve the merge conflicts. Note that reviewers usually do not review pull requests until merge conflicts are resolved! Once you resolve the conflicts, you should change the labels applied by bors to indicate that your PR is ready for review. Post this as a comment to change the labels:
|
74c1978
to
30488fb
Compare
I fixed tidy and vendoring should now also work. (not tested) |
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
It would be good to get a diff of the updated dependencies, since std/test dependencies should undergo somewhat careful review on updates, as they're getting linked into every Rust program out there. I think you can probably do that by diffing cargo metadata output? I'm not sure if that's the best way though. I am hesitant to approve this without such a diff, though. Alternatively we can check what would happen in the current master workspace on a |
The updated dependencies are: -"cc 1.0.58"
+"cc 1.0.59"
-"libc 0.2.74"
+"libc 0.2.76"
-"ppv-lite86 0.2.8"
+"ppv-lite86 0.2.9" (I used |
It might be better to land this without the updates and land the updates separately? cargo update -p cc --precise 1.0.58
cargo update -p libc --precise 0.2.74
cargo update -p ppv-lite86 --precise 0.2.8 |
Those all look benign to me. We switch to a single workspace in #37016, but I think that was done as part of the (more important) move to This needs to update dist.rs to also copy the library/Cargo.lock I think, or at least some inspection of whether we're copying the right Cargo.lock is needed (maybe we're copying an extra one). It should be fairly quick to build that tarball locally with Please also squash commits into one. |
Can you add a clear description to the PR comment why this change is being made? This seems like a very major change that is likely to have a wide impact (and potentially break things). I also feel like this is going in the opposite direction that workspaces should go, so I'm not sure I fully understand why it is being done. Some things that will be more difficult with this:
As Mark mentioned, this will break the rust-src component. |
Quoting the comment mentioned in the PR description:
|
The whole |
That doesn't say why, other than Mark thinks it is a good idea. What are the technical reasons for the change? What does it enable or fix? |
Workspaces are to share compiled dependencies between crates. Bootstrap actually tried to prevents dependencies included through libstd and through rustc from getting the same filename in order to prevent conflicts due to it being able to include a crate using the sysroot and as a regular dependency. |
This is mostly because I didn't quite understand all the logic. Tidy already tries to handle runtime and rustc dependencies differently with regard to for example allowed licenses. Having a separate
What would be the use? Also you can still depend on the standard library. There are not even additional recompilations, because as I mentioned earlier bootstrap already causes recompilation of crates used by both the standard library and the compiler. |
@ehuss I agree with you that we would ideally not do this -- it would be better to have a single workspace. AFAICT, though, Cargo's current understanding of what to build when in workspaces doesn't really make that easy. I would be fine with us patching that instead, but it means changes upstream in Cargo. The primary thing this seeks to enable is that I was also hopeful that this change is actually nice for things like -Zbuild-std because presumably that needs to manufacture a subset of the current Cargo.lock? If you feel like there's a better solution to the "different default manifests per directory" problem than multiple workspaces, then I'm all ears :) Maybe we can do most of the above with something like sub-workspaces, but my current impression is that sort of solution requires lots of design work before we can get it in rust-lang/rust. |
The intent is to possibly make the dependencies of rustc to std more explicit, simplifying the build for rustc. The intent is to also get rid of
Why does
I haven't really thought of this use case because nobody has ever mentioned it. We've been discussing nested workspaces, and this is good feedback for that. But I'm still unclear what the goals are here. Is it specifically, "while in the
It won't have an effect assuming the
Probably, we're still collecting use cases for nested workspaces, but there is very little feedback, so it is hard to guess what people would want. |
The main use case I want is #76444. Currently, |
I personally don't care much about this either way, I just feel that this PR is the only fix I'm aware of that makes cargo check for std work without teaching people -p test or similar. I don't think the average user expects to need to pass I think our best bet at guessing that the user is working on the standard library rather than the compiler (or both), i.e., a mode where we can readily provide cargo check/build/test in theory without bootstrap being involved, is precisely |
To be clear - I think it's fine for |
☔ The latest upstream changes (presumably #76561) made this pull request unmergeable. Please resolve the merge conflicts. Note that reviewers usually do not review pull requests until merge conflicts are resolved! Once you resolve the conflicts, you should change the labels applied by bors to indicate that your PR is ready for review. Post this as a comment to change the labels:
|
I think probably we should close this, and pursue a change in Cargo's workspaces that permits specifying default members for particular subdirectories. I imagine that would not be too hard to implement as default members already exist for workspaces. I think it would resolve the main concern of "cd library && cargo check" not working, right? |
If we could have |
This might help rust-analyzer with loading the sysroot because it makes both |
I am personally unwilling to drive this forward; I think while rust-analyzer and other use cases that want to resolve just the std crate graph are interesting, I am not sure this is the right solution. It also doesn't sound like it's entirely a pressing issue on the rust-analyzer side, so I am inclined to wait until it becomes one, given the added complexity in tooling here. I'm going to close this; thanks @bjorn3 for creating it, but I think I'm unprepared to accept it just now. |
We've recently realized that for rust-analyzer it would be slightly more beneficial than previously thought: https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Where.20are.20third.20party.20crates.20in.20rustc-src.3F Currently, rust-analyzer can't deal with external crates from stdlib. The most end-user visible issue is that os-specific modules like rust-analyzer ideally needs two things:
We can hack-around this by running |
Suggested by @Mark-Simulacrum in #76446 (comment)
Discussion: https://rust-lang.zulipchat.com/#narrow/stream/242791-t-infra/topic/Separating.20rustc.20and.20library.20workspaces/near/209466743
This likely updated some dependencies for the sysroot, as the
Cargo.lock
has been generated from scratch.