rust-lang / rust-lang/rust-clippy
`cargo clippy` fails to run if the `-- -A warnings` suffix is provided
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
Summary
When running the following on the Theseus OS code base
cargo clean && cargo clippy -Z build-std=core,alloc -Z build-std-features=compiler-builtins-mem --target cfg/x86_64-theseus.json --workspace --all-features -- -A warnings
We encounter the following output:
Click to expand the output
error: output of --print=file-names has changed in the compiler, cannot parse
command was: `/home/kevin/.rustup/toolchains/nightly-2022-06-17-x86_64-unknown-linux-gnu/bin/clippy-driver rustc - --crate-name ___ --print=file-names --target /tmp/Theseus/cfg/x86_64-theseus.json --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=cfg`
--- stdout
lib___.rlib
lib___.a
/home/kevin/.rustup/toolchains/nightly-2022-06-17-x86_64-unknown-linux-gnu
debug_assertions
feature="cargo-clippy"
panic="unwind"
proc_macro
target_abi=""
target_arch="x86_64"
target_endian="little"
target_env=""
target_feature="llvm14-builtins-abi"
target_has_atomic="16"
target_has_atomic="32"
target_has_atomic="64"
target_has_atomic="8"
target_has_atomic="ptr"
target_has_atomic_equal_alignment="16"
target_has_atomic_equal_alignment="32"
target_has_atomic_equal_alignment="64"
target_has_atomic_equal_alignment="8"
target_has_atomic_equal_alignment="ptr"
target_has_atomic_load_store="16"
target_has_atomic_load_store="32"
target_has_atomic_load_store="64"
target_has_atomic_load_store="8"
target_has_atomic_load_store="ptr"
target_os="theseus"
target_pointer_width="64"
target_vendor="unknown"
Note that when removing the -- -A warnings, it works as expected. Funnily enough, it also works with -- -D warnings. Quite strange.
Reproducer
Clone the Theseus repo:
git clone --recursive --depth 1 git@github.com:theseus-os/Theseus.git
Then run the above command in the new Theseus directory:
cd Theseus
cargo clean && cargo clippy -Z build-std=core,alloc -Z build-std-features=compiler-builtins-mem --target cfg/x86_64-theseus.json --workspace --all-features -- -A warnings
Try removing the -A warnings or changing it to -D warnings, and it works as expected.
Version
As we can only build Theseus with nightly Rust, I tried several nightly versions; all 3 resulted in the same failure.
- nightly-2022-03-21
- nightly-2022-05-21
- nightly-2022-06-17
Output from the latest one:
rustc 1.63.0-nightly (cacc75c82 2022-06-16)
binary: rustc
commit-hash: cacc75c82ebe15cf63d31034fcf7f1016cddf0e2
commit-date: 2022-06-16
host: x86_64-unknown-linux-gnu
release: 1.63.0-nightly
LLVM version: 14.0.5
Additional Labels
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the command in the Theseus repository with nightly Rust, comparing -A warnings, no lint suffix, and -D warnings. Trace how cargo-clippy passes lint arguments to clippy-driver and how the compiler parses --print=file-names. Done means the reported command completes successfully with -A warnings while the other variants continue to work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100