-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Activation of features of non-optional dependencies breaks manifest for 2024 edition #14283
Comments
I'd prefer not to have assumptions like this buried in the code Speaking of assumptions, though it felt dirty, I tried to go the opposite direction and make normalizing of features dependent on normalization of dependencies. However, normalization of dependencies is already dependent on normalization of features.
We need to insert it in a place that knows of and can handle editions. I also prefer it to be recorded in |
To re-summarize the problem package.edition = "2021"
[features]
feature = ["dep/feature"]
[dependencies]
dep = { version = "1", optional = true } will cause a As we want to suppress implicit features in 2024, we strip all optional dependencies like that. This led to a new problem: package.edition = "2024"
[features]
feature = ["dep/feature"]
[dependencies]
dep = { version = "1", optional = true } As We solved this by implicitly adding Logically, checking
We could break this cycle by making a lot of assumptions about the unresolved forms. |
Relevant sections of code: cargo/src/cargo/util/toml/mod.rs Line 327 in 7f20798
cargo/src/cargo/util/toml/mod.rs Lines 371 to 383 in 7f20798
cargo/src/cargo/util/toml/mod.rs Lines 385 to 395 in 7f20798
|
Revert "fix: Ensure dep/feature activates the dependency on 2024" ### What does this PR try to resolve? Fixes #14283 by re-opening #14016 so we don't block people testing other Edition 2024 changes. ### How should we test and review this PR? This reverts commit 99fae91. I initially held off on reverting in case we quickly had a clear direction to go. Since we're still doing some investigation, I decided to move forward with this. ### Additional information
Thanks for taking care of this! Much appreciated for all your hard work. |
Howdy. I'm the one who asked if we could backport this. I'd really like to start dogfooding edition 2024 in the compiler, but since the last beta bump contained #14221, I can't use any crate that has a feature of a non-optional dependency. This basically makes edition 2024 unusable for me until the next beta bump, which is some time from now. I know that backports are not typically warranted for fixes that affect unstable-only codepaths, since we expect users just to update their nightly compiler in that case, but I feel like the compiler might be an exception here. |
Is dogfooding the compiler really a big enough concern to move that we bypass our standard testing procedures to cut out a 1 month delay? I'm also not in a good place for analyzing this for signing off on rushing this to beta. Edition 2024 has already accumulated months of a backlog I need to get through and I have more pressing personal matters to attend to. |
I'm not in a position to weigh how this affects the Cargo team and what the other priorities might be.1 With that caveat, in terms of how this affects the edition team and our plans and timeline, I can say that one month does matter to us. We're only two months out from when we need to go/no go all items. So not losing a month of testing at this point is meaningful and would be helpful. Footnotes
|
I'm looking at #14295 and it seems like a simple revert, with the bulk of it being removing an Given that, and given that it's only a beta backport (not a stable backport), and that we can specifically retest this once backported, I personally (not speaking for the Cargo team) think it'd be safe to backport this to unblock edition 2024 testing. |
If other people have time to do the analysis and are ok with the backport, go for it. In putting time towards this, we need to keep in mind that, at least to me, the stable-to-stable regression is a much higher prioruty. Before we do anything, is the compiler switch-over to Edition 2024 or just for testing purposes? If its going to be merged, does the fact that the fate of this feature is uncertain? We are in the midst of deciding whether to cut it, hack up fixes, or change this feature. I also hope we are taking lessons learned from this as another area where what should not become an emergency becomes one. |
Which issue is the stable-to-stable regression? |
Problem
Activation of an
foo/bar
feature dependency wherefoo
is not an optional dependency results causes a manifest error in edition 2024:...results in...
Explanation
#14221 introduces implicit activation of
dep:
for non-weak dependencies when parsing/updating the manifest in edition 2024. This issue appears to be to due to a missing check for whether or not the dependency of the activated feature is marked as optional.This issue was also brought up in a comment post-merge, and in a Zulip discussion.
Reproducible example
Version
cargo --version
:The text was updated successfully, but these errors were encountered: