Skip to content

Commit d585829

Browse files
committed
Auto merge of #14366 - weihanglo:beta-1.81-backport, r=epage
[beta-1.81] Revert "fix: Ensure dep/feature activates the dependency on 2024" Beta backports * #14295 In order to make CI pass, the following PRs are also cherry-picked: * #14352 * Ignore `build_std::{cross_custom,custom_test_framework,remap_path_scope}` tests (see also #14368)
2 parents f58aa3b + a2ee632 commit d585829

File tree

4 files changed

+20
-47
lines changed

4 files changed

+20
-47
lines changed

src/cargo/util/toml/mod.rs

+2-25
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/build-std/main.rs

+6
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ fn basic() {
133133
assert_eq!(p.glob(deps_dir.join("*.dylib")).count(), 0);
134134
}
135135

136+
#[allow(unused_attributes)]
137+
#[ignore = "to unblock beta-1.81 backport"]
136138
#[cargo_test(build_std_real)]
137139
fn cross_custom() {
138140
let p = project()
@@ -176,6 +178,8 @@ fn cross_custom() {
176178
.run();
177179
}
178180

181+
#[allow(unused_attributes)]
182+
#[ignore = "to unblock beta-1.81 backport"]
179183
#[cargo_test(build_std_real)]
180184
fn custom_test_framework() {
181185
let p = project()
@@ -237,6 +241,8 @@ fn custom_test_framework() {
237241
// Fixing rust-lang/rust#117839.
238242
// on macOS it never gets remapped.
239243
// Might be a separate issue, so only run on Linux.
244+
#[allow(unused_attributes)]
245+
#[ignore = "to unblock beta-1.81 backport"]
240246
#[cargo_test(build_std_real)]
241247
#[cfg(target_os = "linux")]
242248
fn remap_path_scope() {

tests/testsuite/build.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6576,7 +6576,7 @@ fn user_specific_cfgs_are_filtered_out() {
65766576
)
65776577
.build();
65786578

6579-
p.cargo("rustc -- --cfg debug_assertions --cfg proc_macro -Aunknown_lints -Aunexpected_builtin_cfgs")
6579+
p.cargo("rustc -- --cfg debug_assertions --cfg proc_macro -Aunknown_lints -Aexplicit_builtin_cfgs_in_flags")
65806580
.run();
65816581
p.process(&p.bin("foo")).run();
65826582
}

tests/testsuite/features.rs

+11-21
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)