-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
docs(ref): Index differences between virtual / real manifests #13794
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
6a213f7
docs(ref): Don't call out default-members is optional
epage 0b15bef
docs(ref): Simplify default-members wording
epage 58415ff
docs(ref): Clarify default-members and members relationship
epage 2289026
docs(ref): Move default-members defalting to default-members
epage 50adf47
docs(ref): Add a caution about default-members with root package
epage 5f5e0fc
docs(ref): Index differences between virtual / real manifests
epage File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,10 +80,14 @@ edition = "2021" # the edition, will have no effect on a resolver used in th | |
authors = ["Alice <[email protected]>", "Bob <[email protected]>"] | ||
``` | ||
|
||
Note that in a virtual manifest the [`resolver = "2"`](resolver.md#resolver-versions) | ||
should be specified manually. It is usually deduced from the [`package.edition`][package-edition] | ||
field which is absent in virtual manifests and the edition field of a member | ||
won't affect the resolver used by the workspace. | ||
By having a workspace without a root package, | ||
|
||
- [`resolver`](resolver.md#resolver-versions) must be | ||
set explicitly in virtual workspaces as they have no | ||
[`package.edition`][package-edition] to infer it from | ||
[resolver version](resolver.md#resolver-versions). | ||
- Commands run in the workspace root will run against all workspace | ||
members by default, see [`default-members`](#the-default-members-field). | ||
|
||
## The `members` and `exclude` fields | ||
|
||
|
@@ -120,14 +124,12 @@ is not inside a subdirectory of the workspace root. | |
In a workspace, package-related Cargo commands like [`cargo build`] can use | ||
the `-p` / `--package` or `--workspace` command-line flags to determine which | ||
packages to operate on. If neither of those flags are specified, Cargo will | ||
use the package in the current working directory. If the current directory is | ||
a [virtual workspace](#virtual-workspace), it will apply to all members (as if | ||
`--workspace` were specified on the command-line). See also | ||
[`default-members`](#the-default-members-field). | ||
use the package in the current working directory. However, if the current directory is | ||
a workspace root, the [`default-members`](#the-default-members-field) will be used. | ||
|
||
## The `default-members` field | ||
|
||
The optional `default-members` key can be specified to set the members to | ||
The `default-members` field specifies paths of [members](#the-members-and-exclude-fields) to | ||
operate on when in the workspace root and the package selection flags are not | ||
used: | ||
|
||
|
@@ -137,7 +139,12 @@ members = ["path/to/member1", "path/to/member2", "path/to/member3/*"] | |
default-members = ["path/to/member2", "path/to/member3/foo"] | ||
``` | ||
|
||
When specified, `default-members` must expand to a subset of `members`. | ||
> Note: when a [root package](#root-package) is present, | ||
> you can only operate on it using `--package` and `--workspace` flags. | ||
|
||
When unspecified, the [root package](#root-package) will be used. | ||
In the case of a [virtual workspace](#virtual-workspace), all members will be used | ||
(as if `--workspace` were specified on the command-line). | ||
|
||
## The `package` table | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is still something missing. The doc never explains that a root package is effectively a default workspace member.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was implied in the old "Package selection" wording by saying that the package for the current working directory is used. However, I think the current wording is up for misinterpretation and I'm tweaking it in hopes that it will be less confusing.