-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Fix overlap detection of usize
/isize
range patterns
#79523
Conversation
We prefer to grab `ty` and `span` from `pcx`. This makes it consistent with other constructors.
I also measured a perf improvement, so I'd like a perf run to confirm it. |
@bors try @rust-timer queue |
Awaiting bors try build completion |
⌛ Trying commit bdd2bdb with merge 0c01a2145a2a5a57d0c24fa0661e1ca155aa202e... |
☀️ Try build successful - checks-actions |
Queued 0c01a2145a2a5a57d0c24fa0661e1ca155aa202e with parent e37f25a, future comparison URL. |
Finished benchmarking try commit (0c01a2145a2a5a57d0c24fa0661e1ca155aa202e): comparison url. Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. Please note that if the perf results are neutral, you should likely undo the rollup=never given below by specifying Importantly, though, if the results of this run are non-neutral do not roll this PR up -- it will mask other regressions or improvements in the roll up. @bors rollup=never |
I'm surprised by the perf gain on |
Thanks! @bors r+ rollup=never |
📌 Commit bdd2bdb has been approved by |
☀️ Test successful - checks-actions |
usize
andisize
are a bit of a special case in the match usefulness algorithm, because the range of values they contain depends on the platform. Specifically, we don't want0..usize::MAX
to count as an exhaustive match (see alsoprecise_pointer_size_matching
). The way this was initially implemented is by treating those ranges like float ranges, i.e. with limited cleverness. This means we didn't catch the following as unreachable:This PRs fixes this oversight. Now the only difference between
usize
andu64
range patterns is in what ranges count as exhaustive.r? @varkor
@rustbot label +A-exhaustiveness-checking