emilk/egui

Cargo-machete 0.9+ failing on 1.85 toolchain

Closed this issue · 1 comments

Describe the bug

Since the versions were bumped to 0.32.1, the Cargo Machete workflow is failing with:

Caused by:
  rustc 1.85.1 is not supported by the following packages:
    cargo-util-schemas@0.8.2 requires rustc 1.86
    cargo_metadata@0.21.0 requires rustc 1.86.0
Error: Process completed with exit code 101.

Using toolchain 1.86 just for that workflow leads to an additional error:

error[E0658]: `let` expressions in this position are unstable
   --> /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/cargo-machete-0.9.0/src/search_unused.rs:295:12
    |
295 |           if let Ok(workspace_manifest) =
    |  ____________^
296 | |             cargo_toml::Manifest::<PackageMetadata>::from_path_with_metadata(&workspace_cargo_path)
    | |___________________________________________________________________________________________________^
    |
    = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information

For more information about this error, try `rustc --explain E0658`.
error: could not compile `cargo-machete` (bin "cargo-machete") due to 1 previous error
error: failed to compile `cargo-machete v0.9.0`, intermediate artifacts can be found at `/tmp/cargo-installHoLP0f`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.
Error: Process completed with exit code 101.

But using 1.88 does solve that workflow. Using 1.88 in all workflows results in:

error[E0463]: can't find crate for `std`
  |
  = note: the `aarch64-linux-android` target may not be installed
  = help: consider downloading the target with `rustup target add aarch64-linux-android`

For more information about this error, try `rustc --explain E0463`.
error: could not compile `emath` (lib) due to 1 previous error
Error: Process completed with exit code 101.

And a similar error for the aarch64-apple-ios target.

To Reproduce
Steps to reproduce the behavior:

  1. Run the Cargo Machete workflow with current main as the base branch.
  2. Bump the toolchains in the workflows.

Additional context

This workflow was working fine before I synced main to version 0.32.1, so it seems like some recent change (within the last week or two).

I attempted to fix this with #7459, but I didn't understand the project uses the same toolchain version everywhere. @bircni suggested switching to cargo-shear for dependency pruning.

Sorry about the nonsense regarding recent merges. This issue came up because the workflow does not use a specific cargo-machete version.

The fix is simply to install a specific version: run: cargo install --version 0.8.0 cargo-machete --locked