]> git.lizzy.rs Git - rust.git/commit
auto merge of #16612 : nham/rust/twoway_searcher_fix, r=alexcrichton
authorbors <bors@rust-lang.org>
Sat, 23 Aug 2014 18:00:59 +0000 (18:00 +0000)
committerbors <bors@rust-lang.org>
Sat, 23 Aug 2014 18:00:59 +0000 (18:00 +0000)
commit03fd90be459650160a4edefbc78588a938db2f8c
treeaba5af2841c7862a894de3bff3e65ef7206336d6
parent3e3209ab4a7e256730d7c6733f2d800a5dbfdaef
parent9a43492f59bfc38ed819e361c3cf99aa7b972e15
auto merge of #16612 : nham/rust/twoway_searcher_fix, r=alexcrichton

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.
src/libcore/str.rs