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

Merged
merged 7 commits into from
Jun 13, 2024

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.

@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 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
@@ -70,12 +70,16 @@ mod opaque {

pub fn opaque_arg(_: impl Trait) -> i32 { 0 }
pub fn opaque_ret() -> impl Trait { unimplemented!() }
//~^ warn: this function depends on never type fallback being `()`
//~| warn: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to show what error would be emitted?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've implemented a rudimentary attempt at #126367

@compiler-errors
Copy link
Member

compiler-errors commented Jun 13, 2024

@bors r-

please rebase and bless tests, then r=me!

@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-review Status: Awaiting review from the assignee but also interested parties. labels Jun 13, 2024
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?)
@WaffleLapkin
Copy link
Member Author

@bors r=compiler-errors

@bors
Copy link
Contributor

bors commented Jun 13, 2024

📌 Commit ea98e42 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 13, 2024
@bors
Copy link
Contributor

bors commented Jun 13, 2024

⌛ Testing commit ea98e42 with merge b6e5e3f...

@bors
Copy link
Contributor

bors commented Jun 13, 2024

☀️ Test successful - checks-actions
Approved by: compiler-errors
Pushing b6e5e3f to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jun 13, 2024
@bors bors merged commit b6e5e3f into rust-lang:master Jun 13, 2024
7 checks passed
@rustbot rustbot added this to the 1.81.0 milestone Jun 13, 2024
@WaffleLapkin WaffleLapkin deleted the never-obligations branch June 13, 2024 18:49
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (b6e5e3f): comparison URL.

Overall result: ❌ regressions - no action needed

@rustbot label: -perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.2% [0.2%, 0.2%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (primary 1.3%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
5.5% [5.5%, 5.5%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.8% [-1.2%, -0.5%] 2
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 1.3% [-1.2%, 5.5%] 3

Cycles

Results (primary -3.4%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-3.4% [-7.0%, -1.0%] 14
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -3.4% [-7.0%, -1.0%] 14

Binary size

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

Bootstrap: 672.787s -> 671.147s (-0.24%)
Artifact size: 320.34 MiB -> 320.41 MiB (0.02%)

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jun 15, 2024
…never-obligation, r=WaffleLapkin

Point out failing never obligation for `DEPENDENCY_ON_UNIT_NEVER_TYPE_FALLBACK`

Based on top of rust-lang#125289, so just need to look at the last commit.

r? `@WaffleLapkin`
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Jun 15, 2024
Rollup merge of rust-lang#126367 - compiler-errors:point-out-failing-never-obligation, r=WaffleLapkin

Point out failing never obligation for `DEPENDENCY_ON_UNIT_NEVER_TYPE_FALLBACK`

Based on top of rust-lang#125289, so just need to look at the last commit.

r? `@WaffleLapkin`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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

8 participants