Skip to content

Commit efa06d9

Browse files
committed
Revert "fix: Ensure dep/feature activates the dependency on 2024"
This reverts commit 99fae91.
1 parent ca2346b commit efa06d9

File tree

2 files changed

+13
-46
lines changed

2 files changed

+13
-46
lines changed

src/cargo/util/toml/mod.rs

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ fn resolve_toml(
322322
});
323323
resolved_toml.package = Some(resolved_package);
324324

325-
resolved_toml.features = resolve_features(original_toml.features.as_ref(), edition)?;
325+
resolved_toml.features = resolve_features(original_toml.features.as_ref())?;
326326

327327
resolved_toml.lib = targets::resolve_lib(
328328
original_toml.lib.as_ref(),
@@ -691,34 +691,11 @@ fn default_readme_from_package_root(package_root: &Path) -> Option<String> {
691691
#[tracing::instrument(skip_all)]
692692
fn resolve_features(
693693
original_features: Option<&BTreeMap<manifest::FeatureName, Vec<String>>>,
694-
edition: Edition,
695694
) -> CargoResult<Option<BTreeMap<manifest::FeatureName, Vec<String>>>> {
696-
let Some(mut resolved_features) = original_features.cloned() else {
695+
let Some(resolved_features) = original_features.cloned() else {
697696
return Ok(None);
698697
};
699698

700-
if Edition::Edition2024 <= edition {
701-
for activations in resolved_features.values_mut() {
702-
let mut deps = Vec::new();
703-
for feature_value in activations.iter() {
704-
let feature_value = FeatureValue::new(InternedString::new(feature_value));
705-
let FeatureValue::DepFeature {
706-
dep_name,
707-
dep_feature: _,
708-
weak: false,
709-
} = feature_value
710-
else {
711-
continue;
712-
};
713-
let dep = FeatureValue::Dep { dep_name }.to_string();
714-
if !activations.contains(&dep) {
715-
deps.push(dep);
716-
}
717-
}
718-
activations.extend(deps);
719-
}
720-
}
721-
722699
Ok(Some(resolved_features))
723700
}
724701

tests/testsuite/features.rs

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1890,27 +1890,17 @@ fn strong_dep_feature_edition2024() {
18901890

18911891
p.cargo("metadata")
18921892
.masquerade_as_nightly_cargo(&["edition2024"])
1893-
.with_stdout_data(
1894-
str![[r#"
1895-
{
1896-
"metadata": null,
1897-
"packages": [
1898-
{
1899-
"features": {
1900-
"optional_dep": [
1901-
"optional_dep/foo",
1902-
"dep:optional_dep"
1903-
]
1904-
},
1905-
"name": "foo",
1906-
"...": "{...}"
1907-
}
1908-
],
1909-
"...": "{...}"
1910-
}
1911-
"#]]
1912-
.json(),
1913-
)
1893+
.with_status(101)
1894+
.with_stderr_data(str![[r#"
1895+
[ERROR] feature `optional_dep` includes `optional_dep/foo`, but `optional_dep` is not a dependency
1896+
--> Cargo.toml:9:32
1897+
|
1898+
9 | optional_dep = ["optional_dep/foo"]
1899+
| ^^^^^^^^^^^^^^^^^^^^
1900+
|
1901+
[ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml`
1902+
1903+
"#]])
19141904
.run();
19151905
}
19161906

0 commit comments

Comments
 (0)