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

Implement lint for obligations broken by never type fallback change #125289

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

WaffleLapkin
Copy link
Member

@WaffleLapkin WaffleLapkin commented May 19, 2024

This is the second (and probably last major?) lint required for the never type fallback change.

The idea is to check if the code errors with fallback = () and if it errors with fallback = ! and if it went from "ok" to "error", lint.

I'm not happy with the diagnostic, ideally we'd highlight what bound is the problem. But I'm really unsure how to do that (cc @jackh726, iirc you had some ideas?)

r? @compiler-errors

Thanks @BoxyUwU with helping with trait solver stuff when I was implementing the initial version of this lint.

Tracking:

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 19, 2024
@rust-log-analyzer

This comment has been minimized.

@jackh726
Copy link
Member

I'm not happy with the diagnostic, ideally we'd highlight what bound is the problem. But I'm really unsure how to do that

So, yeah, we talked about this. IIRC, what I said was basically like "we can't find diff two error sets" but as long as we only try to report ! fallback errors if () fallback errors are empty, that's probably fine...

We can chat on zulip about details here, but I would probably approach this by selecting a couple test cases where you want better diagnostics, then look at the errors that you get and what info is there, then figure out how to extract out that info. Then you can generalize across tests.

compiler/rustc_hir_typeck/src/fallback.rs Outdated Show resolved Hide resolved
compiler/rustc_hir_typeck/src/fallback.rs Outdated Show resolved Hide resolved
compiler/rustc_hir_typeck/src/fallback.rs Outdated Show resolved Hide resolved
compiler/rustc_hir_typeck/src/fallback.rs Outdated Show resolved Hide resolved
compiler/rustc_hir_typeck/src/fallback.rs Outdated Show resolved Hide resolved
@WaffleLapkin
Copy link
Member Author

Quite a few of existing tests get the warning, should I do something with it? The options I see are bless them (what I currently did), fix them and allow the warning.

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented May 20, 2024

☔ The latest upstream changes (presumably #125313) made this pull request unmergeable. Please resolve the merge conflicts.

@rustbot
Copy link
Collaborator

rustbot commented May 21, 2024

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

Don't depend on the fact that `!` falls back to `()` and so panic-ish things
can be used in `-> impl ImplementedForUnit` functions
looks like prim@ stuff does not work here (is it possibly not handled by rustdoc at all?)
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. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants