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

Warn on unused patches. #6470

Merged
merged 1 commit into from Dec 22, 2018

Conversation

Projects
None yet
5 participants
@ehuss
Copy link
Contributor

ehuss commented Dec 21, 2018

Adds a warning when a [patch] entry fails to match anything.
I've hit this several times in the past, and it always takes me
5 minutes of confusion to figure out what's wrong.

Fixes #6444

@rust-highfive

This comment has been minimized.

Copy link

rust-highfive commented Dec 21, 2018

r? @Eh2406

(rust_highfive has picked a reviewer for you, use r? to override)

@ehuss

This comment has been minimized.

Copy link
Contributor

ehuss commented Dec 21, 2018

My confidence is low that this is correct, or that the new message is clear enough. My original impression was that patches are typically temporary, and you'd always want to know if it's not working. However, sometimes people do clever things that I don't expect.

@Eh2406

This comment has been minimized.

Copy link
Contributor

Eh2406 commented Dec 21, 2018

Thanks for working on this! This looks like a good step in the correct direction. I don't know much about how the ops part of the code fits together so, I would like to defer to @alexcrichton.

@alexcrichton
Copy link
Member

alexcrichton left a comment

Just one minor wording nit, but otherwise looks good to me!

let warnings: Vec<String> = resolved
.unused_patches()
.iter()
.map(|pkgid| format!("Patch for `{}` did not match any packages.", pkgid))

This comment has been minimized.

@alexcrichton

alexcrichton Dec 21, 2018

Member

I might recommend s/did not match any packages/did not end up being used in the crate graph/

(or something like that, it must match in one way or another but the error here is that it didn't end up actually being use)

@ehuss ehuss force-pushed the ehuss:warn-unused-patch branch from 1d74e49 to 7e43a11 Dec 21, 2018

@ehuss ehuss force-pushed the ehuss:warn-unused-patch branch from 7e43a11 to e35ecbe Dec 22, 2018

@Eh2406

This comment has been minimized.

Copy link
Contributor

Eh2406 commented Dec 22, 2018

@bors r=alexcrichton

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Dec 22, 2018

📌 Commit e35ecbe has been approved by alexcrichton

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Dec 22, 2018

⌛️ Testing commit e35ecbe with merge 8e547a7...

bors added a commit that referenced this pull request Dec 22, 2018

Auto merge of #6470 - ehuss:warn-unused-patch, r=alexcrichton
Warn on unused patches.

Adds a warning when a `[patch]` entry fails to match anything.
I've hit this several times in the past, and it always takes me
5 minutes of confusion to figure out what's wrong.

Fixes #6444
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Dec 22, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: alexcrichton
Pushing 8e547a7 to master...

@bors bors merged commit e35ecbe into rust-lang:master Dec 22, 2018

3 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details

bors added a commit that referenced this pull request Dec 28, 2018

Auto merge of #6494 - ehuss:fix-unused-patch-warning, r=dwijnand
Fix new unused patch warning.

The unused `[patch]` warning added in #6470 was misfiring if you build only a subset of a workspace that doesn't include the patch.

I'm about 80% confident this new logic is correct. It addresses the scenario I discovered, and I tested a bunch of commands (generate-lockfile, update, etc.) to make sure they all work. However, the many ways that `resolve_with_previous` is called is tricky to ensure every scenario works correctly.

@ehuss ehuss referenced this pull request Jan 3, 2019

Merged

Update cargo #57315

bors added a commit to rust-lang/rust that referenced this pull request Jan 4, 2019

Auto merge of #57315 - ehuss:update-cargo, r=alexcrichton
Update cargo

24 commits in 0d1f1bbeabd5b43a7f3ecfa16540af8e76d5efb4..34320d212dca8cd27d06ce93c16c6151f46fcf2e
2018-12-19 14:45:14 +0000 to 2019-01-03 19:12:38 +0000
- Display environment variables for rustc commands (rust-lang/cargo#6492)
- Fix a very minor race condition in `cargo fix`. (rust-lang/cargo#6515)
- Add a high-level overview of how `fix` works. (rust-lang/cargo#6516)
- Add dependency `registry` to `cargo metadata`. (rust-lang/cargo#6500)
- Fix fingerprint calculation for patched deps. (rust-lang/cargo#6493)
- serialize version directly (rust-lang/cargo#6512)
- use DYLD_FALLBACK_LIBRARY_PATH for dylib_path_envvar on macOS (rust-lang/cargo#6355)
- Fix error message when resolving dependencies (rust-lang/cargo#6510)
- use PathBuf in cargo metadata (rust-lang/cargo#6511)
- Fixed link to testsuite in CONTRIBUTING.md (rust-lang/cargo#6506)
- Update display of contents of Cargo.toml (rust-lang/cargo#6501)
- Update display of contents of Cargo.toml (rust-lang/cargo#6502)
- Fixup cargo install's help message (rust-lang/cargo#6495)
- testsuite: Require failing commands to check output. (rust-lang/cargo#6497)
- Delete unnecessary 'return' (rust-lang/cargo#6496)
- Fix new unused patch warning. (rust-lang/cargo#6494)
- Some minor documentation changes. (rust-lang/cargo#6481)
- Add `links` to `cargo metadata`. (rust-lang/cargo#6480)
- Salvaged semver work (rust-lang/cargo#6476)
- Warn on unused patches. (rust-lang/cargo#6470)
- don't write a an incorrect rustc version to the fingerprint file (rust-lang/cargo#6473)
- Rewrite `login` and registry cleanups. (rust-lang/cargo#6466)
- [issue#6461] Fix cargo commands list (rust-lang/cargo#6462)
- Restrict registry names to same style as package names. (rust-lang/cargo#6469)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment