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

Fix Clippy subcommand name #5873

Closed
wants to merge 1 commit into from

Conversation

camelid
Copy link
Member

@camelid camelid commented Aug 7, 2020

Fixes #5640.

changelog: none

@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @yaahc (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Aug 7, 2020
@camelid
Copy link
Member Author

camelid commented Aug 7, 2020

I wasn't able to verify that this works because clippy won't build for me (it says it can't find rustc_ast). Is there something about this in CONTRIBUTING.md?

EDIT: Oops, didn't see the "basics" docs

@yaahc
Copy link
Member

yaahc commented Aug 7, 2020

@camelid you probably need to run setup-toolchain.sh

if that's not it lmk and I'll help you dig into the issue.

@camelid
Copy link
Member Author

camelid commented Aug 7, 2020

@yaahc Thanks! I just ran it, though now I'm getting compiler errors. Is this because Clippy depends on rustc internals?

Here's all the errors:

error[E0023]: this pattern has 1 field, but the corresponding tuple variant has 2 fields
    --> clippy_lints/src/utils/ast_utils.rs:509:14
     |
509  |             (DocComment(l), DocComment(r)) => l == r,
     |              ^^^^^^^^^^^^^ expected 2 fields, found 1

error[E0023]: this pattern has 1 field, but the corresponding tuple variant has 2 fields
    --> clippy_lints/src/utils/ast_utils.rs:509:29
     |
509  |             (DocComment(l), DocComment(r)) => l == r,
     |                             ^^^^^^^^^^^^^ expected 2 fields, found 1

error[E0023]: this pattern has 1 field, but the corresponding tuple variant has 2 fields
    --> clippy_lints/src/doc.rs:321:16
     |
321  |         if let AttrKind::DocComment(ref comment) = attr.kind {
     |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected 2 fields, found 1

error[E0023]: this pattern has 1 field, but the corresponding tuple variant has 2 fields
    --> clippy_lints/src/tabs_in_doc_comments.rs:63:16
     |
63   |         if let ast::AttrKind::DocComment(comment) = attr.kind {
     |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected 2 fields, found 1

error: aborting due to 4 previous errors

For more information about this error, try `rustc --explain E0023`.
error: could not compile `clippy_lints`.

@yaahc
Copy link
Member

yaahc commented Aug 7, 2020

Is this because Clippy depends on rustc internals?

AFAIK yes. Whenever they change internal APIs we have to update them in clippy to match. I'm a little surprised though because I thought they just finished making it so clippy is tested on every rustc PR to prevent these kinds of breakages but I don't know the details of how the new subtree stuff works so I'm guessing its still possible for breakages to occur.

cc @flip1995 @matthiaskrgr

@ebroto
Copy link
Member

ebroto commented Aug 7, 2020

@yaahc setup-toolchain.sh still uses rust-lang/rust master's HEAD (including the breaking changes for clippy). There are plans to pin to a nightly, but it's blocked on rust-lang/rustup#2350

@camelid I'm afraid your solution won't work. cargo-clippy correctly calls cargo check setting RUSTC_WRAPPER to point to clippy-driver, which is called by cargo instead of rustc.

If I'm not mistaken, the problem in the issue you linked is that you were using a wrong command-line which is not understood by cargo check, so it errors out.

@flip1995
Copy link
Member

flip1995 commented Aug 7, 2020

@yaahc Clippy has to pass tests in rustc, but the changes to fix clippy have to be synced back to Clippy. Currently the subtree usage only makes it easier to do a rustup. @ebroto pointed out the rest of the story. (See discord why I didn't sync Clippy yet.)

We should fix this issue $somehow, but we definitely need a test for this (after it is fixed).

@camelid
Copy link
Member Author

camelid commented Aug 7, 2020

@yaahc I just opened #5874 to try to make it extra obvious that you need to run a script to set up your toolchain.

@camelid
Copy link
Member Author

camelid commented Aug 7, 2020

@camelid I'm afraid your solution won't work. cargo-clippy correctly calls cargo check setting RUSTC_WRAPPER to point to clippy-driver, which is called by cargo instead of rustc.

Ah, that's unfortunate. It just seems confusing that errors from running cargo clippy make it look like you were running cargo check.

@flip1995
Copy link
Member

This produces error: infinite recursion detected when running the cargo clippy command

Closing this, since I think, that this has to be fixed in cargo, rather than Clippy.

@flip1995 flip1995 closed this Aug 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clippy's CLI usage error screen shows cargo check
5 participants