Skip to content

Commit

Permalink
Auto merge of #13504 - epage:edition-test, r=weihanglo
Browse files Browse the repository at this point in the history
test: Make `edition` explicit in packages

### What does this PR try to resolve?

This ensures we don't rely on the edition default for manifests, unblocking the door for warning on unset editions.

### How should we test and review this PR?

### Additional information

Alternatives considered
- Augment test output for the new warnings: figured we'd want tests closer to our intention and this seemed more work to update everything
- Make a builder API for generating manifests, allowing us to change the default in one place.  Still an interesting idea but a lot of work for this one change.

Risks
- I missed that a test was specifically for unset edition but that is unlikely of a case to come up
  • Loading branch information
bors committed Feb 29, 2024
2 parents c21dd51 + 14646e6 commit ecb8193
Show file tree
Hide file tree
Showing 405 changed files with 2,174 additions and 82 deletions.
3 changes: 3 additions & 0 deletions crates/cargo-test-support/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1074,6 +1074,7 @@ pub fn basic_manifest(name: &str, version: &str) -> String {
name = "{}"
version = "{}"
authors = []
edition = "2015"
"#,
name, version
)
Expand All @@ -1087,6 +1088,7 @@ pub fn basic_bin_manifest(name: &str) -> String {
name = "{}"
version = "0.5.0"
authors = ["[email protected]"]
edition = "2015"
[[bin]]
Expand All @@ -1104,6 +1106,7 @@ pub fn basic_lib_manifest(name: &str) -> String {
name = "{}"
version = "0.5.0"
authors = ["[email protected]"]
edition = "2015"
[lib]
Expand Down
1 change: 1 addition & 0 deletions tests/testsuite/advanced_env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ fn source_config_env() {
[package]
name = "foo"
version = "0.1.0"
edition = "2015"
[dependencies]
somedep = "1.0"
Expand Down
41 changes: 31 additions & 10 deletions tests/testsuite/alt_registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ fn depend_on_alt_registry() {
name = "foo"
version = "0.0.1"
authors = []
edition = "2015"
[dependencies.bar]
version = "0.0.1"
Expand Down Expand Up @@ -66,6 +67,7 @@ fn depend_on_alt_registry_depends_on_same_registry_no_index() {
name = "foo"
version = "0.0.1"
authors = []
edition = "2015"
[dependencies.bar]
version = "0.0.1"
Expand Down Expand Up @@ -108,6 +110,7 @@ fn depend_on_alt_registry_depends_on_same_registry() {
name = "foo"
version = "0.0.1"
authors = []
edition = "2015"
[dependencies.bar]
version = "0.0.1"
Expand Down Expand Up @@ -150,6 +153,7 @@ fn depend_on_alt_registry_depends_on_crates_io() {
name = "foo"
version = "0.0.1"
authors = []
edition = "2015"
[dependencies.bar]
version = "0.0.1"
Expand Down Expand Up @@ -194,6 +198,7 @@ fn registry_and_path_dep_works() {
name = "foo"
version = "0.0.1"
authors = []
edition = "2015"
[dependencies.bar]
path = "bar"
Expand Down Expand Up @@ -228,6 +233,7 @@ fn registry_incompatible_with_git() {
name = "foo"
version = "0.0.1"
authors = []
edition = "2015"
[dependencies.bar]
git = ""
Expand Down Expand Up @@ -258,6 +264,7 @@ fn cannot_publish_to_crates_io_with_registry_dependency() {
name = "foo"
version = "0.0.1"
authors = []
edition = "2015"
[dependencies.bar]
version = "0.0.1"
registry = "alternative"
Expand Down Expand Up @@ -301,6 +308,7 @@ fn publish_with_registry_dependency() {
name = "foo"
version = "0.0.1"
authors = []
edition = "2015"
[dependencies.bar]
version = "0.0.1"
Expand Down Expand Up @@ -385,6 +393,7 @@ fn alt_registry_and_crates_io_deps() {
name = "foo"
version = "0.0.1"
authors = []
edition = "2015"
[dependencies]
crates_io_dep = "0.0.1"
Expand Down Expand Up @@ -542,6 +551,7 @@ fn publish_with_crates_io_dep() {
name = "foo"
version = "0.0.1"
authors = ["me"]
edition = "2015"
license = "MIT"
description = "foo"
Expand Down Expand Up @@ -658,6 +668,7 @@ fn patch_alt_reg() {
[package]
name = "foo"
version = "0.0.1"
edition = "2015"
[dependencies]
bar = { version = "0.1.0", registry = "alternative" }
Expand Down Expand Up @@ -699,6 +710,7 @@ fn bad_registry_name() {
name = "foo"
version = "0.0.1"
authors = []
edition = "2015"
[dependencies.bar]
version = "0.0.1"
Expand All @@ -715,14 +727,14 @@ fn bad_registry_name() {
[ERROR] invalid character ` ` in registry name: `bad name`, characters must be Unicode XID characters (numbers, `-`, `_`, or most letters)
--> Cargo.toml:7:17
|
7 | [dependencies.bar]
| _________________^
8 | | version = \"0.0.1\"
9 | | registry = \"bad name\"
| |_____________________________________^
|
--> Cargo.toml:8:17
|
8 | [dependencies.bar]
| _________________^
9 | | version = \"0.0.1\"
10 | | registry = \"bad name\"
| |_____________________________________^
|
",
)
.run();
Expand Down Expand Up @@ -758,6 +770,7 @@ fn no_api() {
[package]
name = "foo"
version = "0.0.1"
edition = "2015"
[dependencies.bar]
version = "0.0.1"
Expand Down Expand Up @@ -825,6 +838,7 @@ fn alt_reg_metadata() {
[package]
name = "foo"
version = "0.0.1"
edition = "2015"
[dependencies]
altdep = { version = "0.0.1", registry = "alternative" }
Expand Down Expand Up @@ -1139,6 +1153,7 @@ fn unknown_registry() {
name = "foo"
version = "0.0.1"
authors = []
edition = "2015"
[dependencies.bar]
version = "0.0.1"
Expand Down Expand Up @@ -1315,6 +1330,7 @@ fn registries_index_relative_url() {
name = "foo"
version = "0.0.1"
authors = []
edition = "2015"
[dependencies.bar]
version = "0.0.1"
Expand Down Expand Up @@ -1362,6 +1378,7 @@ fn registries_index_relative_path_not_allowed() {
name = "foo"
version = "0.0.1"
authors = []
edition = "2015"
[dependencies.bar]
version = "0.0.1"
Expand Down Expand Up @@ -1440,6 +1457,7 @@ fn sparse_lockfile() {
name = "a"
version = "0.5.0"
authors = []
edition = "2015"
[dependencies]
foo = { registry = 'alternative', version = '0.1.0'}
Expand Down Expand Up @@ -1490,6 +1508,7 @@ fn publish_with_transitive_dep() {
[package]
name = "a"
version = "0.5.0"
edition = "2015"
"#,
)
.file("src/lib.rs", "")
Expand All @@ -1504,6 +1523,7 @@ fn publish_with_transitive_dep() {
name = "b"
version = "0.6.0"
publish = ["Alt-2"]
edition = "2015"
[dependencies]
a = { version = "0.5.0", registry = "Alt-1" }
Expand Down Expand Up @@ -1605,6 +1625,7 @@ fn empty_dependency_registry() {
[package]
name = "foo"
version = "0.0.1"
edition = "2015"
[dependencies]
bar = { version = "0.1.0", registry = "" }
Expand All @@ -1626,9 +1647,9 @@ fn empty_dependency_registry() {
[ERROR] registry name cannot be empty
--> Cargo.toml:7:23
--> Cargo.toml:8:23
|
7 | bar = { version = \"0.1.0\", registry = \"\" }
8 | bar = { version = \"0.1.0\", registry = \"\" }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
",
Expand Down
Loading

0 comments on commit ecb8193

Please sign in to comment.