Skip to content

docs(workspace): add recommended structure to members field#17166

Open
raushan728 wants to merge 1 commit into
rust-lang:masterfrom
raushan728:issues/11234
Open

docs(workspace): add recommended structure to members field#17166
raushan728 wants to merge 1 commit into
rust-lang:masterfrom
raushan728:issues/11234

Conversation

@raushan728

Copy link
Copy Markdown
Contributor

Closes #11234

@rustbot rustbot added A-documenting-cargo-itself Area: Cargo's documentation S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 2, 2026
@rustbot

rustbot commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

r? @epage

rustbot has assigned @epage.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @ehuss, @epage, @weihanglo
  • @ehuss, @epage, @weihanglo expanded to ehuss, epage, weihanglo
  • Random selection from ehuss, epage, weihanglo

Comment thread src/doc/src/reference/workspaces.md Outdated
@raushan728 raushan728 changed the title docs(workspace): add recommended structure section docs(workspace): add recommended structure subsection to members field Jul 3, 2026
@raushan728
raushan728 requested a review from weihanglo July 3, 2026 04:00
@rustbot

This comment has been minimized.

@rustbot

This comment has been minimized.

Comment thread doc/book/src/reference/workspaces.md
Comment on lines 106 to 112
typical filename glob patterns like `*` and `?`.

### Recommended structure

It is recommended to keep all member packages in a flat directory (commonly `crates/`) and use a glob pattern for the `members` field, e.g. `members = ["crates/*"]`. This makes it easy to add new members with `cargo new` / `cargo init` without editing the root manifest.

The `exclude` key can be used to prevent paths from being included in a

@epage epage Jul 22, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The framing on this feels a bit strong and "it is recommended" is passive voice.

I'm hoping mirroring what we do at https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#version-metadata would help

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated. could you check if the line wrapping good now?

Adds a recommendation block advising users to keep workspace members in a flat directory and use glob patterns.
@rustbot

rustbot commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

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.

@raushan728 raushan728 changed the title docs(workspace): add recommended structure subsection to members field docs(workspace): add recommended structure to members field Jul 24, 2026
Comment on lines +108 to +111
**Recommendation:** Keep all member packages in a flat directory (commonly `crates/`)
and use a glob pattern for the `members` field, e.g.
`members = ["crates/*"]`. This makes it easy to add new members with
`cargo new` / `cargo init` without editing the root manifest.

@epage epage Jul 24, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

People may edit the list directly. Likely better to focus on the underlying concern:

Suggested change
**Recommendation:** Keep all member packages in a flat directory (commonly `crates/`)
and use a glob pattern for the `members` field, e.g.
`members = ["crates/*"]`. This makes it easy to add new members with
`cargo new` / `cargo init` without editing the root manifest.
**Recommendation:** Keep all member packages in a flat directory (commonly `crates/`)
and use a glob pattern for the `members` field, e.g.
`members = ["crates/*"]`. This minimizes churn in maintaining the `members` list.

I'd like to include more of the thoughts from https://matklad.github.io/2021/08/22/large-rust-workspaces.html but I feel like it would overly bloat this and it might be easier to just keep this simple.

The reasons there:

  • a flat list matches the flat nature of namespaces (for now)
  • flat lists are easier to scan
  • no perfect hierarchy

The benefit you are highlighting is also a more clear cut technical one than these which makes it less up for debate.

View changes since the review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-documenting-cargo-itself Area: Cargo's documentation S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cargo init is not working great when creating a new workspace with multiple members

4 participants