-
Notifications
You must be signed in to change notification settings - Fork 2.9k
2024 implicit feature migration deletes dependency features #14010
Copy link
Copy link
Closed
Labels
A-editionsArea: edition-specific issuesArea: edition-specific issuesA-featuresArea: features — conditional compilationArea: features — conditional compilationC-bugCategory: bugCategory: bugS-triageStatus: This issue is waiting on initial triage.Status: This issue is waiting on initial triage.
Description
Problem
Migrating to 2024 causes foo/feature_name features to get removed for optional dependencies. Those need to be preserved.
Steps
Example manifest:
cargo-features = ["edition2024"]
[package]
name = "foo"
version = "0.1.0"
edition = "2021"
[dependencies]
serde = { version = "1.0.203", optional = true }
[features]
serde = ["serde/derive"]Running cargo fix --edition on this will result in:
serde = ["dep:serde"]Note that the /derive feature got removed.
Possible Solution(s)
When there is a ["foo/feature_name"] syntax in the [features] table, and dep:foo isn't found anywhere in the [features] table, it should be rewritten to be ["dep:foo", "foo/feature_name"]. Some things to be careful of:
- Adjust all places that
foo/xxxis found (such asx = ["foo/a"]andy = ["foo/b"], both x and y need a "dep:foo") - Should not disturb any other features (like
["foo/feature_name", "bar"] would be rewritten to ["dep:foo", "foo/feature_name", "bar"]) - Should avoid duplicates (
["foo/a", "foo/b"]should not have twodep:fooentries added).
Notes
No response
Version
cargo 1.80.0-nightly (7a6fad098 2024-05-31)
release: 1.80.0-nightly
commit-hash: 7a6fad0984d28c8330974636972aa296b67c4513
commit-date: 2024-05-31
host: aarch64-apple-darwin
libgit2: 1.7.2 (sys:0.18.3 vendored)
libcurl: 8.6.0 (sys:0.4.72+curl-8.6.0 system ssl:(SecureTransport) LibreSSL/3.3.6)
ssl: OpenSSL 1.1.1w 11 Sep 2023
os: Mac OS 14.5.0 [64-bit]
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-editionsArea: edition-specific issuesArea: edition-specific issuesA-featuresArea: features — conditional compilationArea: features — conditional compilationC-bugCategory: bugCategory: bugS-triageStatus: This issue is waiting on initial triage.Status: This issue is waiting on initial triage.
Type
Fields
Give feedbackNo fields configured for issues without a type.