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

Add "resolver = 2" option to workspace manifest examples #10625

Closed
wants to merge 5 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/doc/src/reference/workspaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,13 @@ you want to keep all the packages organized in separate directories.
# [PROJECT_DIR]/Cargo.toml
[workspace]
members = ["hello_world"]
resolver = "2"
```

The [`resolver`] key here effects how a package that is depended on in multiple
ways with different features are resolved. Some libraries depend on it being
set to 2.
Comment on lines +74 to +76
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd recommend shifting the focus to fit within this section. We delegate explanation of the field to the resolver page.

Something like

Without a root package to fall back on, the [`resolver`] field should be set in the `[workspace]` table.

(at first I was worried this was too strong of a recommendation but it is roughly what the resolver page says)


```toml
# [PROJECT_DIR]/hello_world/Cargo.toml
[package]
Expand All @@ -78,6 +83,7 @@ version = "0.1.0" # the current version, obeying semver
authors = ["Alice <[email protected]>", "Bob <[email protected]>"]
```


Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove

### The `members` and `exclude` fields

The `members` and `exclude` fields define which packages are members of
Expand All @@ -101,6 +107,8 @@ workspace. This can be useful if some path dependencies aren't desired to be
in the workspace at all, or using a glob pattern and you want to remove a
directory.

### Workspace selection

Comment on lines +110 to +111
Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove

When inside a subdirectory within the workspace, Cargo will automatically
search the parent directories for a `Cargo.toml` file with a `[workspace]`
definition to determine which workspace to use. The [`package.workspace`]
Expand Down Expand Up @@ -128,6 +136,7 @@ used:
[workspace]
members = ["path/to/member1", "path/to/member2", "path/to/member3/*"]
default-members = ["path/to/member2", "path/to/member3/foo"]
resolver = "2"
Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove

```

When specified, `default-members` must expand to a subset of `members`.
Expand Down Expand Up @@ -225,6 +234,7 @@ configuration in `Cargo.toml`. For example:
```toml
[workspace]
members = ["member1", "member2"]
resolver = "2"
Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove


[workspace.metadata.webcontents]
root = "path/to/webproject"
Expand All @@ -243,6 +253,7 @@ if that makes sense for the tool in question.
[`Cargo.lock`]: ../guide/cargo-toml-vs-cargo-lock.md
[package-metadata]: manifest.md#the-metadata-table
[output directory]: ../guide/build-cache.md
[`resolver`]: resolver.md#feature-resolver-version-2
[patch]: overriding-dependencies.md#the-patch-section
[replace]: overriding-dependencies.md#the-replace-section
[profiles]: profiles.md
Expand Down