-
Notifications
You must be signed in to change notification settings - Fork 2.6k
fix(source): Don't warn about unreferenced duplicate packages #14239
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
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
1a25400
test(git): Show unused duplicate package warning
epage 6c0f14c
fix(source): Make duplicate selection predictable
epage 58ee635
fix(source): Consolidate duplicate package warnings
epage 3124b0c
refactor(source): Delay the duplicate name check
epage ed56f1e
fix(source): Don't warn about unreferenced duplicate packages
epage 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1132,31 +1132,125 @@ fn ambiguous_published_deps() { | |
let git_project = git::new("dep", |project| { | ||
project | ||
.file( | ||
"aaa/Cargo.toml", | ||
"duplicate1/Cargo.toml", | ||
&format!( | ||
r#" | ||
[package] | ||
name = "bar" | ||
name = "duplicate" | ||
version = "0.5.0" | ||
edition = "2015" | ||
publish = true | ||
"# | ||
), | ||
) | ||
.file("duplicate1/src/lib.rs", "") | ||
.file( | ||
"duplicate2/Cargo.toml", | ||
&format!( | ||
r#" | ||
[package] | ||
name = "duplicate" | ||
version = "0.5.0" | ||
edition = "2015" | ||
publish = true | ||
"# | ||
), | ||
) | ||
.file("duplicate2/src/lib.rs", "") | ||
}); | ||
|
||
let p = project | ||
.file( | ||
"Cargo.toml", | ||
&format!( | ||
r#" | ||
[package] | ||
|
||
name = "foo" | ||
version = "0.5.0" | ||
edition = "2015" | ||
authors = ["[email protected]"] | ||
|
||
[dependencies.duplicate] | ||
git = '{}' | ||
"#, | ||
git_project.url() | ||
), | ||
) | ||
.file("src/main.rs", "fn main() { }") | ||
.build(); | ||
|
||
p.cargo("build").run(); | ||
p.cargo("run") | ||
.with_stderr_data(str![[r#" | ||
[WARNING] skipping duplicate package `duplicate v0.5.0 ([ROOTURL]/dep#[..])`: | ||
[ROOT]/home/.cargo/git/checkouts/dep-[HASH]/[..]/duplicate2/Cargo.toml | ||
in favor of [ROOT]/home/.cargo/git/checkouts/dep-[HASH]/[..]/duplicate1/Cargo.toml | ||
|
||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s | ||
[RUNNING] `target/debug/foo[EXE]` | ||
|
||
"#]]) | ||
.run(); | ||
} | ||
|
||
#[cargo_test] | ||
fn unused_ambiguous_published_deps() { | ||
let project = project(); | ||
let git_project = git::new("dep", |project| { | ||
project | ||
.file( | ||
"unique/Cargo.toml", | ||
&format!( | ||
r#" | ||
[package] | ||
name = "unique" | ||
version = "0.5.0" | ||
edition = "2015" | ||
publish = true | ||
"# | ||
), | ||
) | ||
.file("unique/src/lib.rs", "") | ||
.file( | ||
"duplicate1/Cargo.toml", | ||
&format!( | ||
r#" | ||
[package] | ||
name = "duplicate" | ||
version = "0.5.0" | ||
edition = "2015" | ||
publish = true | ||
"# | ||
), | ||
) | ||
.file("aaa/src/lib.rs", "") | ||
.file("duplicate1/src/lib.rs", "") | ||
.file( | ||
"bbb/Cargo.toml", | ||
"duplicate2/Cargo.toml", | ||
&format!( | ||
r#" | ||
[package] | ||
name = "duplicate" | ||
version = "0.5.0" | ||
edition = "2015" | ||
publish = true | ||
"# | ||
), | ||
) | ||
.file("duplicate2/src/lib.rs", "") | ||
.file( | ||
"invalid/Cargo.toml", | ||
&format!( | ||
r#" | ||
[package | ||
name = "bar" | ||
version = "0.5.0" | ||
edition = "2015" | ||
publish = true | ||
"# | ||
), | ||
) | ||
.file("bbb/src/lib.rs", "") | ||
.file("invalid/src/lib.rs", "") | ||
}); | ||
|
||
let p = project | ||
|
@@ -1171,7 +1265,7 @@ fn ambiguous_published_deps() { | |
edition = "2015" | ||
authors = ["[email protected]"] | ||
|
||
[dependencies.bar] | ||
[dependencies.unique] | ||
git = '{}' | ||
"#, | ||
git_project.url() | ||
|
@@ -1183,7 +1277,13 @@ fn ambiguous_published_deps() { | |
p.cargo("build").run(); | ||
p.cargo("run") | ||
.with_stderr_data(str![[r#" | ||
[WARNING] skipping duplicate package `bar` found at `[ROOT]/home/.cargo/git/checkouts/dep-[HASH]/[..]` | ||
[ERROR] invalid table header | ||
expected `.`, `]` | ||
--> ../home/.cargo/git/checkouts/dep-[HASH]/[..]/invalid/Cargo.toml:2:29 | ||
| | ||
2 | [package | ||
| ^ | ||
| | ||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s | ||
[RUNNING] `target/debug/foo[EXE]` | ||
|
||
|
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.