-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
Describe the problem you are trying to solve
We have a project that depends on rocket master branch
rocket = { git = "https://github.com/SergioBenitez/Rocket", rev = "41d7138540ca5fedbdfe5bc07cff8555c50b045b" }
while trying to do a path override with a local checkout of that project, cargo build was failing:
...
warning: path override for crate `state` has altered the original list of
dependencies; the dependency on `flume` was either added or
modified to not match the previously resolved version
...
error: no matching package named `flume` found
location searched: registry `https://github.com/rust-lang/crates.io-index`
perhaps you meant: mime, slug or time
required by package `state v0.0.0 (/home/alex/Projects/yocto-test/yocto/build/tmp/work/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/meta-rust-test/0.1.0.AUTOINC+fe8a5f15c8-r0/rocket)`
... which is depended on by `rocket v0.5.0-dev (/home/alex/Projects/yocto-test/yocto/build/tmp/work/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/meta-rust-test/0.1.0.AUTOINC+fe8a5f15c8-r0/rocket)`
The cause is that path overrides loads all the Cargo.toml files within the folders, in this case it loads this toml file coming from a rocket example
https://github.com/SergioBenitez/Rocket/blob/master/examples/state/Cargo.toml#L2
which overrides the state dependency that rocket uses (and also loads the extra flume dependency that's not included in the Cargo.lock file.
Renaming that crate to state-example or deleting the examples folder fixes the issue
Describe the solution you'd like
Since override path docs mention
Note: using a local configuration to override paths will only work for crates that have been published to crates.io. You cannot use this feature to tell Cargo how to find local unpublished crates.
it's probably safe to ignore Cargo.toml with publish=false
like the one in the example?
Notes
This first happened to us in meta-rust/meta-rust#349 which happens because for git dependencies meta-rust creates an override path for each git dependency (I think to make sure it fetches all the dependencies in the do_fetch stage)