Skip to content

clippy --fix broken since nightly 2020-12-21 #6487

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

Closed
matthiaskrgr opened this issue Dec 21, 2020 · 8 comments
Closed

clippy --fix broken since nightly 2020-12-21 #6487

matthiaskrgr opened this issue Dec 21, 2020 · 8 comments
Labels
C-bug Category: Clippy is not doing the correct thing I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@matthiaskrgr
Copy link
Member

Clippy was synced in the rustc repo a couple hours ago, it looks like this breaks cargo clippy --fix

RUSTC_WRAPPER="" ~/.cargo/bin/cargo +nightly clippy --fix -Zunstable-options
(RUSTC_WRAPPER is to disable sccache) works fine (this is rustc 1.50.0-nightly (1f5bc176b 2020-12-19))

RUSTC_WRAPPER="" ~/.cargo/bin/cargo +master clippy --fix -Zunstable-options does not seem to work

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

Caused by:
  process didn't exit successfully: `rustc - --crate-name ___ --print=file-names --no-deps --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=cfg` (exit code: 1)
  --- stderr
  error: Unrecognized option: 'no-deps'

cc @ebroto
You did some changes how --no-deps is passed in cc96955 ?

@matthiaskrgr matthiaskrgr added C-bug Category: Clippy is not doing the correct thing I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️ labels Dec 21, 2020
@ebroto
Copy link
Member

ebroto commented Dec 21, 2020

Uhm --no-deps should be removed since clippy is not enabled in that call always, I'll see if I can take a look soon, good catch.

@matthiaskrgr
Copy link
Member Author

I also noticed that when running x.py clippy on the rustc compiler, with master-clippy, it looks like there is a "--cap-lints warn" that somehow goes missing.

with 1.50.0-nightly (c609b2eaf 2020-12-20), x.py clippy works fine but with master, the process aborts pretty early because some lint warnings are denied, as if --cap-lints warn was missing.

I'm wondering if that is related.

@matthiaskrgr
Copy link
Member Author

matthiaskrgr commented Dec 22, 2020

Adding arguments like -- --cap-lints warn makes clippy completely recheck a project (including all dependencies) which was not the case before the sync.

I wonder why I didn't see that earlier given that I use master clippy here and there.. :/

edit: seems this is actually desired..?

        // HACK: pass Clippy args to the driver *also* through RUSTFLAGS.
        // This guarantees that new builds will be triggered when Clippy flags change.

edit2: perhaps we can exclude the deps from this (since we usually don't print warnings about these anyway?)

@matthiaskrgr matthiaskrgr changed the title clippy --fix broken in rustc master clippy --fix broken since nightly 2020-12-21 Dec 22, 2020
@ebroto
Copy link
Member

ebroto commented Dec 22, 2020

Adding arguments like -- --cap-lints warn makes clippy completely recheck a project

Oh this was for sure unintended. Can you try this on a clean build? (so a complete build without the flag then adding the flag)

Since I'm not going to have time to properly fix this soon (I'm on holidays), I will probably revert the change and try again in the future)

@matthiaskrgr
Copy link
Member Author

It looks like clippy automatically makes a clean build when --cap-lints is added. (it always rechecks everything when I add or remove the flag)

@flip1995
Copy link
Member

@ebroto Should we revert your changes and resync Clippy, so that this doesn't land in the beta, which is released on 2020-12-31?

@ebroto
Copy link
Member

ebroto commented Dec 22, 2020

@flip1995 yep that would be better as I'm not sure when I will be able to work on it, thanks!

it always rechecks everything when I add or remove the flag

Thinking a bit more about it, this is exactly how RUSTFLAGS are supposed to work, flags are passed also to deps.


I will try to find a different solution for the original problem (flag changes are ignored). RUSTFLAGS does not seem to be the best approach, but AFAIK there's nothing else available, so this might require asking for a feature in cargo.

bors added a commit that referenced this issue Dec 22, 2020
ci: test cargo clippy --fix -Zunstable-options

Make sure we catch cases like #6487 in CI in the future.

---

*Please write a short comment explaining your change (or "none" for internal only changes)*
changelog: none
@matthiaskrgr
Copy link
Member Author

cargo clippy--fix has been fixed some time ago, closing.

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 I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

3 participants