-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Refactor slice pattern usefulness checking #66129
Merged
bors
merged 18 commits into
rust-lang:master
from
Nadrieril:refactor-slice-pat-usefulness
Nov 12, 2019
Merged
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
4dc5697
Add some slice-pattern exhaustiveness tests
Nadrieril 235b379
Rename Constructor::Slice to FixedLenSlice
Nadrieril d2b7711
Match on self first in subtract_constructor
Nadrieril e092a17
Add special variable-length slice constructor
Nadrieril 909ec37
Simpler code path for subtracting from FixedLenSlice
Nadrieril b669730
Don't use max_slice_length when subtracting from VarLenSlice
Nadrieril 65bc67e
Make exhaustiveness error message more consistent for slice patterns
Nadrieril 58de9d9
Add some test cases
Nadrieril d7044f2
Store both prefix and suffix length in VarLenSlice
Nadrieril 149792b
pat_constructors returns at most one constructor
Nadrieril d582ed5
Inline max_slice_length
Nadrieril f774eb6
Use VarLenSlice consistently when splitting constructors
Nadrieril 9531787
Move a few more tests to the usefulness/ folder
Nadrieril 816aee2
Apply suggestions from code review
Nadrieril 7514c48
Factor out constructing a new wildcard pattern
Nadrieril 098974d
Split slice-patterns test as suggested by Centril
Nadrieril 369a351
Inline constructor_sub_pattern_tys
Nadrieril fd9921b
tidy
Nadrieril File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has got me thinking... would using
Cow<[Constructor]>
be more efficient if perhapsSingle | ...
and friends are more common?(If so, we shouldn't make such changes here, but perhaps in some follow-up.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quite possibly yes. It'd also be not too hard to take
self
instead of&self
, if we want to avoid cloning. I don't know which would be better