-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Warning on conflicting keys #10316
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
Merged
Warning on conflicting keys #10316
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
375ccd2
Warning on conflicting proc_macro
0xPoe a317aff
Warning on conflicting crate_types keys
0xPoe 154f372
Warning on conflicting dev-dependencies keys
0xPoe ed93c94
Warning on conflicting build_dependencies keys
0xPoe 460ea25
Warning on conflicting default_features keys
0xPoe ad375af
Warning on conflicting build_dependencies keys of platform
0xPoe b295e2f
Warning on conflicting dev_dependencies keys of platform
0xPoe 8b895cc
Use warn_on_deprecated
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1676,6 +1676,153 @@ Caused by: | |
.run(); | ||
} | ||
|
||
#[cargo_test] | ||
fn dev_dependencies_conflicting_warning() { | ||
let p = project() | ||
.file( | ||
"Cargo.toml", | ||
r#" | ||
[package] | ||
name = "foo" | ||
version = "0.1.0" | ||
edition = "2018" | ||
|
||
[dev-dependencies] | ||
a = {path = "a"} | ||
[dev_dependencies] | ||
a = {path = "a"} | ||
"#, | ||
) | ||
.file("src/lib.rs", "") | ||
.file( | ||
"a/Cargo.toml", | ||
r#" | ||
[package] | ||
name = "a" | ||
version = "0.0.1" | ||
"#, | ||
) | ||
.file("a/src/lib.rs", "") | ||
.build(); | ||
p.cargo("build") | ||
.with_stderr_contains( | ||
"[WARNING] conflicting between `dev-dependencies` and `dev_dependencies` in the `foo` package.\n | ||
`dev_dependencies` is ignored and not recommended for use in the future" | ||
) | ||
.run(); | ||
} | ||
|
||
#[cargo_test] | ||
fn build_dependencies_conflicting_warning() { | ||
let p = project() | ||
.file( | ||
"Cargo.toml", | ||
r#" | ||
[package] | ||
name = "foo" | ||
version = "0.1.0" | ||
edition = "2018" | ||
|
||
[build-dependencies] | ||
a = {path = "a"} | ||
[build_dependencies] | ||
a = {path = "a"} | ||
"#, | ||
) | ||
.file("src/lib.rs", "") | ||
.file( | ||
"a/Cargo.toml", | ||
r#" | ||
[package] | ||
name = "a" | ||
version = "0.0.1" | ||
"#, | ||
) | ||
.file("a/src/lib.rs", "") | ||
.build(); | ||
p.cargo("build") | ||
.with_stderr_contains( | ||
"[WARNING] conflicting between `build-dependencies` and `build_dependencies` in the `foo` package.\n | ||
`build_dependencies` is ignored and not recommended for use in the future" | ||
) | ||
.run(); | ||
} | ||
|
||
#[cargo_test] | ||
fn lib_crate_types_conflicting_warning() { | ||
let p = project() | ||
.file( | ||
"Cargo.toml", | ||
r#" | ||
[project] | ||
name = "foo" | ||
version = "0.5.0" | ||
authors = ["[email protected]"] | ||
|
||
[lib] | ||
name = "foo" | ||
crate-type = ["rlib", "dylib"] | ||
crate_type = ["staticlib", "dylib"] | ||
"#, | ||
) | ||
.file("src/lib.rs", "pub fn foo() {}") | ||
.build(); | ||
p.cargo("build") | ||
.with_stderr_contains( | ||
"[WARNING] conflicting between `crate-type` and `crate_type` in the `foo` library target.\n | ||
`crate_type` is ignored and not recommended for use in the future", | ||
) | ||
.run(); | ||
} | ||
|
||
#[cargo_test] | ||
fn examples_crate_types_conflicting_warning() { | ||
let p = project() | ||
.file( | ||
"Cargo.toml", | ||
r#" | ||
[project] | ||
name = "foo" | ||
version = "0.5.0" | ||
authors = ["[email protected]"] | ||
|
||
[[example]] | ||
name = "ex" | ||
path = "examples/ex.rs" | ||
crate-type = ["rlib", "dylib"] | ||
crate_type = ["proc_macro"] | ||
[[example]] | ||
name = "goodbye" | ||
path = "examples/ex-goodbye.rs" | ||
crate-type = ["rlib", "dylib"] | ||
crate_type = ["rlib", "staticlib"] | ||
"#, | ||
) | ||
.file("src/lib.rs", "") | ||
.file( | ||
"examples/ex.rs", | ||
r#" | ||
fn main() { println!("ex"); } | ||
"#, | ||
) | ||
.file( | ||
"examples/ex-goodbye.rs", | ||
r#" | ||
fn main() { println!("goodbye"); } | ||
"#, | ||
) | ||
.build(); | ||
p.cargo("build") | ||
.with_stderr_contains( | ||
"\ | ||
[WARNING] conflicting between `crate-type` and `crate_type` in the `ex` example target.\n | ||
`crate_type` is ignored and not recommended for use in the future | ||
[WARNING] conflicting between `crate-type` and `crate_type` in the `goodbye` example target.\n | ||
`crate_type` is ignored and not recommended for use in the future", | ||
) | ||
.run(); | ||
} | ||
|
||
#[cargo_test] | ||
fn self_dependency() { | ||
let p = project() | ||
|
@@ -2841,6 +2988,88 @@ fn cargo_platform_specific_dependency() { | |
p.cargo("test").run(); | ||
} | ||
|
||
#[cargo_test] | ||
fn cargo_platform_specific_dependency_build_dependencies_conflicting_warning() { | ||
let host = rustc_host(); | ||
let p = project() | ||
.file( | ||
"Cargo.toml", | ||
&format!( | ||
r#" | ||
[project] | ||
name = "foo" | ||
version = "0.5.0" | ||
authors = ["[email protected]"] | ||
build = "build.rs" | ||
|
||
[target.{host}.build-dependencies] | ||
build = {{ path = "build" }} | ||
[target.{host}.build_dependencies] | ||
build = {{ path = "build" }} | ||
"#, | ||
host = host | ||
), | ||
) | ||
.file("src/main.rs", "fn main() { }") | ||
.file( | ||
"build.rs", | ||
"extern crate build; fn main() { build::build(); }", | ||
) | ||
.file("build/Cargo.toml", &basic_manifest("build", "0.5.0")) | ||
.file("build/src/lib.rs", "pub fn build() {}") | ||
.build(); | ||
|
||
p.cargo("build") | ||
.with_stderr_contains( | ||
format!("[WARNING] conflicting between `build-dependencies` and `build_dependencies` in the `{}` platform target.\n | ||
`build_dependencies` is ignored and not recommended for use in the future", host) | ||
) | ||
.run(); | ||
|
||
assert!(p.bin("foo").is_file()); | ||
} | ||
|
||
#[cargo_test] | ||
fn cargo_platform_specific_dependency_dev_dependencies_conflicting_warning() { | ||
let host = rustc_host(); | ||
let p = project() | ||
.file( | ||
"Cargo.toml", | ||
&format!( | ||
r#" | ||
[project] | ||
name = "foo" | ||
version = "0.5.0" | ||
authors = ["[email protected]"] | ||
|
||
[target.{host}.dev-dependencies] | ||
dev = {{ path = "dev" }} | ||
[target.{host}.dev_dependencies] | ||
dev = {{ path = "dev" }} | ||
"#, | ||
host = host | ||
), | ||
) | ||
.file("src/main.rs", "fn main() { }") | ||
.file( | ||
"tests/foo.rs", | ||
"extern crate dev; #[test] fn foo() { dev::dev() }", | ||
) | ||
.file("dev/Cargo.toml", &basic_manifest("dev", "0.5.0")) | ||
.file("dev/src/lib.rs", "pub fn dev() {}") | ||
.build(); | ||
|
||
p.cargo("build") | ||
.with_stderr_contains( | ||
format!("[WARNING] conflicting between `dev-dependencies` and `dev_dependencies` in the `{}` platform target.\n | ||
`dev_dependencies` is ignored and not recommended for use in the future", host) | ||
) | ||
.run(); | ||
|
||
assert!(p.bin("foo").is_file()); | ||
p.cargo("test").run(); | ||
} | ||
|
||
#[cargo_test] | ||
fn bad_platform_specific_dependency() { | ||
let p = project() | ||
|
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.