]> git.proxmox.com Git - cargo.git/commit - src/cargo/core/registry.rs
Warn about path overrides that won't work
authorAlex Crichton <alex@alexcrichton.com>
Thu, 29 Sep 2016 23:35:22 +0000 (16:35 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Thu, 29 Sep 2016 23:51:12 +0000 (16:51 -0700)
commitfc0e64262a3c3b461f004d6fa75732ca656e73bd
tree508834ea6bdc909fdb60a9d884a5c9212b573d90
parent9442cc3ba481d54347f290f567844b58d0d117c4
Warn about path overrides that won't work

Cargo has a long-standing [bug] in path overrides where they will cause spurious
rebuilds of crates in the crate graph. This can be very difficult to diagnose
and be incredibly frustrating as well. Unfortunately, though, it's behavior that
fundamentally can't be fixed in Cargo.

The crux of the problem happens when a `path` replacement changes something
about the list of dependencies of the crate that it's replacing. This alteration
to the list of dependencies *cannot be tracked by Cargo* as the lock file was
previously emitted. In the best case this ends up causing random recompiles. In
the worst case it cause infinite registry updates that always result in
recompiles.

A solution to this intention, changing the dependency graph of an overridden
dependency, was [implemented] with the `[replace]` feature in Cargo awhile back.
With that in mind, this commit implements a *warning* whenever a bad dependency
replacement is detected. The message here is pretty wordy, but it's intended to
convey that you should switch to using `[replace]` for a more robust
impelmentation, and it can also give security to anyone using `path` overrides
that if they get past this warning everything should work as intended.

[bug]: https://github.com/rust-lang/cargo/issues/2041
[implemented]: http://doc.crates.io/specifying-dependencies.html#overriding-dependencies

Closes #2041
src/cargo/core/registry.rs
src/cargo/sources/config.rs
tests/overrides.rs