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

x.py clippy fails with E0277 and E0658 #79244

Closed
Nicholas-Baron opened this issue Nov 20, 2020 · 19 comments
Closed

x.py clippy fails with E0277 and E0658 #79244

Nicholas-Baron opened this issue Nov 20, 2020 · 19 comments
Labels
A-clippy Area: Clippy T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@Nicholas-Baron
Copy link
Contributor

Nicholas-Baron commented Nov 20, 2020

Trying to run ./x.py clippy using the beta toolchain's clippy results in ~32 errors.

Raw output

There are a bunch of attribute should be applied to a macro errors, then a E0658 (impl Trait not allowed on const fns), and finally 3 E0277 (the size of Self is not known at compile time). All seem to come out of library/core.

@Nicholas-Baron
Copy link
Contributor Author

@rustbot modify labels to +A-clippy and +A-rustbuild.

@rustbot rustbot added A-clippy Area: Clippy T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Nov 20, 2020
@jyn514
Copy link
Member

jyn514 commented Nov 21, 2020

@Nicholas-Baron you need to update your version of beta. This is the error I get, which is an internal error in clippy:

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', src/tools/clippy/clippy_lints/src/methods/mod.rs:3904:68
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy/issues/new

note: Clippy version: clippy 0.0.212 (603ab5b 2020-11-15)

@jyn514 jyn514 closed this as completed Nov 21, 2020
@Nicholas-Baron
Copy link
Contributor Author

My version of clippy (from cargo clippy -V) is clippy 0.0.212 (7eac88a 2020-11-16), which is technically later than yours, @jyn514.

@jyn514
Copy link
Member

jyn514 commented Nov 21, 2020

Whoops, I was using the wrong clippy, sorry.

@jyn514 jyn514 reopened this Nov 21, 2020
@Nicholas-Baron
Copy link
Contributor Author

Nicholas-Baron commented Nov 25, 2020

@jyn514 I ran ./x.py clippy on a whim today and I got the same error you got.

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', src/tools/clippy/clippy_lints/src/methods/mod.rs:3904:68
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy/issues/new

note: Clippy version: clippy 0.0.212 (21dea46 2020-11-18)

query stack during panic:
#0 [analysis] running analysis passes on this crate
end of query stack
warning: 280 warnings emitted

In the end, whether running either version documented here, ./x.py clippy cannot go through the entire project.

Update: checked the version number (cargo clippy -V) and it is clippy 0.0.212 (21dea46 2020-11-18).

@jyn514
Copy link
Member

jyn514 commented Nov 25, 2020

@Nicholas-Baron I am unlikely to have time to look into this in the near future. I vaguely remember there being an issue open for the clippy ICE, but feel free to open one (in the clippy repo, not here) if there isn't.

@Nicholas-Baron
Copy link
Contributor Author

@jyn514 Set up an issue on the clippy end. Closing as it will probably be handled by clippy.

@Nicholas-Baron
Copy link
Contributor Author

@jyn514 So the issue is resolved on their end. (See pull request 6304)
However, it looks like the commit that fixes the issue is not synced with what ./x.py is using.

@jyn514
Copy link
Member

jyn514 commented Nov 30, 2020

@Nicholas-Baron x.py clippy uses your host version of clippy, it's not related to the commit you have checked out. You need to rustup update nightly.

@jyn514
Copy link
Member

jyn514 commented Nov 30, 2020

Hmm, and that fails with its own error:

thread 'rustc' panicked at 'forcing query with already existing `DepNode`
- query-key: (DefId(0:3866 ~ rustc_middle[1bf6]::ty::codec::TyDecoder), Some(Error#7290))
- dep-node: super_predicates_that_define_assoc_type(5a78152153c9663-dcf2c310262fcf17)', /rustc/349b3b324dade7ca638091db93ba08bbc443c63d/compiler/rustc_query_system/src/query/plumbing.rs:586:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy/issues/new

note: Clippy version: clippy 0.0.212 (349b3b3 2020-11-29)

query stack during panic:
#0 [fn_sig] computing function signature of `<rustc_index::vec::IndexVec<mir::Promoted, mir::Body<'tcx>> as ty::codec::RefDecodable<'tcx, D>>::decode`
#1 [collect_mod_item_types] collecting item types in module `ty::codec`
end of query stack

which looks like #79560.

@Nicholas-Baron
Copy link
Contributor Author

So, when developing rustc, is it best to use nightly and not beta?
I do not remember reading which one was correct.

@jyn514
Copy link
Member

jyn514 commented Nov 30, 2020

x.py clippy is not really supported either way - it's "best-effort" for both. I used nightly because beta panics, that's the bug you pointed out in #79244 (comment).

@Nicholas-Baron
Copy link
Contributor Author

So clippy is not even officially supported for this repo. No wonder it dumps hundreds of warnings and broke because of some edits somewhere.

In the meantime, I will switch to nightly and report the error to clippy.

@jyn514
Copy link
Member

jyn514 commented Dec 1, 2020

@Nicholas-Baron no need to report an error, there's already an issue open: #79560

@jyn514
Copy link
Member

jyn514 commented Dec 1, 2020

and yeah, I don't think anyone even tried to use clippy before you opened an issue 😆 you saw I had to add a whole new part of bootstrap just for it.

@Nicholas-Baron
Copy link
Contributor Author

Nicholas-Baron commented Dec 1, 2020

@jyn514 I just want Rust tools to work in the Rust compiler, that is all. Also, the option was there. If you give people a button, they will push it.
Ok, so "sit and wait" is what I am hearing.

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Dec 1, 2020

@Nicholas-Baron in order to use clippy on rustc, I found this recipe to work in most of the cases (trying to deal with beta-clippy or outdated nightly clippy is just too much pain imo)
rust-lang/rust-clippy#6383 (comment)
hope it helps somehow.

@Nicholas-Baron
Copy link
Contributor Author

@matthiaskrgr Even if it works, the recipe seems a bit long to get a simple ./x.py clippy working. To me, the fact that ./x.py help even shows a clippy option means to me that it should work like ./x.py check or ./x.py build:

  • Without hassle
  • No special recipes
  • "It just works"

To me, if a tool provides an option, that option must be maintained and "just work". All of x.py's other options work, so why not this one?

@jyn514
Copy link
Member

jyn514 commented Dec 1, 2020

@Nicholas-Baron the alternative is I can remove the option 🤷 all the work in this repo is on a volunteer basis and we just don't have the manpower to make everything work out of the box. If you want help fixing the issues I'm happy to give you suggestions, but complaining about it doesn't help anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-clippy Area: Clippy T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

No branches or pull requests

4 participants