-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
"bananas".contains("nana") returns false #16589
Comments
So e.g. Edit: You can pad the tail with an arbitrary number of |
nham
added a commit
to nham/rust
that referenced
this issue
Aug 20, 2014
There is a check in TwoWaySearcher::new to determine whether the needle is periodic. This is needed because during searching when a match fails, we cannot advance the position by the entire length of the needle when it is periodic, but can only advance by the length of the period. The reason "bananas".contains("nana") (and similar searches) were returning false was because the periodicity check was wrong. Closes rust-lang#16589
bors
added a commit
that referenced
this issue
Aug 20, 2014
(By chance, the `contains` example was actually what I was trying to write when I discovered #16589)
bors
added a commit
that referenced
this issue
Aug 23, 2014
There is a check in TwoWaySearcher::new to determine whether the needle is periodic. This is needed because during searching when a match fails, we cannot advance the position by the entire length of the needle when it is periodic, but can only advance by the length of the period. The reason "bananas".contains("nana") (and similar searches) were returning false was because the periodicity check was wrong. Closes #16589 Also, thanks to @gankro, who came up with many buggy examples.
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Feb 25, 2024
…eykril feat: add unresolved-ident diagnostic This should cover missing local variables and missing unit structs and the like. It's conservatively marked experimental
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently,
"bananas".contains("nana")
returns false. It is the only substring of "bananas" for which this is true:results in:
I've done some preliminary work tracking this down. The problem seems to be in
core::str::TwoWaySearcher
.The text was updated successfully, but these errors were encountered: