Cargo build, cargo install: very different results

I have taken a multi-year Rust hiatus, but I am trying again to use it.

I have a Rust application that I build and install with

cargo install --path . --force

when cd-ed to the application's directory. This results in the application building, installing and running correctly.

But now I want to run clippy. Again, cd-ed to the application's directory,



   Compiling gtk-sys v0.17.0
   Compiling glib-sys v0.15.10
    Checking futures-util v0.3.1
error[E0432]: unresolved import `futures_macro::_proc_macro_hack_join`
  --> /home/dca/.cargo/registry/src/
78 |     pub use futures_macro::join;
   |             ^^^^^^^^^^^^^^^^^^^ no `_proc_macro_hack_join` in the root

error[E0432]: unresolved import `futures_macro::_proc_macro_hack_try_join`
  --> /home/dca/.cargo/registry/src/
81 |     pub use futures_macro::try_join;
   |             ^^^^^^^^^^^^^^^^^^^^^^^ no `_proc_macro_hack_try_join` in the root

error[E0432]: unresolved import `futures_macro::_proc_macro_hack_select`
   --> /home/dca/.cargo/registry/src/
162 |     pub use futures_macro::select;
    |             ^^^^^^^^^^^^^^^^^^^^^ no `_proc_macro_hack_select` in the root

   Compiling thiserror v1.0.30
   Compiling proc-macro-crate v1.1.3
For more information about this error, try `rustc --explain E0432`.
error: could not compile `futures-util` due to 3 previous errors

Hmm. So I tried

cargo build

Same error.

Noting that cargo install does a --release build, I tried

cargo build --release

Same error.

I then sent the output of cargo build --release and cargo install (both done after cargo clean) to files, which I then sorted, because I noted that things get compiled in different orders in the two. Diff-ing the sorted output files reveals that the versions of many of the dependencies are different in the two, those in the (error-free) cargo install run being later (higher versions).

So while my application works, my problem is that

a. I can't use clippy because of this issue.
b. Why do these two commands that I think can reasonably expected to do the same build actually do very different builds, with different dependency versions?

I should add that none of the version differences involve direct dependencies of my application, which I specify very tightly in my Cargo.toml file.

Any insights into what's happening here would be appreciated.

cargo install doesn't use any existing Cargo.lock unless you force it --locked. Since the newer versions are working, cargo update should solve your local build.

Indeed it does. Thank you for the help.