Cargo check not compiling despite code does

I am confused why cargo check does not compile (wanted to use clippy)
but cargo build does??

I try to use it in the following project: GitHub - gabyx/RsMarkdown2PDF-Service: Learning material/implementation of a simple `markdown` to `pdf` converting service using Rust, kind, Tilt, just, Nix
I get lots of compiler warnings such as:

  --> /home/nixos/.cargo/registry/src/
32 | ...replace(UnfoldState::Empty) {
   |            ^^^^^^^^^^^ use of undeclared type `UnfoldState`

error[E0433]: failed to resolve: use of undeclared type `UnfoldStateProjReplace`
  --> /home/nixos/.cargo/registry/src/
33 |                 UnfoldStateProjReplace::Value { value } => Some(value),
   |                 ^^^^^^^^^^^^^^^^^^^^^^ use of undeclared type `UnfoldStateProjReplace`

Some errors have detailed explanations: E0412, E0422, E0432, E0433, E0514, E0574.
error: could not compile `futures-util` (lib) due to 1371 previous errors

What key insight do I miss here? Somehow cargo build does compile differently...?

It seams after a cargo clean everything builds? Why could that be??

Computer's haunted.

1 Like

cargo/rustc detection of what needs to be recompiled is wonky in some cases.

Thats true, sometimes experiences mutliple times rebuilds in tokio/rocket although it already compiled it...

That's different. Multiple rebuilds are probably related to feature unification - you having a workspace, different members of a workspace depend on tokio/rocket with different features and you are using cargo run or cargo check with -p xxx.

To check you can run something like cargo tree -f '{p} {f}' --prefix none | grep -v '(*)' | sort -u. If you see the same version of any crate with multiple sets of features listed - that's it.

Possibly it is related to cache invalidation if the build configuration is changed between runs.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.