Skip to content

Commit fc200e4

Browse files
committed
docs: raise awareness of resolver used inside workspace
Workspaces by default use the resolver in version 1. It's been some time already since the 2021 edition which made version 2 a default for the alone packages, but yet most of the projects that make a use of the workspaces still depends on an old resolver. By being explicit about the resolver tag inside the workspace we can lower the usage of older resolver for the new projects.
1 parent b40be8b commit fc200e4

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/doc/src/reference/workspaces.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ To create a workspace, you add the `[workspace]` table to a `Cargo.toml`:
3939

4040
At minimum, a workspace has to have a member, either with a root package or as
4141
a virtual manifest.
42+
It's also a good practice to specify the `resolver = "2"` unless it is necessary
43+
to rely on the old one. It is a default resolver for all packages in the `2021` edition
44+
but it has to be explicitely set under the workspace.
4245

4346
#### Root package
4447

@@ -49,6 +52,7 @@ where the workspace's `Cargo.toml` is located.
4952

5053
```toml
5154
[workspace]
55+
resolver = "2"
5256

5357
[package]
5458
name = "hello_world" # the name of the package
@@ -67,6 +71,7 @@ you want to keep all the packages organized in separate directories.
6771
# [PROJECT_DIR]/Cargo.toml
6872
[workspace]
6973
members = ["hello_world"]
74+
resolver = "2"
7075
```
7176

7277
```toml
@@ -86,6 +91,7 @@ the workspace:
8691
[workspace]
8792
members = ["member1", "path/to/member2", "crates/*"]
8893
exclude = ["crates/foo", "path/to/other"]
94+
resolver = "2"
8995
```
9096

9197
All [`path` dependencies] residing in the workspace directory automatically
@@ -127,6 +133,7 @@ used:
127133
[workspace]
128134
members = ["path/to/member1", "path/to/member2", "path/to/member3/*"]
129135
default-members = ["path/to/member2", "path/to/member3/foo"]
136+
resolver = "2"
130137
```
131138

132139
When specified, `default-members` must expand to a subset of `members`.
@@ -158,6 +165,7 @@ Example:
158165
# [PROJECT_DIR]/Cargo.toml
159166
[workspace]
160167
members = ["bar"]
168+
resolver = "2"
161169

162170
[workspace.package]
163171
version = "1.2.3"
@@ -192,6 +200,7 @@ Example:
192200
# [PROJECT_DIR]/Cargo.toml
193201
[workspace]
194202
members = ["bar"]
203+
resolver = "2"
195204

196205
[workspace.dependencies]
197206
cc = "1.0.73"
@@ -224,6 +233,7 @@ configuration in `Cargo.toml`. For example:
224233
```toml
225234
[workspace]
226235
members = ["member1", "member2"]
236+
resolver = "2"
227237

228238
[workspace.metadata.webcontents]
229239
root = "path/to/webproject"

0 commit comments

Comments
 (0)