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

Cleanup opaque_type_cycle_error #135307

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yotamofek
Copy link
Contributor

@yotamofek yotamofek commented Jan 9, 2025

Small cleanup opportunity found while reading the code: the label: bool var isn't really needed since there's only one execution path that sets is to true. Also, tried to reduce right-ward drift.

Best reviewed by hiding whitespace

@rustbot
Copy link
Collaborator

rustbot commented Jan 9, 2025

r? @jieyouxu

rustbot has assigned @jieyouxu.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@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 Jan 9, 2025
@rust-log-analyzer

This comment has been minimized.

@compiler-errors
Copy link
Member

LGTM. The CI failure is unrelated.

r? compiler-errors @bors r+ rollup

@bors
Copy link
Contributor

bors commented Jan 9, 2025

📌 Commit ad0e8dd has been approved by compiler-errors

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Jan 9, 2025

🌲 The tree is currently closed for pull requests below priority 1000. This pull request will be tested once the tree is reopened.

@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 Jan 9, 2025
workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Jan 10, 2025
…e-error, r=compiler-errors

Cleanup `opaque_type_cycle_error`

Small cleanup opportunity found while reading the code: the `label: bool` var isn't really needed since there's only one execution path that sets is to `true`. Also, tried to reduce right-ward drift.

Best reviewed by hiding whitespace
@compiler-errors
Copy link
Member

Gonna close/reopen to bump CI, I think this caused the rollup to fail #135317 (comment)

@compiler-errors
Copy link
Member

@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 Jan 10, 2025
@rust-log-analyzer

This comment has been minimized.

@yotamofek
Copy link
Contributor Author

yotamofek commented Jan 10, 2025

Ahh jeez, sorry about that @compiler-errors , I was accidentally running the wrong tests locally before pushing 😅

I dived a little deeper into this function and it seems that this if is never taken:

if visitor
.returns
.iter()
.filter_map(|expr| typeck_results.node_type_opt(expr.hir_id))
.all(|ty| matches!(ty.kind(), ty::Never))

i.e., I replaced its body with a panic!() and ran ./x suggest --run, and all the tests passed.
So either it's unreachable, and return paths never resolve to a ty::Never, or there's no test exercising this. So I tried to but couldn't come up with a test that does, see futile attempt here: https://godbolt.org/z/91fW8Ea5b
Any idea what's going on here?

@yotamofek yotamofek force-pushed the cleanup-opaque-type-cycle-error branch from ad0e8dd to b931b4b Compare January 10, 2025 20:04
@yotamofek
Copy link
Contributor Author

Fixed for now, but couldn't find a decent way to not duplicate the span_label call. I'm not sure this PR is still a worthwhile improvement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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.

6 participants