问题来自您的Cargo.toml
in examples/ticktock:
[dependencies.mosquitto]
version = "*"
path = "../../../rust-mosquitto"
从 git 下载项目时,会扫描所有子目录以查找更多Cargo.toml
文件。如果你运行RUST_LOG=trace cargo build -v
,你会看到发生了什么:
TRACE:cargo::ops::cargo_read_manifest: looking for root package: /Users/shep/.cargo/git/checkouts/rust-mosquitto-77eb7033f32b19c9/master, source_id=https://github.com/kteza1/rust-mosquitto#7e08a291
TRACE:cargo::ops::cargo_read_manifest: looking for child package: /Users/shep/.cargo/git/checkouts/rust-mosquitto-77eb7033f32b19c9/master
TRACE:cargo::ops::cargo_read_manifest: read_package; path=/Users/shep/.cargo/git/checkouts/rust-mosquitto-77eb7033f32b19c9/master/Cargo.toml; source-id=https://github.com/kteza1/rust-mosquitto#7e08a291
TRACE:cargo::ops::cargo_read_manifest: looking for child package: /Users/shep/.cargo/git/checkouts/rust-mosquitto-77eb7033f32b19c9/master/.git
TRACE:cargo::ops::cargo_read_manifest: not processing /Users/shep/.cargo/git/checkouts/rust-mosquitto-77eb7033f32b19c9/master/.git
TRACE:cargo::ops::cargo_read_manifest: looking for child package: /Users/shep/.cargo/git/checkouts/rust-mosquitto-77eb7033f32b19c9/master/examples
TRACE:cargo::ops::cargo_read_manifest: looking for child package: /Users/shep/.cargo/git/checkouts/rust-mosquitto-77eb7033f32b19c9/master/examples/c-mosquitto
TRACE:cargo::ops::cargo_read_manifest: looking for child package: /Users/shep/.cargo/git/checkouts/rust-mosquitto-77eb7033f32b19c9/master/examples/ticktock
TRACE:cargo::ops::cargo_read_manifest: read_package; path=/Users/shep/.cargo/git/checkouts/rust-mosquitto-77eb7033f32b19c9/master/examples/ticktock/Cargo.toml; source-id=https://github.com/kteza1/rust-mosquitto#7e08a291
DEBUG:cargo: handle_error; err=CliError { error: ChainedError { error: Unable to update https://github.com/kteza1/rust-mosquitto, cause: Could not find `Cargo.toml` in `/Users/shep/.cargo/git/checkouts/rust-mosquitto-77eb7033f32b19c9/rust-mosquitto` }, unknown: false, exit_code: 101 }
Cargo 然后尝试确保嵌套Cargo.toml
可以满足所有依赖项。