Skip to content

Cargo caches failed cargo clippy -- --bad-arg #14385

@Alexendoo

Description

@Alexendoo

Problem

From rust-lang/rust-clippy#12623 (comment):

cargo new --lib demo && cd demo

cargo check
cargo clippy -- -x
cargo clippy
  • The first clippy/check creates the target dir including target/.rustc_info.json, it seems failures aren't recorded in .rustc_info.json if it doesn't exist yet
  • In the second command cargo records the result of the target info acquisition under a different hash
  • The third command uses the same hash to retrieve the previously failed result

The issue being CLIPPY_ARGS is not taken into account when creating the hash

Output:

    Creating library `demo` package
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
    Checking demo v0.1.0 (/.../demo)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.14s
error: process didn't exit successfully: `/.../rustc -vV` (exit status: 1)
--- stderr
error: Unrecognized option: 'x'


error: process didn't exit successfully: `/.../clippy-driver /.../rustc -vV` (exit status: 1)
--- stderr
error: Unrecognized option: 'x'

cargo clippy -- -x is expected to fail but the following cargo clippy is not

In normal operation clippy-driver gets far enough along to register CLIPPY_ARGS into the env depinfo but that doesn't happen here

Steps

No response

Possible Solution(s)

CLIPPY_ARGS could be added to the fingerprint as a special case, but the issue could also exist for other wrappers

Notes

No response

Version

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-cachingArea: caching of dependencies, repositories, and build artifactsC-bugCategory: bugregression-from-stable-to-stableRegression in stable that worked in a previous stable release.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions