-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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 how we handle overflow and remove blanket Pattern impl #23580
Conversation
@@ -474,22 +474,16 @@ impl<'a, 'b> Pattern<'a> for &'b [char] { | |||
s, CharEqPattern(s)); | |||
} | |||
|
|||
/// Searches for chars that are equal to any of the chars in the array |
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 should probably be the doc comment of the &str
impl instead, or rather explaining that it delegates to the &str
impl.
Apart from the doc comments, the pattern impls look fine to me. |
Is it possible to still have a forwarding impl, but just for references? impl<'a, 'b, P: Pattern<'a> + ?Sized + 'b> Pattern<'a> for &'b P {
...
} |
@alexcrichton no, because any type |
9d68f33
to
8ff0d74
Compare
rebased, tweaked docs per @Kimundi's suggestion |
@bors: r+ 8ff0d74 |
compilation: this removes all the ungainly code that special cases overflow so that we can ensure it propagates.
possible blanket impls and also triggers internal overflow. Add some special cases for common uses (&&str, &String) for now; bounds-targeting deref coercions are probably the right longer term answer.
8ff0d74
to
76ead08
Compare
@bors r=aturon 7dead08 |
🙀 |
I think the overflow refactoring here might be what @aturon was referring to in the issue I reported at #23714. The overflow/failure on evaluating the |
See comments in the commits for reasoning
r? @aturon
cc @Kimundi