-
-
Notifications
You must be signed in to change notification settings - Fork 3k
feat(toml): allow overriding inherited default-features in 2024 #17126
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
Merged
0xPoe
merged 7 commits into
rust-lang:master
from
0xPoe:poe-patch-inherit-default-features
Aug 7, 2026
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
8abff5b
feat(toml): allow overriding inherited default-features in 2024
0xPoe 4fcaf04
test(add): add inherit no default features case
0xPoe b7f52c9
feat(add): override inherited default-features in 2024
0xPoe 71d2857
test(add): add inherit default features case
0xPoe c74cbfe
fix(add): set dep's default features explicitly
0xPoe 31a5365
fix(add): update outdated warnings
0xPoe 945b29c
docs: document overriding inherited default-features
0xPoe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
tests/testsuite/cargo_add/inherit_default_features_2024_edition/in/Cargo.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| [workspace] | ||
| members = ["foo", "bar"] | ||
| resolver = "3" | ||
|
|
||
| [workspace.dependencies] | ||
| foo = { version = "0.0.0", path = "./foo", default-features = false } |
6 changes: 6 additions & 0 deletions
6
tests/testsuite/cargo_add/inherit_default_features_2024_edition/in/bar/Cargo.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| [package] | ||
| name = "bar" | ||
| version = "0.0.0" | ||
| edition = "2024" | ||
|
|
||
| [dependencies] |
1 change: 1 addition & 0 deletions
1
tests/testsuite/cargo_add/inherit_default_features_2024_edition/in/bar/src/lib.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
|
|
4 changes: 4 additions & 0 deletions
4
tests/testsuite/cargo_add/inherit_default_features_2024_edition/in/foo/Cargo.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| [package] | ||
| name = "foo" | ||
| version = "0.0.0" | ||
| edition = "2024" |
1 change: 1 addition & 0 deletions
1
tests/testsuite/cargo_add/inherit_default_features_2024_edition/in/foo/src/lib.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
|
|
25 changes: 25 additions & 0 deletions
25
tests/testsuite/cargo_add/inherit_default_features_2024_edition/mod.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| use crate::prelude::*; | ||
| use cargo_test_support::Project; | ||
| use cargo_test_support::compare::assert_ui; | ||
| use cargo_test_support::current_dir; | ||
| use cargo_test_support::file; | ||
| use cargo_test_support::str; | ||
|
|
||
| #[cargo_test] | ||
| fn case() { | ||
| cargo_test_support::registry::init(); | ||
| let project = Project::from_template(current_dir!().join("in")); | ||
| let project_root = project.root(); | ||
| let cwd = &project_root; | ||
|
|
||
| snapbox::cmd::Command::cargo_ui() | ||
| .arg("add") | ||
| .args(["foo", "--default-features", "-p", "bar"]) | ||
| .current_dir(cwd) | ||
| .assert() | ||
| .success() | ||
| .stdout_eq(str![""]) | ||
| .stderr_eq(file!["stderr.term.svg"]); | ||
|
|
||
| assert_ui().subset_matches(current_dir!().join("out"), &project_root); | ||
| } |
6 changes: 6 additions & 0 deletions
6
tests/testsuite/cargo_add/inherit_default_features_2024_edition/out/Cargo.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| [workspace] | ||
| members = ["foo", "bar"] | ||
| resolver = "3" | ||
|
|
||
| [workspace.dependencies] | ||
| foo = { version = "0.0.0", path = "./foo", default-features = false } |
7 changes: 7 additions & 0 deletions
7
tests/testsuite/cargo_add/inherit_default_features_2024_edition/out/bar/Cargo.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| [package] | ||
| name = "bar" | ||
| version = "0.0.0" | ||
| edition = "2024" | ||
|
|
||
| [dependencies] | ||
| foo = { workspace = true, default-features = true } |
1 change: 1 addition & 0 deletions
1
tests/testsuite/cargo_add/inherit_default_features_2024_edition/out/bar/src/lib.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
|
|
4 changes: 4 additions & 0 deletions
4
tests/testsuite/cargo_add/inherit_default_features_2024_edition/out/foo/Cargo.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| [package] | ||
| name = "foo" | ||
| version = "0.0.0" | ||
| edition = "2024" |
1 change: 1 addition & 0 deletions
1
tests/testsuite/cargo_add/inherit_default_features_2024_edition/out/foo/src/lib.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
|
|
27 changes: 27 additions & 0 deletions
27
tests/testsuite/cargo_add/inherit_default_features_2024_edition/stderr.term.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions
6
tests/testsuite/cargo_add/inherit_no_default_features_2024_edition/in/Cargo.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| [workspace] | ||
| members = ["foo", "bar"] | ||
| resolver = "3" | ||
|
|
||
| [workspace.dependencies] | ||
| foo = { version = "0.0.0", path = "./foo", default-features = true } |
6 changes: 6 additions & 0 deletions
6
tests/testsuite/cargo_add/inherit_no_default_features_2024_edition/in/bar/Cargo.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| [package] | ||
| name = "bar" | ||
| version = "0.0.0" | ||
| edition = "2024" | ||
|
|
||
| [dependencies] |
Empty file.
4 changes: 4 additions & 0 deletions
4
tests/testsuite/cargo_add/inherit_no_default_features_2024_edition/in/foo/Cargo.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| [package] | ||
| name = "foo" | ||
| version = "0.0.0" | ||
| edition = "2024" |
Empty file.
25 changes: 25 additions & 0 deletions
25
tests/testsuite/cargo_add/inherit_no_default_features_2024_edition/mod.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| use crate::prelude::*; | ||
| use cargo_test_support::Project; | ||
| use cargo_test_support::compare::assert_ui; | ||
| use cargo_test_support::current_dir; | ||
| use cargo_test_support::file; | ||
| use cargo_test_support::str; | ||
|
|
||
| #[cargo_test] | ||
| fn case() { | ||
| cargo_test_support::registry::init(); | ||
| let project = Project::from_template(current_dir!().join("in")); | ||
| let project_root = project.root(); | ||
| let cwd = &project_root; | ||
|
|
||
| snapbox::cmd::Command::cargo_ui() | ||
| .arg("add") | ||
| .args(["foo", "--no-default-features", "-p", "bar"]) | ||
| .current_dir(cwd) | ||
| .assert() | ||
| .success() | ||
| .stdout_eq(str![""]) | ||
| .stderr_eq(file!["stderr.term.svg"]); | ||
|
|
||
| assert_ui().subset_matches(current_dir!().join("out"), &project_root); | ||
| } |
6 changes: 6 additions & 0 deletions
6
tests/testsuite/cargo_add/inherit_no_default_features_2024_edition/out/Cargo.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| [workspace] | ||
| members = ["foo", "bar"] | ||
| resolver = "3" | ||
|
|
||
| [workspace.dependencies] | ||
| foo = { version = "0.0.0", path = "./foo", default-features = true } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.