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?)
@compiler-errors
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Jun 11, 2024

📌 Commit b73eb9a has been approved by compiler-errors

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 11, 2024
@compiler-errors
Copy link
Member

actually wait wait i forgot to run perf ever

@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 11, 2024
@compiler-errors
Copy link
Member

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jun 11, 2024
@bors
Copy link
Contributor

bors commented Jun 11, 2024

⌛ Trying commit b73eb9a with merge 3b63bac...

bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 11, 2024
Implement lint for obligations broken by never type fallback change

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:
- rust-lang#123748
@bors
Copy link
Contributor

bors commented Jun 11, 2024

☀️ Try build successful - checks-actions
Build commit: 3b63bac (3b63bac3a576b3585ff60fba3a402eb40d159591)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (3b63bac): comparison URL.

Overall result: no relevant changes - no action needed

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf.

@bors rollup=never
@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

This benchmark run did not return any relevant results for this metric.

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 676.994s -> 679.008s (0.30%)
Artifact size: 320.03 MiB -> 320.10 MiB (0.02%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jun 11, 2024
@compiler-errors
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Jun 11, 2024

📌 Commit b73eb9a has been approved by compiler-errors

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 11, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 12, 2024
…mpiler-errors

Implement lint for obligations broken by never type fallback change

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:
- rust-lang#123748
@bors
Copy link
Contributor

bors commented Jun 12, 2024

⌛ Testing commit b73eb9a with merge a3baa7b...

@rust-log-analyzer
Copy link
Collaborator

The job rfl failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
[RUSTC-TIMING] rustc_traits test:false 13.634
   Compiling rustc_mir_transform v0.0.0 (/checkout/compiler/rustc_mir_transform)
[RUSTC-TIMING] rustc_resolve test:false 66.318
   Compiling rustc_hir_typeck v0.0.0 (/checkout/compiler/rustc_hir_typeck)
error[E0599]: no variant or associated item named `FallbackToUnit` found for enum `DivergingFallbackBehavior` in the current scope
    |
    |
20  | pub enum DivergingFallbackBehavior {
    | ---------------------------------- variant or associated item `FallbackToUnit` not found for this enum
...
480 |         let DivergingFallbackBehavior::FallbackToUnit = behavior else { return };
    |                                        ^^^^^^^^^^^^^^ variant or associated item not found in `DivergingFallbackBehavior`
[RUSTC-TIMING] rustc_mir_build test:false 43.190
   Compiling rustc_passes v0.0.0 (/checkout/compiler/rustc_passes)
For more information about this error, try `rustc --explain E0599`.
[RUSTC-TIMING] rustc_hir_typeck test:false 5.945

@bors
Copy link
Contributor

bors commented Jun 12, 2024

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 12, 2024
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

7 participants