feat(toml): allow overriding inherited default-features in 2024#17126
feat(toml): allow overriding inherited default-features in 2024#171260xPoe wants to merge 8 commits into
Conversation
c1ee481 to
a6548d4
Compare
Impl RFC 3945, on Edition 2024+ allow workspace members to override the workspace dependency's `default-features` setting. Earlier editions are unchanged: setting `default-features` on an inherited dependency is still ignored with a warning. Signed-off-by: 0xPoe <techregister@pm.me>
a6548d4 to
72f4119
Compare
Signed-off-by: 0xPoe <techregister@pm.me>
72f4119 to
62db596
Compare
|
Will we need to update https://doc.rust-lang.org/edition-guide/rust-2024/cargo-inherited-default-features.html as part of this? |
`cargo add --no-default-features` (or `--default-features`) against a dependency inherited from `[workspace.dependencies]` is now allowed when the package is on Edition 2024+, matching the manifest behavior. Earlier editions still error, pointing the user to the workspace manifest. Signed-off-by: 0xPoe <techregister@pm.me>
Signed-off-by: 0xPoe <techregister@pm.me>
Signed-off-by: 0xPoe <techregister@pm.me>
f2f677f to
17595ac
Compare
Yes, I will create a PR for this. |
17595ac to
33ca750
Compare
Signed-off-by: 0xPoe <techregister@pm.me>
Signed-off-by: 0xPoe <techregister@pm.me>
33ca750 to
1b14f50
Compare
There was a problem hiding this comment.
🔢 Self-check (PR reviewed by myself and ready for feedback)
-
Code compiles successfully
-
Unit tests added
-
No AI-generated elegant nonsense in PR.
-
Comments added where necessary
-
PR title and description updated
-
Documentation updated
-
PR size is reasonable
| - [`default-features`][default-features] (Edition 2024 packages, requires Rust 1.98+): | ||
| Overrides the value set in `[workspace.dependencies]`. | ||
| If neither the package nor the workspace specifies `default-features`, it defaults to `true`. | ||
| Before Rust 1.98, or in earlier editions, package-level `default-features = false` |
There was a problem hiding this comment.
Not sure if this is the perfect word for it, and not sure how detailed we should be here.
| false, | ||
| None, | ||
| true, | ||
| None, |
There was a problem hiding this comment.
Do we have a test case for
$ cargo init
$ cargo add foo --default-featuresie explicit --default-features with the foo = "1.0" case
There was a problem hiding this comment.
No, we don’t have a case that compiles with cargo init, especially with edition 2024. So I added a new one.
| {ws_def_feat} for `workspace.dependencies.{label}`, \ | ||
| this could become a hard error in the future" | ||
| {ws_def_feat} for `workspace.dependencies.{label}`; \ | ||
| overriding workspace `default-features` to false requires Rust 1.98+ \ |
There was a problem hiding this comment.
Just tracking that we are pretty close to the deadline for this to make sure we update this if we don't make it
There was a problem hiding this comment.
Yes, we have about 10 days to cut a new one if I remember correctly.
There was a problem hiding this comment.
Beta branch is on the 3rd and I believe they use our last submodule update, making it earlier.
Signed-off-by: 0xPoe <poe.liu@pm.me>
e97fffa to
62a3dd8
Compare
What does this PR try to resolve?
close #16959
Implement RFC 3945, on Edition 2024+ allow workspace members to override the workspace dependency's
default-featuressetting.Earlier editions are unchanged: setting
default-featureson an inherited dependency is still ignored with a warning.Also, this change would allow
cargo add X --no-default-features -p Y, but only on Edition 2024+.How to test and review this PR?
Review and check it commit by commit.
r?@ghost