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

Explain pattern exhaustiveness checking #923

Merged
merged 2 commits into from
Oct 16, 2020

Conversation

Nadrieril
Copy link
Member

A first pass at documenting pattern exhaustiveness. Given that the algorithm is very self-contained and well-explained in the source file, I didn't think it was useful to give more details.

See #657
Ping @mark-i-m

@jyn514 jyn514 added the waiting-on-review This PR is waiting for a reviewer to verify its content label Oct 16, 2020
@jyn514
Copy link
Member

jyn514 commented Oct 16, 2020

This is a really good explanation, btw, I'd never thought of 'exhaustiveness checking' as 'see if _ is applicable' but it's absolutely the same thing :)

@Nadrieril
Copy link
Member Author

This is a really good explanation, btw, I'd never thought of 'exhaustiveness checking' as 'see if _ is applicable' but it's absolutely the same thing :)

Yeah, it's quite clever! That comes from the paper from which we got the algorithm: http://moscova.inria.fr/~maranget/papers/warn/index.html (this paper is mentioned in the docs).

@jyn514
Copy link
Member

jyn514 commented Oct 16, 2020

src/pat-exhaustive-checking.md
	21 : Finally, we can ask whether the whole match is exhaustive by asking whether the wildcard pattern (`_`)
	38 : and ensuring that matches are exhaustive (which is important for soundness, because a match expression can return a value).
2 offending lines found.
The command "MAX_LINE_LENGTH=100 bash ci/check_line_lengths.sh src/**/*.md" failed and exited with 1 during .

CI is unhappy :( you can check this locally with the pre-commit hook, there are instructions in the readme. Looks great other than that!

@jyn514 jyn514 merged commit b04860c into rust-lang:master Oct 16, 2020
@jyn514
Copy link
Member

jyn514 commented Oct 16, 2020

Thanks for writing this up!

@Nadrieril
Copy link
Member Author

No problem!

@Nadrieril Nadrieril deleted the exhaustiveness-checking branch October 16, 2020 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting-on-review This PR is waiting for a reviewer to verify its content
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants