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

exhaustively check ty::Kind during structural match checking #72153

Merged
merged 5 commits into from
May 25, 2020

Conversation

lcnr
Copy link
Contributor

@lcnr lcnr commented May 12, 2020

This was prone to errors as we may forget new kinds in the future.

I am also not yet sure about some kinds.

ty::GeneratorWitness(..) | ty::Infer(_) | ty::Placeholder(_) | ty::UnnormalizedProjection(..) | ty::Bound(..) might be unreachable here.

We may want to forbid ty::Projection, similar to ty::Param.

ty::Opaque seems fine afaict, should not be possible in a match atm.

I believe ty::Foreign should not be structurally match, as I don't even know what
that would actually mean.

r? @pnkfelix cc @eddyb

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 12, 2020
@RalfJung
Copy link
Member

ty::GeneratorWitness(..) | ty::Infer() | ty::Placeholder() | ty::UnnormalizedProjection(..) | ty::Bound(..) might be unreachable here.

Best way to check that: make them bug!.
This is what we do in Miri and it works pretty well. :D

ty::Opaque seems fine afaict, should not be possible in a match atm.

If it's not possible, best to bug! on it.

I believe ty::Foreign should not be structurally match, as I don't even know what
that would actually mean.

Yeah...

@rust-highfive

This comment has been minimized.

@pnkfelix
Copy link
Member

@bors r+ rollup

@bors
Copy link
Contributor

bors commented May 19, 2020

📌 Commit 60d9df2 has been approved by pnkfelix

@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 May 19, 2020
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request May 20, 2020
exhaustively check `ty::Kind` during structural match checking

This was prone to errors as we may forget new kinds in the future.

I am also not yet sure about some kinds.

`ty::GeneratorWitness(..) | ty::Infer(_) | ty::Placeholder(_) | ty::UnnormalizedProjection(..)  | ty::Bound(..)` might be unreachable here.

We may want to forbid `ty::Projection`, similar to `ty::Param`.

`ty::Opaque` seems fine afaict, should not be possible in a match atm.

I believe `ty::Foreign` should not be structurally match, as I don't even know what
that would actually mean.

r? @pnkfelix cc @eddyb
@ecstatic-morse
Copy link
Contributor

@lcnr this caused a failure in #72367. Likely it just needs a rebase.

@Dylan-DPC-zz
Copy link

@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 May 20, 2020
@lcnr
Copy link
Contributor Author

lcnr commented May 20, 2020

rebased

@lcnr lcnr added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 21, 2020
@lcnr
Copy link
Contributor Author

lcnr commented May 25, 2020

@pnkfelix Can you once again review/r+ this?

@ecstatic-morse
Copy link
Contributor

@bors r=pnkfelix

@bors
Copy link
Contributor

bors commented May 25, 2020

📌 Commit a5a4ec9 has been approved by pnkfelix

@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 May 25, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request May 25, 2020
Rollup of 4 pull requests

Successful merges:

 - rust-lang#72153 (exhaustively check `ty::Kind` during structural match checking)
 - rust-lang#72308 (Emit a better diagnostic when function actually has a 'self' parameter)
 - rust-lang#72560 (Enable `glacier` command via triagebot)
 - rust-lang#72567 (Clean up E0608 explanation)

Failed merges:

r? @ghost
@bors bors merged commit d5250c1 into rust-lang:master May 25, 2020
@lcnr lcnr deleted the exhaustively-match branch May 25, 2020 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants