Uh oh!
There was an error while loading. Please reload this page.
Check for uninhabited types in sub-patterns (#12609) - #36476
Conversation
rust-highfive
commented
Sep 14, 2016
r? @arielb1 (rust_highfive has picked a reviewer for you, use r? to override) |
d68b74d to
0e51853Comparebors
commented
Sep 22, 2016
☔ The latest upstream changes (presumably #36551) made this pull request unmergeable. Please resolve the merge conflicts. |
0e51853 to
de169e7Comparebors
commented
Oct 1, 2016
☔ The latest upstream changes (presumably #36857) made this pull request unmergeable. Please resolve the merge conflicts. |
arielb1
commented
Oct 2, 2016
I would prefer that people on the lang team to look on this. |
This alters the exhaustiveness-checking algorithm for pattern matches to avoid raising spurious errors about cases not being covered for uninhabited types. Specifically, the construct_witness function now returns an Option. If it sees that DUMMY_WILD_PAT is being used to match on an uninhabited type it returns None to indicate that there is no witness. We look for DUMMY_WILD_PAT specifically and not any wildcard pattern so that wildcard patterns explicitly written by the programmer continue to work without raising errors about unreachability.
de169e7 to
a0026e6Comparebors
commented
Oct 27, 2016
☔ The latest upstream changes (presumably #36695) made this pull request unmergeable. Please resolve the merge conflicts. |
canndrew
commented
Nov 2, 2016
Looks like the code that this touched went through a major refactor and this PR will have to be rewritten. |
steveklabnik
commented
Nov 7, 2016
/cc @rust-lang/lang @rust-lang/compiler |
nikomatsakis
commented
Nov 8, 2016
@canndrew shall we close the PR then and you can re-open when ready? |
canndrew
commented
Nov 9, 2016
@nikomatsakis Sure |
canndrew
commented
Dec 1, 2016
There's another, more complete and correct attempt at fixing this here: #38069 |
This alters the exhaustiveness-checking algorithm for pattern matches to
avoid raising spurious errors about cases not being covered for
uninhabited types.
Specifically, the construct_witness function now returns an Option. If
it sees that DUMMY_WILD_PAT is being used to match on an uninhabited
type it returns None to indicate that there is no witness. We look for
DUMMY_WILD_PAT specifically and not any wildcard pattern so that
wildcard patterns explicitly written by the programmer continue to work
without raising errors about unreachability.