Skip to content
Navigation Menu
Sign in
Appearance settings
Platform
AI CODE CREATION
GitHub Copilot
Write better code with AI
GitHub Copilot app
Direct agents from issue to merge
MCP Registry
Integrate external tools
DEVELOPER WORKFLOWS
Actions
Automate any workflow
Codespaces
Instant dev environments
Issues
Plan and track work
Code Review
Manage code changes
Code Quality
Enforce quality at merge
APPLICATION SECURITY
GitHub Advanced Security
Find and fix vulnerabilities
Code security
Secure your code as you build
Secret protection
Stop leaks before they start
EXPLORE
Why GitHub
Documentation
Blog
Changelog
Marketplace
View all features
Solutions
BY COMPANY SIZE
Enterprises
Small and medium teams
Startups
Nonprofits
BY USE CASE
App Modernization
DevSecOps
DevOps
CI/CD
View all use cases
BY INDUSTRY
Healthcare
Financial services
Manufacturing
Government
View all industries
View all solutions
Resources
EXPLORE BY TOPIC
AI
Software Development
DevOps
Security
View all topics
EXPLORE BY TYPE
Customer stories
Events & webinars
Ebooks & reports
Business insights
GitHub Skills
SUPPORT & SERVICES
Documentation
Customer support
Community forum
Trust center
Partners
View all resources
Open Source
COMMUNITY
GitHub Sponsors
Fund open source developers
PROGRAMS
Security Lab
Maintainer Community
GitHub Stars
Archive Program
REPOSITORIES
Topics
Trending
Collections
Enterprise
ENTERPRISE SOLUTIONS
Enterprise platform
AI-powered developer platform
AVAILABLE ADD-ONS
GitHub Advanced Security
Enterprise-grade security features
Copilot for Business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
rust-lang
/
rust
Public
Uh oh!
There was an error while loading.
Please reload this page
.
Notifications
You must be signed in to change notification settings
Fork
17.4k
Star
119k
Code
Issues
5k+
Pull requests
1.4k
Actions
Projects
Security and quality
6
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Refactor pattern-matching usefulness algorithm
- #65160
#65160
Closed
Nadrieril
wants to merge 87 commits into
rust-lang:master
rust-lang/rust:master
from
Nadrieril:refactor-usefulness
Nadrieril/rust:refactor-usefulness
Copy head branch name to clipboard
Conversation
Commits
87
(87)
Checks
Files changed
Closed
Refactor pattern-matching usefulness algorithm
#65160
Nadrieril
wants to merge 87 commits into
rust-lang:master
rust-lang/rust:master
from
Nadrieril:refactor-usefulness
Nadrieril/rust:refactor-usefulness
Copy head branch name to clipboard
Commits
Commits on Oct 18, 2019
Run `rustfmt`
Nadrieril
committed
c9b33ee
View commit details
Copy full SHA for c9b33ee
Browse repository at this point
Remove mention of old slice pattern syntax
Nadrieril
committed
3ea9c9c
View commit details
Copy full SHA for 3ea9c9c
Browse repository at this point
Clarify and fix the explanation of the algorithm
Show description for f983460
Nadrieril
committed
f983460
View commit details
Copy full SHA for f983460
Browse repository at this point
Abstract out pattern stacks to make the code more legible
Nadrieril
committed
77e3a95
View commit details
Copy full SHA for 77e3a95
Browse repository at this point
Remove some redundancy
Nadrieril
committed
e1b7627
View commit details
Copy full SHA for e1b7627
Browse repository at this point
Remove duplicate logic in compute_missing_constructors
Show description for a075db8
Nadrieril
committed
a075db8
View commit details
Copy full SHA for a075db8
Browse repository at this point
Extract constructor application as a Constructor method
Nadrieril
committed
7ee9cb7
View commit details
Copy full SHA for 7ee9cb7
Browse repository at this point
Refactor "wild constructor" construction
Nadrieril
committed
a150d97
View commit details
Copy full SHA for a150d97
Browse repository at this point
Clarify some variable names
Nadrieril
committed
f0e8c78
View commit details
Copy full SHA for f0e8c78
Browse repository at this point
`specialize` conceptually operates on a single pattern
Nadrieril
committed
8a2274b
View commit details
Copy full SHA for 8a2274b
Browse repository at this point
Wording
Nadrieril
committed
0f5e02e
View commit details
Copy full SHA for 0f5e02e
Browse repository at this point
Add some slice-pattern exhaustiveness tests
Nadrieril
committed
c95b7ae
View commit details
Copy full SHA for c95b7ae
Browse repository at this point
Rename Constructor::Slice to FixedLenSlice
Nadrieril
committed
ea3fe4e
View commit details
Copy full SHA for ea3fe4e
Browse repository at this point
IntRange::from_pat is redundant with pat_constructors
Nadrieril
committed
d4cc125
View commit details
Copy full SHA for d4cc125
Browse repository at this point
split_grouped_constructors only needs access to the list of used constructors
Nadrieril
committed
501cf3a
View commit details
Copy full SHA for 501cf3a
Browse repository at this point
Share computation of used_ctors
Nadrieril
committed
b2ae93c
View commit details
Copy full SHA for b2ae93c
Browse repository at this point
Rework the exhaustiveness algorithm to better integrate meta-constructors
Show description for 89df721
Nadrieril
committed
89df721
View commit details
Copy full SHA for 89df721
Browse repository at this point
Define a MissingConstructors struct for cleanliness
Nadrieril
committed
1bd18d2
View commit details
Copy full SHA for 1bd18d2
Browse repository at this point
Move is_non_exhaustive into MissingConstructors
Nadrieril
committed
ad28919
View commit details
Copy full SHA for ad28919
Browse repository at this point
Allow Constructor::apply to return more than one pattern
Nadrieril
committed
ec57a89
View commit details
Copy full SHA for ec57a89
Browse repository at this point
Define MissingConstructors meta-constructor and use it for witness reconstruction
Nadrieril
committed
6d9a35d
View commit details
Copy full SHA for 6d9a35d
Browse repository at this point
Match constructor first instead of type first in various functions
Show description for 6e392f0
Nadrieril
committed
6e392f0
View commit details
Copy full SHA for 6e392f0
Browse repository at this point
Move constructor_sub_pattern_tys into wildcard_subpatterns
Nadrieril
committed
d9871b8
View commit details
Copy full SHA for d9871b8
Browse repository at this point
Replace wildcard-specific code paths with generalized specialization
Nadrieril
committed
cf90304
View commit details
Copy full SHA for cf90304
Browse repository at this point
Factor out some bits
Nadrieril
committed
931d7a9
View commit details
Copy full SHA for 931d7a9
Browse repository at this point
Extract constructor splitting as a Constructor method
Nadrieril
committed
142df8b
View commit details
Copy full SHA for 142df8b
Browse repository at this point
Rename pop_constructor back to specialize
Nadrieril
committed
cb4715d
View commit details
Copy full SHA for cb4715d
Browse repository at this point
Add Wildcard meta-constructor
Nadrieril
committed
a1b3800
View commit details
Copy full SHA for a1b3800
Browse repository at this point
pat_constructors now returns Wildcard when relevant
Nadrieril
committed
6337864
View commit details
Copy full SHA for 6337864
Browse repository at this point
Avoid allocating in the common case of a single pattern
Nadrieril
committed
c0359ce
View commit details
Copy full SHA for c0359ce
Browse repository at this point
Invert condition for clarity
Nadrieril
committed
33273f2
View commit details
Copy full SHA for 33273f2
Browse repository at this point
Clarify handling of uninhabited types
Nadrieril
committed
cb3452c
View commit details
Copy full SHA for cb3452c
Browse repository at this point
Gather together usefulness tests
Show description for ad78eff
Nadrieril
committed
ad78eff
View commit details
Copy full SHA for ad78eff
Browse repository at this point
MatchCheckCtxt::byte_array_map is unused since 7df1d9f6564cafca3758e5d629920c02df526989
Nadrieril
committed
a91cdd4
View commit details
Copy full SHA for a91cdd4
Browse repository at this point
No need to mutate MatchCheckCtxt anymore
Nadrieril
committed
8e89f3c
View commit details
Copy full SHA for 8e89f3c
Browse repository at this point
Add comment about non_exhaustive feature
Nadrieril
committed
9ae4c52
View commit details
Copy full SHA for 9ae4c52
Browse repository at this point
Use Wildcard instead of MissingConstructors when relevant
Show description for b3de6fd
Nadrieril
committed
b3de6fd
View commit details
Copy full SHA for b3de6fd
Browse repository at this point
Make IntRange::subtract_from work on a single constructor
Nadrieril
committed
4be3802
View commit details
Copy full SHA for 4be3802
Browse repository at this point
Factor out constructor subtraction
Nadrieril
committed
d12b172
View commit details
Copy full SHA for d12b172
Browse repository at this point
subtract_meta_constructor: match on constructor first
Nadrieril
committed
2687140
View commit details
Copy full SHA for 2687140
Browse repository at this point
Extract constructor_intersects_pattern function
Show description for 1f8d93c
Nadrieril
committed
1f8d93c
View commit details
Copy full SHA for 1f8d93c
Browse repository at this point
Inline constructor_covered_by_range and IntRange::from_pat
Nadrieril
committed
1b65bec
View commit details
Copy full SHA for 1b65bec
Browse repository at this point
Use question mark instead of custom macro
Nadrieril
committed
12bb3b7
View commit details
Copy full SHA for 12bb3b7
Browse repository at this point
Regroup similar code paths
Nadrieril
committed
022c620
View commit details
Copy full SHA for 022c620
Browse repository at this point
Add a few more slice pattern usefulness tests
Nadrieril
committed
0ab764b
View commit details
Copy full SHA for 0ab764b
Browse repository at this point
Add variable-length slice metaconstructor
Nadrieril
committed
956838d
View commit details
Copy full SHA for 956838d
Browse repository at this point
Don't use max_slice_length when subtracting from VarLenSlice
Nadrieril
committed
1793ad5
View commit details
Copy full SHA for 1793ad5
Browse repository at this point
Faster code path for subtracting from FixedLenSlice
Nadrieril
committed
527fe65
View commit details
Copy full SHA for 527fe65
Browse repository at this point
Faster code path for subtracting from VarLenSlice
Nadrieril
committed
0d58ead
View commit details
Copy full SHA for 0d58ead
Browse repository at this point
Make exhaustiveness error message more consistent for slice patterns
Show description for 0b353b3
Nadrieril
committed
0b353b3
View commit details
Copy full SHA for 0b353b3
Browse repository at this point
Prepare return types for or-patterns
Nadrieril
committed
cf4dc88
View commit details
Copy full SHA for cf4dc88
Browse repository at this point
MissingConstructors should not be compared for equality, but we need the impl
Nadrieril
committed
1e43487
View commit details
Copy full SHA for 1e43487
Browse repository at this point
Add example run of the algorithm
Nadrieril
committed
c8ac41e
View commit details
Copy full SHA for c8ac41e
Browse repository at this point
Tidy up
Nadrieril
committed
244ac8d
View commit details
Copy full SHA for 244ac8d
Browse repository at this point
Store both prefix and suffix length in VarLenSlice
Nadrieril
committed
ad09cc5
View commit details
Copy full SHA for ad09cc5
Browse repository at this point
max_slice_length only needs to look at constructors
Nadrieril
committed
47ee628
View commit details
Copy full SHA for 47ee628
Browse repository at this point
Inline max_slice_length
Show description for c6d1cad
Nadrieril
committed
c6d1cad
View commit details
Copy full SHA for c6d1cad
Browse repository at this point
Add some test cases
Nadrieril
committed
0c0fe9f
View commit details
Copy full SHA for 0c0fe9f
Browse repository at this point
Splitting variable-length slices now respects the required invariant
Show description for 6b4426a
Nadrieril
committed
6b4426a
View commit details
Copy full SHA for 6b4426a
Browse repository at this point
PatCtxt is not useful anymore
Show description for 72c3a68
Nadrieril
committed
72c3a68
View commit details
Copy full SHA for 72c3a68
Browse repository at this point
Cleanup comments
Show description for f5d833f
Nadrieril
committed
f5d833f
View commit details
Copy full SHA for f5d833f
Browse repository at this point
Store Const in ConstantRange
Show description for 94227f5
Nadrieril
committed
94227f5
View commit details
Copy full SHA for 94227f5
Browse repository at this point
Cleanup constructor_intersects_pattern
Nadrieril
committed
60021ce
View commit details
Copy full SHA for 60021ce
Browse repository at this point
Implement nnethercote's suggestion
Show description for 3d0945d
Nadrieril
committed
3d0945d
View commit details
Copy full SHA for 3d0945d
Browse repository at this point
Implement Centril's suggestion
Show description for 5badbb7
Nadrieril
committed
5badbb7
View commit details
Copy full SHA for 5badbb7
Browse repository at this point
Incorporate varkor's review
Nadrieril
committed
defc66d
View commit details
Copy full SHA for defc66d
Browse repository at this point
Be more consistent in terminology
Nadrieril
committed
d8b71d4
View commit details
Copy full SHA for d8b71d4
Browse repository at this point
Move range exhaustiveness check to IntRange::intersection
Show description for 66dac52
Nadrieril
committed
66dac52
View commit details
Copy full SHA for 66dac52
Browse repository at this point
Introduce IntRange meta-constructor
Nadrieril
committed
b85e4be
View commit details
Copy full SHA for b85e4be
Browse repository at this point
We no longer construct any ConstantValue or ConstantRange for non-integral types
Nadrieril
committed
eea0b79
View commit details
Copy full SHA for eea0b79
Browse repository at this point
Remove some unnecessary conversions between Constructor and IntRange
Nadrieril
committed
34b0774
View commit details
Copy full SHA for 34b0774
Browse repository at this point
Ungate improved slice patterns diagnostics
Nadrieril
committed
087adfe
View commit details
Copy full SHA for 087adfe
Browse repository at this point
Simplify slice subtraction as suggested by arielb1
Show description for a66dcd5
Nadrieril
committed
a66dcd5
View commit details
Copy full SHA for a66dcd5
Browse repository at this point
Rewrite constructor_intersects_pattern as a match
Nadrieril
committed
a2624f2
View commit details
Copy full SHA for a2624f2
Browse repository at this point
Remove unnecessary Const conversion
Nadrieril
committed
79efdb4
View commit details
Copy full SHA for 79efdb4
Browse repository at this point
Clarify why the naive algorithm may not terminate
Show description for 1f6a5a5
Nadrieril
committed
1f6a5a5
View commit details
Copy full SHA for 1f6a5a5
Browse repository at this point
Remove unneeded lifetime extensions
Nadrieril
committed
455095a
View commit details
Copy full SHA for 455095a
Browse repository at this point
Use special `Captures` trait to solve issues with impl Iterator
Nadrieril
committed
d379a43
View commit details
Copy full SHA for d379a43
Browse repository at this point
`pat_constructors` doesn't need a `ty` parameter
Nadrieril
committed
1de1683
View commit details
Copy full SHA for 1de1683
Browse repository at this point
Extract head constructors construction
Nadrieril
committed
3aa5fb3
View commit details
Copy full SHA for 3aa5fb3
Browse repository at this point
Name the field of PatStack
Nadrieril
committed
c956c65
View commit details
Copy full SHA for c956c65
Browse repository at this point
Cache `pat_constructors` invocations
Nadrieril
committed
368c71b
View commit details
Copy full SHA for 368c71b
Browse repository at this point
Compute constructors on PatStack construction
Show description for 6df1815
Nadrieril
committed
6df1815
View commit details
Copy full SHA for 6df1815
Browse repository at this point
Restore performance
Show description for ed3ea67
Nadrieril
committed
ed3ea67
View commit details
Copy full SHA for ed3ea67
Browse repository at this point
Don't rebuild the same matrix twice
Nadrieril
committed
9c3682f
View commit details
Copy full SHA for 9c3682f
Browse repository at this point
Don't use SmallVec when we could use Option
Show description for b052036
Nadrieril
committed
b052036
View commit details
Copy full SHA for b052036
Browse repository at this point
Integrate comment fixes suggested by arielb1
Nadrieril
committed
fd3ec66
View commit details
Copy full SHA for fd3ec66
Browse repository at this point
You can’t perform that action at this time.