Skip to content

Commit 928561a

Browse files
committed
Auto merge of #11135 - Muscraft:remove-ref-to-project, r=weihanglo
Reduce references to `[project]` within cargo There was an issue (#11129) with `[project]` being put in the docs but nothing else stating what `[project]` is. This was an oversight by me when writing the docs as `[project]` is still supported in cargo. [Back in 2014](86b2a2a) `[project]` was [renamed to `[package]`](#3388 (comment)), since then it has kinda sat as something that exists and is supported but not really. I brought this up in a [zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/removal.20of.20.60.5Bproject.5D.60), and it was suggested that we could show a warning when `[project]` is used in a manifest of a _top-level_ crate. To go slightly further than this I tried to change as many references from `[project]` to `[package]` as possible. This should hopefully help with confusion between `[project]` and `[package]` in the future. This PR also includes a cherry-picked commit from #11131 as it was having issues with bors and fits well with the changes that are being made in this PR. This should ideally be reviewed commit by commit
2 parents f6de921 + 8625d72 commit 928561a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+889
-715
lines changed

src/cargo/util/toml/mod.rs

Lines changed: 84 additions & 62 deletions
Large diffs are not rendered by default.

src/doc/src/reference/specifying-dependencies.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ Dependencies in the `[dependencies]`, `[dev-dependencies]`, `[build-dependencies
472472
`[workspace.dependencies]` definition of dependencies.
473473

474474
```toml
475-
[project]
475+
[package]
476476
name = "bar"
477477
version = "0.2.0"
478478

src/doc/src/reference/unstable.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1083,7 +1083,7 @@ The `filename` parameter is only available in the `[[bin]]` section of the manif
10831083
```toml
10841084
cargo-features = ["different-binary-name"]
10851085

1086-
[project]
1086+
[package]
10871087
name = "foo"
10881088
version = "0.0.1"
10891089

src/doc/src/reference/workspaces.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ regex = { version = "1.6.0", default-features = false, features = ["std"] }
202202

203203
```toml
204204
# [PROJECT_DIR]/bar/Cargo.toml
205-
[project]
205+
[package]
206206
name = "bar"
207207
version = "0.2.0"
208208

tests/testsuite/alt_registry.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ fn depend_on_alt_registry() {
1313
.file(
1414
"Cargo.toml",
1515
r#"
16-
[project]
16+
[package]
1717
name = "foo"
1818
version = "0.0.1"
1919
authors = []
@@ -62,7 +62,7 @@ fn depend_on_alt_registry_depends_on_same_registry_no_index() {
6262
.file(
6363
"Cargo.toml",
6464
r#"
65-
[project]
65+
[package]
6666
name = "foo"
6767
version = "0.0.1"
6868
authors = []
@@ -104,7 +104,7 @@ fn depend_on_alt_registry_depends_on_same_registry() {
104104
.file(
105105
"Cargo.toml",
106106
r#"
107-
[project]
107+
[package]
108108
name = "foo"
109109
version = "0.0.1"
110110
authors = []
@@ -146,7 +146,7 @@ fn depend_on_alt_registry_depends_on_crates_io() {
146146
.file(
147147
"Cargo.toml",
148148
r#"
149-
[project]
149+
[package]
150150
name = "foo"
151151
version = "0.0.1"
152152
authors = []
@@ -190,7 +190,7 @@ fn registry_and_path_dep_works() {
190190
.file(
191191
"Cargo.toml",
192192
r#"
193-
[project]
193+
[package]
194194
name = "foo"
195195
version = "0.0.1"
196196
authors = []
@@ -224,7 +224,7 @@ fn registry_incompatible_with_git() {
224224
.file(
225225
"Cargo.toml",
226226
r#"
227-
[project]
227+
[package]
228228
name = "foo"
229229
version = "0.0.1"
230230
authors = []
@@ -255,7 +255,7 @@ fn cannot_publish_to_crates_io_with_registry_dependency() {
255255
.file(
256256
"Cargo.toml",
257257
r#"
258-
[project]
258+
[package]
259259
name = "foo"
260260
version = "0.0.1"
261261
authors = []
@@ -312,7 +312,7 @@ fn publish_with_registry_dependency() {
312312
.file(
313313
"Cargo.toml",
314314
r#"
315-
[project]
315+
[package]
316316
name = "foo"
317317
version = "0.0.1"
318318
authors = []
@@ -376,7 +376,7 @@ fn alt_registry_and_crates_io_deps() {
376376
.file(
377377
"Cargo.toml",
378378
r#"
379-
[project]
379+
[package]
380380
name = "foo"
381381
version = "0.0.1"
382382
authors = []
@@ -479,7 +479,7 @@ fn publish_with_crates_io_dep() {
479479
.file(
480480
"Cargo.toml",
481481
r#"
482-
[project]
482+
[package]
483483
name = "foo"
484484
version = "0.0.1"
485485
authors = ["me"]
@@ -616,7 +616,7 @@ fn bad_registry_name() {
616616
.file(
617617
"Cargo.toml",
618618
r#"
619-
[project]
619+
[package]
620620
name = "foo"
621621
version = "0.0.1"
622622
authors = []
@@ -1042,7 +1042,7 @@ fn unknown_registry() {
10421042
.file(
10431043
"Cargo.toml",
10441044
r#"
1045-
[project]
1045+
[package]
10461046
name = "foo"
10471047
version = "0.0.1"
10481048
authors = []
@@ -1215,7 +1215,7 @@ fn registries_index_relative_url() {
12151215
.file(
12161216
"Cargo.toml",
12171217
r#"
1218-
[project]
1218+
[package]
12191219
name = "foo"
12201220
version = "0.0.1"
12211221
authors = []
@@ -1262,7 +1262,7 @@ fn registries_index_relative_path_not_allowed() {
12621262
.file(
12631263
"Cargo.toml",
12641264
r#"
1265-
[project]
1265+
[package]
12661266
name = "foo"
12671267
version = "0.0.1"
12681268
authors = []

tests/testsuite/artifact_dep.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ fn features_are_unified_among_lib_and_bin_dep_of_same_target() {
219219
.file(
220220
"Cargo.toml",
221221
r#"
222-
[project]
222+
[package]
223223
name = "foo"
224224
version = "0.0.1"
225225
authors = []
@@ -332,7 +332,7 @@ fn features_are_not_unified_among_lib_and_bin_dep_of_different_target() {
332332
.file(
333333
"Cargo.toml",
334334
&r#"
335-
[project]
335+
[package]
336336
name = "foo"
337337
version = "0.0.1"
338338
authors = []
@@ -435,7 +435,7 @@ fn feature_resolution_works_for_cfg_target_specification() {
435435
.file(
436436
"Cargo.toml",
437437
&r#"
438-
[project]
438+
[package]
439439
name = "foo"
440440
version = "0.0.1"
441441
authors = []
@@ -2181,7 +2181,7 @@ fn build_script_features_for_shared_dependency() {
21812181
.file(
21822182
"Cargo.toml",
21832183
&r#"
2184-
[project]
2184+
[package]
21852185
name = "foo"
21862186
version = "0.0.1"
21872187
resolver = "2"

tests/testsuite/bad_config.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ fn duplicate_packages_in_cargo_lock() {
209209
.file(
210210
"Cargo.toml",
211211
r#"
212-
[project]
212+
[package]
213213
name = "foo"
214214
version = "0.0.1"
215215
authors = []
@@ -263,7 +263,7 @@ fn bad_source_in_cargo_lock() {
263263
.file(
264264
"Cargo.toml",
265265
r#"
266-
[project]
266+
[package]
267267
name = "foo"
268268
version = "0.0.1"
269269
authors = []
@@ -654,7 +654,7 @@ warning: unused manifest key: target.foo.bar
654654
.file(
655655
"Cargo.toml",
656656
r#"
657-
[project]
657+
[package]
658658
659659
name = "foo"
660660
version = "0.5.0"
@@ -667,7 +667,7 @@ warning: unused manifest key: target.foo.bar
667667
p.cargo("build")
668668
.with_stderr(
669669
"\
670-
warning: unused manifest key: project.bulid
670+
warning: unused manifest key: package.bulid
671671
[COMPILING] foo [..]
672672
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
673673
",
@@ -679,7 +679,7 @@ warning: unused manifest key: project.bulid
679679
.file(
680680
"Cargo.toml",
681681
r#"
682-
[project]
682+
[package]
683683
684684
name = "foo"
685685
version = "0.5.0"

tests/testsuite/bench.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ fn bench_with_lib_dep() {
329329
.file(
330330
"Cargo.toml",
331331
r#"
332-
[project]
332+
[package]
333333
name = "foo"
334334
version = "0.0.1"
335335
authors = []
@@ -452,7 +452,7 @@ fn external_bench_explicit() {
452452
.file(
453453
"Cargo.toml",
454454
r#"
455-
[project]
455+
[package]
456456
name = "foo"
457457
version = "0.0.1"
458458
authors = []
@@ -550,7 +550,7 @@ fn bench_autodiscover_2015() {
550550
.file(
551551
"Cargo.toml",
552552
r#"
553-
[project]
553+
[package]
554554
name = "foo"
555555
version = "0.0.1"
556556
authors = []
@@ -695,7 +695,7 @@ fn lib_bin_same_name() {
695695
.file(
696696
"Cargo.toml",
697697
r#"
698-
[project]
698+
[package]
699699
name = "foo"
700700
version = "0.0.1"
701701
authors = []
@@ -1058,7 +1058,7 @@ fn test_a_bench() {
10581058
.file(
10591059
"Cargo.toml",
10601060
r#"
1061-
[project]
1061+
[package]
10621062
name = "foo"
10631063
authors = []
10641064
version = "0.1.0"
@@ -1216,7 +1216,7 @@ fn test_bench_multiple_packages() {
12161216
.file(
12171217
"Cargo.toml",
12181218
r#"
1219-
[project]
1219+
[package]
12201220
name = "foo"
12211221
authors = []
12221222
version = "0.1.0"
@@ -1236,7 +1236,7 @@ fn test_bench_multiple_packages() {
12361236
.file(
12371237
"Cargo.toml",
12381238
r#"
1239-
[project]
1239+
[package]
12401240
name = "bar"
12411241
authors = []
12421242
version = "0.1.0"
@@ -1266,7 +1266,7 @@ fn test_bench_multiple_packages() {
12661266
.file(
12671267
"Cargo.toml",
12681268
r#"
1269-
[project]
1269+
[package]
12701270
name = "baz"
12711271
authors = []
12721272
version = "0.1.0"
@@ -1305,7 +1305,7 @@ fn bench_all_workspace() {
13051305
.file(
13061306
"Cargo.toml",
13071307
r#"
1308-
[project]
1308+
[package]
13091309
name = "foo"
13101310
version = "0.1.0"
13111311
@@ -1358,7 +1358,7 @@ fn bench_all_exclude() {
13581358
.file(
13591359
"Cargo.toml",
13601360
r#"
1361-
[project]
1361+
[package]
13621362
name = "foo"
13631363
version = "0.1.0"
13641364
@@ -1403,7 +1403,7 @@ fn bench_all_exclude_glob() {
14031403
.file(
14041404
"Cargo.toml",
14051405
r#"
1406-
[project]
1406+
[package]
14071407
name = "foo"
14081408
version = "0.1.0"
14091409
@@ -1547,7 +1547,7 @@ fn legacy_bench_name() {
15471547
.file(
15481548
"Cargo.toml",
15491549
r#"
1550-
[project]
1550+
[package]
15511551
name = "foo"
15521552
version = "0.1.0"
15531553

tests/testsuite/binary_name.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ fn gated() {
99
.file(
1010
"Cargo.toml",
1111
r#"
12-
[project]
12+
[package]
1313
name = "foo"
1414
version = "0.0.1"
1515
@@ -44,7 +44,7 @@ fn binary_name1() {
4444
r#"
4545
cargo-features = ["different-binary-name"]
4646
47-
[project]
47+
[package]
4848
name = "foo"
4949
version = "0.0.1"
5050
@@ -126,7 +126,7 @@ fn binary_name2() {
126126
r#"
127127
cargo-features = ["different-binary-name"]
128128
129-
[project]
129+
[package]
130130
name = "foo"
131131
version = "0.0.1"
132132
@@ -212,7 +212,7 @@ fn check_env_vars() {
212212
r#"
213213
cargo-features = ["different-binary-name"]
214214
215-
[project]
215+
[package]
216216
name = "foo"
217217
version = "0.0.1"
218218
@@ -264,7 +264,7 @@ fn check_msg_format_json() {
264264
r#"
265265
cargo-features = ["different-binary-name"]
266266
267-
[project]
267+
[package]
268268
name = "foo"
269269
version = "0.0.1"
270270

0 commit comments

Comments
 (0)