-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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 exhaustiveness checking of strings #78553
Conversation
r? @varkor (rust_highfive has picked a reviewer for you, use r? to override) |
After a good night's sleep I found a way of solving the issue that involves fewer footguns. I feel a bit more confident about my solution now. |
@varkor it's ready to go |
Before rust-lang#78430, string literals worked because `specialize_constructor` didn't actually care too much which constructor was passed to it unless needed. Since then, string literals are special cased and a bit hacky. I did not anticipate patterns for the `&str` type other than string literals, hence this bug. This makes string literals less hacky.
It is now unneeded, since we handle `&str` patterns in a consistent way.
@bors r+ |
📌 Commit 1bdcd02 has been approved by |
☀️ Test successful - checks-actions |
A fairly large improvement on perf, up to 10% on instructions and this is reflected with a roughly 3% win on wall times. Good work. |
Thanks! I was not expecting a perf gain from this one ^^. |
Before #78430, the code worked because
specialize_constructor
didn't actually care too much which constructor was passed to it unless needed. That PR however handles&str
as a special case, and I did not anticipate patterns for the&str
type other than string literals.I am not very confident there are not other similar oversights left, but hopefully only
&str
was different enough to break my assumptions.Fixes #78549