Uh oh!
There was an error while loading. Please reload this page.
Add a "diagnostic item" scheme for lints referring to libstd items - #60966
Conversation
Uh oh!
There was an error while loading. Please reload this page.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
bors
commented
May 23, 2019
☔ The latest upstream changes (presumably #61044) made this pull request unmergeable. Please resolve the merge conflicts. |
oli-obk
commented
May 25, 2019
@rust-lang/compiler Are you alright with adding this scheme (similar to lang items) for diagnostic items, allowing rustc lints and clippy lints to ask the compiler whether a specific |
michaelwoerister
commented
May 27, 2019
Is there an overview somewhere of what "diagnostic items" are and why the concept is needed? |
oli-obk
commented
May 27, 2019
The list of things that we want to make diagnostic items include (but are not limited to) https://github.com/rust-lang/rust-clippy/blob/abe139c7ac7d5a33a6edb60ba0d4eb4dfaf11103/clippy_lints/src/utils/paths.rs#L4-L115 Now our scheme (of using
Furthermore, some rustc diagnostics have to go through pretty printing types and matching on the result like in rust/src/librustc_mir/borrow_check/move_errors.rs Lines 317 to 322 in ed2a511 This PR will allow making all of these libcore/libstd specific errors and lints much simpler and reduce the complexity needed around them. |
bors
commented
May 27, 2019
☔ The latest upstream changes (presumably #60827) made this pull request unmergeable. Please resolve the merge conflicts. |
eddyb
commented
May 28, 2019
@oli-obk You can always look up the But I am not strongly in favor of either, sometimes I'd rather |
Manishearth
commented
May 28, 2019
Note that lookups are pretty slow compared to this scheme. I would like to expose name resolution machinery, though, we need that anyway for rustdoc.
It would need to behave exactly the same way Option does in the contexts any given lint cares about, so pattern matching that ("does it have a function named X?" etc) gets much more expensive |
@Manishearth I agree about pattern-matching requiring custom logic, which has a time/effort cost to write in the first place - however, the cost to run a lookup/pattern-match is easily amortized by caching. |
oli-obk
commented
May 29, 2019
I want to add a scheme like Note that this change is done out of three reasons:
tbh, the last three are why I did this |
bors
commented
Jun 2, 2019
☔ The latest upstream changes (presumably #61276) made this pull request unmergeable. Please resolve the merge conflicts. |
oli-obk
commented
Jun 6, 2019
Heh, one idea I just had: We can pattern match definitions and suggest that the user add |
Dylan-DPC-zz
commented
Jul 1, 2019
ping from triage @Manishearth@oli-obk any updates? |
bors
commented
Aug 29, 2019
📌 Commit 26e9990 has been approved by |
rust-highfive
commented
Aug 30, 2019
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
Centril
commented
Aug 30, 2019
@bors r- PR builder is unhappy ^-- |
oli-obk
commented
Aug 30, 2019
@bors r=eddyb |
bors
commented
Aug 30, 2019
📌 Commit 6978b94 has been approved by |
bors
commented
Aug 30, 2019
Add a "diagnostic item" scheme for lints referring to libstd items fixes#39131 r? @Manishearth@rust-lang/wg-diagnostics
bors
commented
Aug 30, 2019
☀️ Test successful - checks-azure |
rust-highfive
commented
Aug 30, 2019
📣 Toolstate changed by #60966! Tested on commit c7d4df0. 💔 clippy-driver on windows: test-pass → build-fail (cc @Manishearth@llogiq@mcarton@oli-obk@phansch@flip1995, @rust-lang/infra). |
Tested on commit rust-lang/rust@c7d4df0. Direct link to PR: <rust-lang/rust#60966> 💔 clippy-driver on windows: test-pass → build-fail (cc @Manishearth@llogiq@mcarton@oli-obk@phansch@flip1995, @rust-lang/infra). 💔 clippy-driver on linux: test-pass → build-fail (cc @Manishearth@llogiq@mcarton@oli-obk@phansch@flip1995, @rust-lang/infra). 💔 rls on linux: test-pass → test-fail (cc @Xanewok, @rust-lang/infra).
Rustup to rust-lang/rust#60966 changelog: none
Rustup to rust-lang/rust#60966 changelog: none
fixes#39131
r? @Manishearth @rust-lang/wg-diagnostics