Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cargo clippy invocation fails to properly parse arguments: error: Unrecognized option: 'all-packages' #9079

Closed
willbuckner opened this issue Jun 30, 2022 · 4 comments
Labels
C-bug Category: Clippy is not doing the correct thing

Comments

@willbuckner
Copy link

willbuckner commented Jun 30, 2022

Summary

After updating to Rust 1.62 stable (Clippy 0.1.62), cargo clippy fails to execute under multiple scenarios:

❱ cargo clippy
error: failed to run `rustc` to learn about target-specific information

Caused by:
  process didn't exit successfully: `/Users/will/.rustup/toolchains/stable-aarch64-apple-darwin/bin/clippy-driver rustc - --crate-name ___ --print=file-names --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=cfg` (exit status: 1)
  --- stderr
  error: Unrecognized option: 'all-packages'
❱ 
❱ command cargo +stable clippy
error: failed to run `rustc` to learn about target-specific information

Caused by:
  process didn't exit successfully: `/Users/will/.rustup/toolchains/stable-aarch64-apple-darwin/bin/clippy-driver rustc - --crate-name ___ --print=file-names --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=cfg` (exit status: 1)
  --- stderr
  error: Unrecognized option: 'all-packages'
❱ 
❱ command cargo clippy --all-targets --all-features -- -D warnings
error: failed to run `rustc` to learn about target-specific information

Caused by:
  process didn't exit successfully: `/Users/will/.rustup/toolchains/stable-aarch64-apple-darwin/bin/clippy-driver rustc - --crate-name ___ --print=file-names --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=cfg` (exit status: 1)
  --- stderr
  error: Unrecognized option: 'all-packages'

❱

The project was originally compiled with Rust 1.61 stable toolchain, and all targets had previously been built with 1.61. After the rustup update, I initially ran a simple cargo clippy which recompiled and ran clippy successfully.

However, attempting to use cargo clippy --all-packages the first time resulted in error: Unrecognized option: 'all-packages'. All subsequent clippy commands resulted in the same error: Unrecognized option: 'all-packages', though the errant option was never passed to these invocations. A cargo clean fixed the issue, and I haven't been able to reproduce again.

@jyn514 was able to reproduce this issue on x86_64 as well:

> command cargo +stable clippy 
error: failed to run `rustc` to learn about target-specific information

Caused by:
  process didn't exit successfully: `/home/jnelson/.local/lib/rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/clippy-driver rustc - --crate-name ___ --print=file-names --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=cfg` (exit status: 1)
  --- stderr
  error: Unrecognized option: 'all-targets'

Thanks! Let me know if there's any additional information I can provide, or tests I can run.

Reproducer

No response

Version

rustc 1.62.0 (a8314ef7d 2022-06-27)
binary: rustc
commit-hash: a8314ef7d0ec7b75c336af2c9857bfaf43002bfc
commit-date: 2022-06-27
host: aarch64-apple-darwin
release: 1.62.0
LLVM version: 14.0.5

clippy 0.1.62 (a8314ef7 2022-06-27)

Additional Labels

No response

@willbuckner willbuckner added the C-bug Category: Clippy is not doing the correct thing label Jun 30, 2022
@vnermolaev
Copy link

Same here

cargo clippy                             
error: failed to run `rustc` to learn about target-specific information

Caused by:
  process didn't exit successfully: `/Users/vic/.rustup/toolchains/stable-x86_64-apple-darwin/bin/clippy-driver rustc - --crate-name ___ --print=file-names --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=cfg` (exit status: 1)
  --- stderr
  error: Unrecognized option: 'all-features'
rustc 1.64.0 (a55dd71d5 2022-09-19)
clippy 0.1.64 (a55dd71d 2022-09-19)
host: x86_64-apple-darwin

@Qix-
Copy link

Qix- commented Jul 10, 2023

Running into this myself. Running clippy using --all --examples causes issues in one directory (Unrecognized option: examples) but not another. It was working fine in the faulty directory until I edited an example, and then out of the blue stopped working. No toolchain changes, nada. Nothing in Cargo.toml/.lock indicates that a different version of Clippy would be pulled.

Huge blocker :( No idea how to even debug this.

image

(Note that in the screenshot the repo is dirty; problem persists even on a git stash, and was working fine five minutes ago)


EDIT: for anyone finding this through search, my issue was that one directory had a toolchain file pinning a newer version of nightly, whereas the "faulty" directory was all-of-a-sudden picking up the system version, which was old enough not to have the related argument in rustc.

Using a toolchain file or updating my system installation fixes it. Hope that helps.

@Haradric
Copy link

I get the same issue after running:

cargo clippy -- --all-targets --all-features --tests -D warnings -W clippy::pedantic -W clippy::nursery -W rust-2018-idioms

Instead of:

cargo clippy --all-targets --all-features --tests -- -D warnings -W clippy::pedantic -W clippy::nursery -W rust-2018-idioms

After this, any clippy invocation came with this error. Deleting the target directory resolved the issue.

@Alexendoo
Copy link
Member

Tracking in #12623 as it has a reproducer

@Alexendoo Alexendoo closed this as not planned Won't fix, can't repro, duplicate, stale Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing
Projects
None yet
Development

No branches or pull requests

5 participants