Skip to content

Conversation

nnethercote
Copy link
Contributor

It lets us avoid a lot of repetition of crate versions, etc.

I've just done a few as a start. Many more can be done in follow-ups.

r? @Kobzol

@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) A-compiletest Area: The compiletest test runner A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) A-testsuite Area: The testsuite used to check the correctness of rustc A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic PG-exploit-mitigations Project group: Exploit mitigations S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustfmt Relevant to the rustfmt team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Aug 22, 2025
@rustbot
Copy link
Collaborator

rustbot commented Aug 22, 2025

Some changes occurred in src/tools/rustfmt

cc @rust-lang/rustfmt

rustc_error_messages was changed

cc @davidtwco, @compiler-errors, @TaKO8Ki

This PR changes rustc_public

cc @oli-obk, @celinval, @ouz-a

Some changes occurred in compiler/rustc_attr_parsing

cc @jdonszelmann

Some changes occurred in compiler/rustc_codegen_ssa

cc @WaffleLapkin

Some changes occurred in exhaustiveness checking

cc @Nadrieril

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

The Miri subtree was changed

cc @rust-lang/miri

Some changes occurred in src/tools/compiletest

cc @jieyouxu

Some changes occurred in compiler/rustc_sanitizers

cc @rcvalle

@rustbot

This comment has been minimized.

@Kobzol
Copy link
Member

Kobzol commented Aug 26, 2025

I think that this is a good idea that could help reduce our overall dependency count. If you remove the subtree changes, I'll r+ it.

@rustbot
Copy link
Collaborator

rustbot commented Aug 27, 2025

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@nnethercote
Copy link
Contributor Author

I think that this is a good idea that could help reduce our overall dependency count.

How would it reduce our dependency count? AFAIK the benefit is avoiding repetition.

If you remove the subtree changes, I'll r+ it.

I have done this. In case it helps, here are the submodules (edited output from git submodule):

library/backtrace (0.3.75-44-gb65ab93)
src/doc/book (one-book-to-rule-them-all-2909-g3e9dc46a)
src/doc/edition-guide (remotes/origin/HEAD)
src/doc/embedded-book (remotes/origin/HEAD)
src/doc/nomicon (remotes/origin/HEAD)
src/doc/reference (remotes/origin/HEAD)
src/doc/rust-by-example (heads/master-679-gadc1f3b)
src/gcc
src/llvm-project (remotes/origin/rustc/21.1-2025-08-01)
src/tools/cargo (0.86.0-1136-g623d53683)
src/tools/enzyme
src/tools/rustc-perf (heads/master-4965-gdde879cf1)

and here are the subtrees (edited output from git log | grep git-subtree-dir):

compiler/rustc_codegen_cranelift
compiler/rustc_codegen_gcc
compiler/rustc_smir
library/portable-simd
src/tools/clippy
src/tools/miri
src/tools/rust-analyzer
src/tools/rustfmt

@bors
Copy link
Collaborator

bors commented Aug 27, 2025

📌 Commit 200f56d has been approved by Kobzol

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 27, 2025
bors added a commit that referenced this pull request Aug 27, 2025
Rollup of 6 pull requests

Successful merges:

 - #144274 (add Option::reduce)
 - #145562 (Simplify macro generating ToString implementations for `&…&str`)
 - #145625 (improve float to_degrees/to_radians rounding comments and impl)
 - #145740 (Introduce a `[workspace.dependencies`] section in the top-level `Cargo.toml`)
 - #145885 (Inherit TCC in debuginfo tests on macOS)
 - #145905 (Stop calling unwrap when format foreign has trailing dollar)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 693d5ea into rust-lang:master Aug 27, 2025
10 checks passed
@rustbot rustbot added this to the 1.91.0 milestone Aug 27, 2025
rust-timer added a commit that referenced this pull request Aug 27, 2025
Rollup merge of #145740 - nnethercote:workspace-members, r=Kobzol

Introduce a `[workspace.dependencies`] section in the top-level `Cargo.toml`

It lets us avoid a lot of repetition of crate versions, etc.

I've just done a few as a start. Many more can be done in follow-ups.

r? `@Kobzol`
@nnethercote nnethercote deleted the workspace-members branch August 27, 2025 21:30
bors added a commit that referenced this pull request Aug 28, 2025
Add more to the `[workspace.dependencies]` section in the top-level `Cargo.toml`

Following on from #145740.

r? `@Kobzol`
Zalathar added a commit to Zalathar/rust that referenced this pull request Aug 29, 2025
…=Kobzol

Add more to the `[workspace.dependencies]` section in the top-level `Cargo.toml`

Following on from rust-lang#145740.

r? `@Kobzol`
rust-timer added a commit that referenced this pull request Aug 29, 2025
Rollup merge of #145947 - nnethercote:workspace-members-2, r=Kobzol

Add more to the `[workspace.dependencies]` section in the top-level `Cargo.toml`

Following on from #145740.

r? `@Kobzol`
@RalfJung
Copy link
Member

RalfJung commented Sep 1, 2025

and here are the subtrees (edited output from git log | grep git-subtree-dir):

FWIW this is not reliable, it'll only find git subtrees but not josh-managed subtrees. Miri and clippy show up because they used to be git subtrees.


More importantly, this PR unfortunately broke RA for people working on Miri, clippy, or anything else that uses the rustc-dev rustup package: rust-lang/rust-analyzer#20584.

@Kobzol
Copy link
Member

Kobzol commented Sep 1, 2025

Crap, I was sure that there is in fact Cargo.toml in rustc-src, in fact I even checked for it explicitly 🤔 But I realize now that I was only checking the plain source tarballs and rust-src, not rustc-src, as it is not distributed through rustup.

@RalfJung
Copy link
Member

RalfJung commented Sep 1, 2025

There's rust-src and rustc-dev, but no rustc-src. rustc-dev should be the relevant one here, and it is distributed via rustup.

@Kobzol
Copy link
Member

Kobzol commented Sep 1, 2025

impl Step for PlainSourceTarball {
rustc-rsc is the plain source tarball 🙃 The naming is really atrocious here.

@RalfJung
Copy link
Member

RalfJung commented Sep 1, 2025

Ah 🤦

@ChayimFriedman2
Copy link
Contributor

This PR also prevents now publishing of rustc crates r-a uses: https://github.com/rust-analyzer/rustc-auto-publish/actions/runs/17381310033/job/49339257240.

@nnethercote
Copy link
Contributor Author

Is it possible to keep any of the workspace stuff or does it all need to be ripped out?

@ChayimFriedman2
Copy link
Contributor

I think all of them are problematic.

Of course it's possible to make this work, but it means more work. The question is whether it is worth the effort.

@RalfJung
Copy link
Member

RalfJung commented Sep 2, 2025

For the rustc dependency usecase (making RA work with Miri/clippy/...), it should suffice to include the root Cargo.toml in the rustc-dev package -- but it can't be the original workspace Cargo.toml unchanged; it's members need to be filtered.

I don't know how the auto-publish works. I assume in general cargo supports publishing crates with workspace dependencies, and will "inline" those dependencies as part of cargo publish? The logic here does seem to download the entire source tarball as generated by github, but then for some reason moves the Cargo.toml out of the way. Sadly there's no comment explaining why. If rustc-dev has a working workspace, it might suffice to switch auto-publishing over to fetching the sources via rustup instead of directly from github.

@ChayimFriedman2
Copy link
Contributor

CC @lnicola you probably know better than me the autopublish scripts.

@nnethercote
Copy link
Contributor Author

I will just revert this change, and the related follow-ups. rust-lang/rust/ is so unlike a normal Rust project that it's not worth doing dependencies this way.

@lnicola
Copy link
Member

lnicola commented Sep 2, 2025

AIUI, we remove the workspace manifest, update the crate manifests to rename them and fix the dependencies between crates, and publishes them individually. It's a fork of a script from 8 years ago, so I guess it's just what worked, historically.

nnethercote added a commit to nnethercote/rust that referenced this pull request Sep 2, 2025
This was done in rust-lang#145740 and rust-lang#145947. It is causing problems for people
using r-a on anything that uses the rustc-dev rustup package, e.g. Miri,
clippy.

This repository has lots of submodules and subtrees and various
different projects are carved out of pieces of it. It seems like
`[workspace.dependencies]` will just be more trouble than it's worth.
bors added a commit that referenced this pull request Sep 2, 2025
…bzol

Revert introduction of `[workspace.dependencies]`.

This was done in #145740 and #145947. It is causing problems for people using r-a on anything that uses the rustc-dev rustup package, e.g. Miri, clippy.

This repository has lots of submodules and subtrees and various different projects are carved out of pieces of it. It seems like `[workspace.dependencies]` will just be more trouble than it's worth.

r? `@Kobzol`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-attributes Area: Attributes (`#[…]`, `#![…]`) A-compiletest Area: The compiletest test runner A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) A-testsuite Area: The testsuite used to check the correctness of rustc A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic PG-exploit-mitigations Project group: Exploit mitigations S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustfmt Relevant to the rustfmt team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants