Skip to content

Commit 955503e

Browse files
committed
Auto merge of #13800 - epage:u3, r=weihanglo
fix(toml): Don't double-warn when underscore is used in workspace dep ### What does this PR try to resolve? This is prep for removing them in the 2024 Edition and is part of rust-lang/rust#123754 and #13629 Particularly, I wanted to make sure I didn't make things worse and in doing so found there was room for improvement. ### How should we test and review this PR? ### Additional information
2 parents e3d42b6 + 751fd47 commit 955503e

File tree

2 files changed

+82
-8
lines changed

2 files changed

+82
-8
lines changed

src/cargo/util/toml/mod.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -904,14 +904,6 @@ fn inner_dependency_inherit_with<'a>(
904904
this could become a hard error in the future"
905905
))
906906
}
907-
deprecated_underscore(
908-
&dependency.default_features2,
909-
&dependency.default_features,
910-
"default-features",
911-
name,
912-
"dependency",
913-
warnings,
914-
);
915907
inherit()?.get_dependency(name, package_root).map(|d| {
916908
match d {
917909
manifest::TomlDependency::Simple(s) => {

tests/testsuite/bad_config.rs

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1355,6 +1355,88 @@ fn default_features2_conflict() {
13551355
.run();
13561356
}
13571357

1358+
#[cargo_test]
1359+
fn workspace_default_features2() {
1360+
let p = project()
1361+
.file(
1362+
"Cargo.toml",
1363+
r#"
1364+
[workspace]
1365+
members = ["workspace_only", "dep_workspace_only", "package_only", "dep_package_only"]
1366+
1367+
[workspace.dependencies]
1368+
dep_workspace_only = { path = "dep_workspace_only", default_features = true }
1369+
dep_package_only = { path = "dep_package_only" }
1370+
"#,
1371+
)
1372+
.file(
1373+
"workspace_only/Cargo.toml",
1374+
r#"
1375+
[package]
1376+
name = "workspace_only"
1377+
version = "0.1.0"
1378+
edition = "2015"
1379+
authors = []
1380+
1381+
[dependencies]
1382+
dep_workspace_only.workspace = true
1383+
"#,
1384+
)
1385+
.file("workspace_only/src/lib.rs", "")
1386+
.file(
1387+
"dep_workspace_only/Cargo.toml",
1388+
r#"
1389+
[package]
1390+
name = "dep_workspace_only"
1391+
version = "0.1.0"
1392+
edition = "2015"
1393+
authors = []
1394+
"#,
1395+
)
1396+
.file("dep_workspace_only/src/lib.rs", "")
1397+
.file(
1398+
"package_only/Cargo.toml",
1399+
r#"
1400+
[package]
1401+
name = "package_only"
1402+
version = "0.1.0"
1403+
edition = "2015"
1404+
authors = []
1405+
1406+
[dependencies]
1407+
dep_package_only = { workspace = true, default_features = true }
1408+
"#,
1409+
)
1410+
.file("package_only/src/lib.rs", "")
1411+
.file(
1412+
"dep_package_only/Cargo.toml",
1413+
r#"
1414+
[package]
1415+
name = "dep_package_only"
1416+
version = "0.1.0"
1417+
edition = "2015"
1418+
authors = []
1419+
"#,
1420+
)
1421+
.file("dep_package_only/src/lib.rs", "")
1422+
.build();
1423+
1424+
p.cargo("check")
1425+
.with_stderr_unordered(
1426+
"\
1427+
warning: [CWD]/workspace_only/Cargo.toml: `default_features` is deprecated in favor of `default-features` and will not work in the 2024 edition
1428+
(in the `dep_workspace_only` dependency)
1429+
Locking 4 packages to latest compatible versions
1430+
Checking dep_package_only v0.1.0 ([CWD]/dep_package_only)
1431+
Checking dep_workspace_only v0.1.0 ([CWD]/dep_workspace_only)
1432+
Checking package_only v0.1.0 ([CWD]/package_only)
1433+
Checking workspace_only v0.1.0 ([CWD]/workspace_only)
1434+
Finished `dev` profile [unoptimized + debuginfo] target(s) in [..]s
1435+
"
1436+
)
1437+
.run();
1438+
}
1439+
13581440
#[cargo_test]
13591441
fn proc_macro2() {
13601442
let foo = project()

0 commit comments

Comments
 (0)