Skip to content

feat(toml): allow overriding inherited default-features in 2024 - #17126

Merged
0xPoe merged 7 commits into
rust-lang:masterfrom
0xPoe:poe-patch-inherit-default-features
Aug 7, 2026
Merged

feat(toml): allow overriding inherited default-features in 2024#17126
0xPoe merged 7 commits into
rust-lang:masterfrom
0xPoe:poe-patch-inherit-default-features

Conversation

@0xPoe

@0xPoe 0xPoe commented Jun 21, 2026

Copy link
Copy Markdown
Member

View all comments

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-features setting.

Earlier editions are unchanged: setting default-features on 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

@rustbot rustbot added A-documenting-cargo-itself Area: Cargo's documentation A-manifest Area: Cargo.toml issues Command-add labels Jun 21, 2026
@0xPoe
0xPoe force-pushed the poe-patch-inherit-default-features branch 3 times, most recently from 72f4119 to 62db596 Compare June 23, 2026 21:34
@0xPoe
0xPoe marked this pull request as ready for review June 23, 2026 21:34
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 23, 2026
@0xPoe 0xPoe changed the title NOT READY FOR REVIEW: feat(toml): allow overriding inherited default-features in 2024 feat(toml): allow overriding inherited default-features in 2024 Jun 23, 2026

@0xPoe 0xPoe left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cargo add dep --default-features -p app doesn't work correctly. I will rework this.

View changes since this review

@0xPoe
0xPoe marked this pull request as draft June 23, 2026 22:02
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 23, 2026
@0xPoe 0xPoe changed the title feat(toml): allow overriding inherited default-features in 2024 WIP: feat(toml): allow overriding inherited default-features in 2024 Jun 23, 2026
@epage

epage commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Comment thread src/cargo/util/toml/mod.rs Outdated
Comment thread src/doc/src/reference/workspaces.md Outdated
@0xPoe
0xPoe force-pushed the poe-patch-inherit-default-features branch 3 times, most recently from f2f677f to 17595ac Compare June 24, 2026 22:04
@0xPoe

0xPoe commented Jun 24, 2026

Copy link
Copy Markdown
Member Author

Will we need to update doc.rust-lang.org/edition-guide/rust-2024/cargo-inherited-default-features.html as part of this?

Yes, I will create a PR for this.

@0xPoe
0xPoe marked this pull request as ready for review June 24, 2026 22:11
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 24, 2026
@0xPoe 0xPoe changed the title WIP: feat(toml): allow overriding inherited default-features in 2024 feat(toml): allow overriding inherited default-features in 2024 Jun 24, 2026
@0xPoe
0xPoe force-pushed the poe-patch-inherit-default-features branch 2 times, most recently from 33ca750 to 1b14f50 Compare June 24, 2026 22:32

@0xPoe 0xPoe left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔢 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

View changes since this review

- [`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`

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this is the perfect word for it, and not sure how detailed we should be here.

@0xPoe
0xPoe requested a review from epage June 25, 2026 13:56
Comment thread src/workspace/editor/dependency.rs
Comment thread src/cargo/util/toml/mod.rs Outdated
@0xPoe
0xPoe force-pushed the poe-patch-inherit-default-features branch from e97fffa to 62a3dd8 Compare June 30, 2026 19:24
@rust-rfcbot rust-rfcbot removed the proposed-final-comment-period An FCP proposal has started, but not yet signed off. label Jul 28, 2026
@rust-rfcbot

Copy link
Copy Markdown
Collaborator

🔔 This is now entering its final comment period, as per the review above. 🔔

@rust-rfcbot rust-rfcbot added finished-final-comment-period FCP complete to-announce and removed final-comment-period FCP — a period for last comments before action is taken labels Aug 7, 2026
@rust-rfcbot

Copy link
Copy Markdown
Collaborator

The final comment period, with a disposition to merge, as per the review above, is now complete.

As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.

@epage epage left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@epage
epage added this pull request to the merge queue Aug 7, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 7, 2026
@epage

epage commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Looks like some tests need updating

0xPoe added 7 commits August 7, 2026 22:18
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>
Signed-off-by: 0xPoe <techregister@pm.me>
`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>
Signed-off-by: 0xPoe <techregister@pm.me>
Signed-off-by: 0xPoe <techregister@pm.me>
@0xPoe
0xPoe force-pushed the poe-patch-inherit-default-features branch from 677fb45 to 945b29c Compare August 7, 2026 20:20
@rustbot

rustbot commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@0xPoe

0xPoe commented Aug 7, 2026

Copy link
Copy Markdown
Member Author

Looks like some tests need updating

Updated. See changes at: #17126 (comment)

@0xPoe
0xPoe enabled auto-merge August 7, 2026 20:22
@0xPoe
0xPoe added this pull request to the merge queue Aug 7, 2026
Merged via the queue into rust-lang:master with commit 8f92105 Aug 7, 2026
31 checks passed
@0xPoe
0xPoe deleted the poe-patch-inherit-default-features branch August 7, 2026 21:37
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 7, 2026
@0xPoe

0xPoe commented Aug 7, 2026

Copy link
Copy Markdown
Member Author

Thanks for your review! 💚 💙 💜 💛 ❤️

@0xPoe

0xPoe commented Aug 7, 2026

Copy link
Copy Markdown
Member Author

Will we need to update doc.rust-lang.org/edition-guide/rust-2024/cargo-inherited-default-features.html as part of this?

Yes, I will create a PR for this.

I will handle this tomorrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-documenting-cargo-itself Area: Cargo's documentation A-manifest Area: Cargo.toml issues Command-add disposition-merge FCP with intent to merge finished-final-comment-period FCP complete T-cargo Team: Cargo to-announce

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Tracking Issue for inherit-default-features

6 participants