Add fuel to match checking by Nadrieril · Pull Request #16879 · rust-lang/rust-...
source link: https://github.com/rust-lang/rust-analyzer/pull/16879
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Conversation
Contributor
Exhaustiveness checking is NP-hard hence can take extremely long to check some specific matches. This PR makes ehxaustiveness bail after a set number of steps. I chose a bound that takes ~100ms on my machine, which should be more than enough for normal matches.
I'd like someone with less recent hardware to run the test to see if that limit is low enough for them. Also curious if the r-a team thinks this is a good ballpark or if we should go lower/higher. I don't have much data on how complex real-life matches get, but we can definitely go lower than 500 000
steps.
The second commit is a drive-by soundness fix which doesn't matter much today but will matter once min_exhaustive_patterns
is stabilized.
Recommend
-
7
Contributor Nadrieril ...
-
6
Contributor Nadrieril commented
-
2
Please welcome cjgillot and Nadrieril to compiler-contributors Dec. 28, 2020 · Wesley Wiser on behalf of the compiler team ...
-
8
Contributor Nadrieril commented
-
1
Copy link Contributor TIHan commented...
-
3
New issue fix FP in lint [needless_match] #8549 ...
-
1
Conversation Contributor Fixes...
-
3
Cleanup number handling in match exhaustiveness #116281
-
4
Conversation Contributor This i...
-
2
Conversation Contributor I am r...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK