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

Overhaul typechecking of patterns #18171

Merged
merged 3 commits into from Oct 25, 2014
Merged

Overhaul typechecking of patterns #18171

merged 3 commits into from Oct 25, 2014

Conversation

ghost
Copy link

@ghost ghost commented Oct 20, 2014

Rather than doing it top-down, with a known expected type, we will now simply establish the appropriate constraints between the pattern and the expression it destructures.

Closes #8783.
Closes #10200.

@rust-highfive
Copy link
Collaborator

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!

@nikomatsakis
Copy link
Contributor

In general I'm in favor and have been wanting to do this for a while. There will be patterns, such as box patterns, where we do require a known expected type, but it's good to infer when we can avoid it.

@ghost
Copy link
Author

ghost commented Oct 21, 2014

r? @pcwalton @nikomatsakis

This now passes the tests.

Jakub Bukaj added 3 commits October 24, 2014 19:43
Instead of checking patterns in a top-down fashion with a known
expected type on entry, this changes makes typeck establish
appropriate constraints between a pattern and the expression
it destructures, and lets inference compute the final types
or produce good error messages if it's impossible.
bors added a commit that referenced this pull request Oct 25, 2014
Rather than doing it top-down, with a known expected type, we will now simply establish the appropriate constraints between the pattern and the expression it destructures.

Closes #8783.
Closes #10200.
@bors bors closed this Oct 25, 2014
@bors bors merged commit 1484f9c into rust-lang:master Oct 25, 2014
@ghost ghost deleted the match-typeck branch October 25, 2014 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants