-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Remove hack for top-level or-patterns in match checking #66967
Conversation
The exact same logic was used in check_arms and check_match to build the matrix of relevant patterns. It would actually probably have been a bug if it was not the case, since exhaustiveness checking should be the same as checking reachability of an additional `_ => ...` match branch.
We want the lifetimes of the patterns contained in the matrix and the candidate `PatStack` to be the same so that they can be mixed together. A lot of this would not be necessary if `SmallVec` was covariant in its type argument (see servo/rust-smallvec#146).
The implementation looks good. Some of the pre-existing comments could do with a drive-by clean up (capitalisation, etc.), though I'm not too bothered. Let's just make sure this doesn't regress anything. @bors try @rust-timer queue |
Awaiting bors try build completion |
⌛ Trying commit 1c1bec2 with merge 057e49b53cffec15c0a8467b83fe961b5f476e83... |
☀️ Try build successful - checks-azure |
Queued 057e49b53cffec15c0a8467b83fe961b5f476e83 with parent 2da942f, future comparison URL. |
Finished benchmarking try commit 057e49b53cffec15c0a8467b83fe961b5f476e83, comparison URL. |
@bors r+ |
📌 Commit 1c1bec2 has been approved by |
@Nadrieril This looks great! Thanks a bunch for all the work you've been doing on match checking! |
I have to say I'm having a lot of fun doing it :D. And you all are really reactive and supportive too, thanks ! |
Remove hack for top-level or-patterns in match checking Follow-up to rust-lang#66612. Or-patterns are now truly first-class in match checking. As a side-effect, redundant subpatterns are linted as such, making the `unreachable_patterns` lint a bit more general. cc rust-lang#54883 r? @varkor
Remove hack for top-level or-patterns in match checking Follow-up to rust-lang#66612. Or-patterns are now truly first-class in match checking. As a side-effect, redundant subpatterns are linted as such, making the `unreachable_patterns` lint a bit more general. cc rust-lang#54883 r? @varkor
Rollup of 6 pull requests Successful merges: - #66148 (Show the sign for signed ops on `exact_div`) - #66651 (Add `enclosing scope` parameter to `rustc_on_unimplemented`) - #66904 (Adding docs for keyword match, move) - #66935 (syntax: Unify macro and attribute arguments in AST) - #66941 (Remove `ord` lang item) - #66967 (Remove hack for top-level or-patterns in match checking) Failed merges: r? @ghost
Follow-up to #66612.
Or-patterns are now truly first-class in match checking. As a side-effect, redundant subpatterns are linted as such, making the
unreachable_patterns
lint a bit more general.cc #54883
r? @varkor