-
-
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
Open
0xPoe
wants to merge
7
commits into
rust-lang:master
Choose a base branch
from
0xPoe:poe-patch-inherit-default-features
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
428646d
feat(toml): allow overriding inherited default-features in 2024
0xPoe ef7de4d
test(add): add inherit no default features case
0xPoe d4b668c
feat(add): override inherited default-features in 2024
0xPoe 3678448
test(add): add inherit default features case
0xPoe aa188dc
fix(add): set dep's default features explicitly
0xPoe 7bfc970
fix(add): update outdated warnings
0xPoe 677fb45
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have a test case for
ie explicit
--default-featureswith thefoo = "1.0"caseView changes since the review
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, we don’t have a case that compiles with
cargo init, especially with edition 2024. So I added a new one.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added in
62a3dd8(this PR)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just dropped it, as I had a conversation with @epage offline. He didn’t mean to literally have
cargo inithere, but to start with a freshCargo.toml. A test would exist to make sure--default-featuresdoesn’t setdefault-features = truewhen it isn’t needed, astests/testsuite/cargo_add/default_featuresalready covered this. So I dropped my last commit.