@@ -1154,188 +1154,6 @@ with a warning.
11541154If you want to integrate with Cargo features, use ` -Zcheck-cfg=features ` instead of
11551155trying to do it manually with this option.
11561156
1157- ### workspace-inheritance
1158-
1159- * RFC: [ #2906 ] ( https://github.com/rust-lang/rfcs/blob/master/text/2906-cargo-workspace-deduplicate.md )
1160- * Tracking Issue: [ #8415 ] ( https://github.com/rust-lang/cargo/issues/8415 )
1161- * [ Status] ( https://github.com/rust-lang/cargo/issues/8415#issuecomment-1112618913 )
1162- * [ Example Port] ( https://github.com/clap-rs/clap/pull/3719 )
1163-
1164- ### Testing notes
1165-
1166- Target audience for testing
1167- * Maintainer who has a workspace
1168- * * (optional)* Project depends on nightly toolchain
1169-
1170- In preparing to stabilize, we are wanting to better understand
1171- * If there were any pain points in porting your project
1172- * Any errors or bugs that you found in testing
1173- * Performance concerns
1174- * Gaps in documentation
1175- * Thoughts on how you feel this feature will work in practice
1176-
1177- Please provide feedback on the [ tracking issue] ( https://github.com/rust-lang/cargo/issues/8415 )
1178- or create an issue for any bugs encountered.
1179-
1180- To get started
1181- 1 . Have a (recent) nightly version installed
1182- 2 . Place ` cargo-features = ["workspace-inheritance"] ` at the top of any ` Cargo.toml ` you
1183- plan to use this feature in
1184- 3 . Create a ` [workspace.package] ` and ` [workspace.dependencies] ` in your workspace ` Cargo.toml `
1185- 4 . Move any package keys or dependencies you feel should be shared between crates to their
1186- respective workspace table
1187- 5 . Change any keys you want to inherit to ` {key}.workspace = true ` in the member ` Cargo.toml `
1188- 6 . run ` cargo +nightly check `
1189-
1190- An example port has been made [ in this PR] ( https://github.com/clap-rs/clap/pull/3719 ) as
1191- a "real-life" guide.
1192-
1193- ### The ` workspace.package ` table
1194-
1195- * Stabilization* : This would be in [ ` workspaces.md ` ] [ workspaces ] , under
1196- [ The ` workspace.metadata ` table] [ workspace-metadata-table ]
1197-
1198- The ` workspace.package ` table is where you define keys that can be
1199- inherited by members of a workspace. These keys can be inherited by
1200- defining them in the member package with ` {key}.workspace = true ` .
1201-
1202- Keys that are supported:
1203-
1204- | | |
1205- | ----------------| -----------------|
1206- | ` authors ` | ` categories ` |
1207- | ` description ` | ` documentation ` |
1208- | ` edition ` | ` exclude ` |
1209- | ` homepage ` | ` include ` |
1210- | ` keywords ` | ` license ` |
1211- | ` license-file ` | ` publish ` |
1212- | ` readme ` | ` repository ` |
1213- | ` rust-version ` | ` version ` |
1214-
1215- - ` license-file ` and ` readme ` are relative to the workspace root
1216- - ` include ` and ` exclude ` are relative to your package root
1217-
1218- Example:
1219- ``` toml
1220- # [PROJECT_DIR]/Cargo.toml
1221- [workspace ]
1222- members = [" bar" ]
1223-
1224- [workspace .package ]
1225- version = " 1.2.3"
1226- authors = [" Nice Folks" ]
1227- description = " ..."
1228- documentation = " https://example.github.io/example"
1229- ```
1230-
1231- ``` toml
1232- # [PROJECT_DIR]/bar/Cargo.toml
1233- cargo-features = [" workspace-inheritance" ]
1234-
1235- [package ]
1236- name = " bar"
1237- version.workspace = true
1238- authors.workspace = true
1239- description.workspace = true
1240- documentation.workspace = true
1241- ```
1242-
1243-
1244- ### The ` workspace.dependencies ` table
1245-
1246- The ` workspace.dependencies ` table is where you define dependencies to be
1247- inherited by members of a workspace.
1248-
1249- Specifying a workspace dependency is similar to [ package dependencies] [ specifying-dependencies ] except:
1250- - Dependencies from this table cannot be declared as ` optional `
1251- - [ ` features ` ] [ features ] declared in this table are additive with the ` features ` from ` [dependencies] `
1252-
1253- You can then [ inherit the workspace dependency as a package dependency] [ inheriting-a-dependency-from-a-workspace ]
1254-
1255- Example:
1256- ``` toml
1257- # [PROJECT_DIR]/Cargo.toml
1258- [workspace ]
1259- members = [" bar" ]
1260-
1261- [workspace .dependencies ]
1262- dep = { version = " 0.1" , features = [" fancy" ] }
1263- dep-build = " 0.8"
1264- dep-dev = " 0.5.2"
1265- ```
1266-
1267- ``` toml
1268- # [PROJECT_DIR]/bar/Cargo.toml
1269- cargo-features = [" workspace-inheritance" ]
1270-
1271- [project ]
1272- name = " bar"
1273- version = " 0.2.0"
1274-
1275- [dependencies ]
1276- dep = { workspace = true , features = [" dancy" ] }
1277-
1278- [build-dependencies ]
1279- dep-build.workspace = true
1280-
1281- [dev-dependencies ]
1282- dep-dev.workspace = true
1283- ```
1284-
1285- [ inheriting-a-dependency-from-a-workspace ] : #inheriting-a-dependency-from-a-workspace
1286- [ workspace-metadata-table ] : workspaces.md#the-workspacemetadata-table
1287- [ workspaces ] : workspaces.md
1288-
1289-
1290- ### Inheriting a dependency from a workspace
1291-
1292- * Stabilization* : This would be in [ ` specifying-dependencies.md ` ] [ specifying-dependencies ] ,
1293- under [ Renaming dependencies in Cargo.toml] [ renaming-dependencies-in-cargotoml ]
1294-
1295- Dependencies can be inherited from a workspace by specifying the
1296- dependency in the workspace's [ ` [workspace.dependencies] ` ] [ workspace.dependencies ] table.
1297- After that add it to the ` [dependencies] ` table with ` dep.workspace = true ` .
1298-
1299- The ` workspace ` key can be defined with:
1300- - [ ` optional ` ] [ optional ] : Note that the` [workspace.dependencies] ` table is not allowed to specify ` optional ` .
1301- - [ ` features ` ] [ features ] : These are additive with the features declared in the ` [workspace.dependencies] `
1302-
1303- The ` workspace ` key cannot be defined with:
1304-
1305- | | |
1306- | ------------------| --------------------|
1307- | ` branch ` | ` default-features ` |
1308- | ` git ` | ` package ` |
1309- | ` path ` | ` registry ` |
1310- | ` registry-index ` | ` rev ` |
1311- | ` tag ` | ` version ` |
1312-
1313-
1314- Dependencies in the ` [dependencies] ` , ` [dev-dependencies] ` , ` [build-dependencies] ` , and
1315- ` [target."...".dependencies] ` sections support the ability to reference the
1316- ` [workspace.dependencies] ` definition of dependencies.
1317-
1318- Example:
1319- ``` toml
1320- [dependencies ]
1321- dep.workspace = true
1322- dep2 = { workspace = true , features = [" fancy" ] }
1323- dep3 = { workspace = true , optional = true }
1324- dep4 = { workspace = true , optional = true , features = [" fancy" ] }
1325-
1326- [build-dependencies ]
1327- dep-build.workspace = true
1328-
1329- [dev-dependencies ]
1330- dep-dev.workspace = true
1331- ```
1332-
1333- [ features ] : features.md
1334- [ optional ] : features.md#optional-dependencies
1335- [ workspace.dependencies ] : #the-workspacedependencies-table
1336- [ specifying-dependencies ] : specifying-dependencies.md
1337- [ renaming-dependencies-in-cargotoml ] : specifying-dependencies.md#renaming-dependencies-in-cargotoml
1338-
13391157## Stabilized and removed features
13401158
13411159### Compile progress
0 commit comments