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

fix: introduce new type var when expectation for ref pat is not ref #14872

Merged
merged 1 commit into from May 22, 2023

Conversation

lowr
Copy link
Contributor

@lowr lowr commented May 22, 2023

Fixes #14840

When we infer the type of ref patterns, its expected type may not be reference type: 1) expected type is an unresolved inference variable, or 2) expected type is erroneously other kind of type. In either case, we should produce a reference type with a new type variable rather than an error type so that we can continue inferring the inner patterns without further errors because of the (possible) type mismatch of this pattern.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 22, 2023
@HKalbasi
Copy link
Member

@bors r+

@bors
Copy link
Collaborator

bors commented May 22, 2023

📌 Commit 01f42d2 has been approved by HKalbasi

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented May 22, 2023

⌛ Testing commit 01f42d2 with merge 925ae13...

bors added a commit that referenced this pull request May 22, 2023
fix: introduce new type var when expectation for ref pat is not ref

Fixes #14840

When we infer the type of ref patterns, its expected type may not be reference type: 1) expected type is an unresolved inference variable, or 2) expected type is erroneously other kind of type. In either case, we should produce a reference type with a new type variable rather than an error type so that we can continue inferring the inner patterns without further errors because of the (possible) type mismatch of this pattern.
@HKalbasi
Copy link
Member

bors died again?

@HKalbasi HKalbasi closed this May 22, 2023
@HKalbasi HKalbasi reopened this May 22, 2023
@HKalbasi
Copy link
Member

@bors r-

@HKalbasi
Copy link
Member

@bors r+

@bors
Copy link
Collaborator

bors commented May 22, 2023

📌 Commit 01f42d2 has been approved by HKalbasi

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented May 22, 2023

⌛ Testing commit 01f42d2 with merge d70ecde...

bors added a commit that referenced this pull request May 22, 2023
fix: introduce new type var when expectation for ref pat is not ref

Fixes #14840

When we infer the type of ref patterns, its expected type may not be reference type: 1) expected type is an unresolved inference variable, or 2) expected type is erroneously other kind of type. In either case, we should produce a reference type with a new type variable rather than an error type so that we can continue inferring the inner patterns without further errors because of the (possible) type mismatch of this pattern.
@HKalbasi
Copy link
Member

@bors r-

@HKalbasi HKalbasi closed this May 22, 2023
@HKalbasi HKalbasi reopened this May 22, 2023
@HKalbasi
Copy link
Member

@bors r+

@bors
Copy link
Collaborator

bors commented May 22, 2023

📌 Commit 01f42d2 has been approved by HKalbasi

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented May 22, 2023

⌛ Testing commit 01f42d2 with merge 2120c91...

@bors
Copy link
Collaborator

bors commented May 22, 2023

☀️ Test successful - checks-actions
Approved by: HKalbasi
Pushing 2120c91 to master...

@bors bors merged commit 2120c91 into rust-lang:master May 22, 2023
28 checks passed
@HKalbasi
Copy link
Member

This brings the pattern type mismatches on self down to zero 🎉

Maybe we want to keep that by some CI check? We already do analysis-stats on self in CI, so it shouldn't consume additional CI time.

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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

expected {unknown}, found TyKind<Interner>
4 participants