You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The searcher should not return matches after SearchStep::Done, because the entire haystack has been already covered.
To quote from the documentation:
Returns Done if every byte of the haystack has been visited.
The stream of Match and Reject values up to a Done will contain index ranges that are adjacent, non-overlapping, covering the whole haystack, and laying on utf8 boundaries.
Compiling playground v0.0.1 (/playground)
Finished dev [unoptimized + debuginfo] target(s) in 1.91s
Running `target/debug/playground`
thread 'main' panicked at 'assertion failed: `(left == right)`
left: `Match(0, 0)`,
right: `Done`', src/main.rs:9:5
stack backtrace:
0: rust_begin_unwind
at /rustc/4e3e6db011c5b482d2bef8ba02274657f93b5e0d/library/std/src/panicking.rs:515:5
1: core::panicking::panic_fmt
at /rustc/4e3e6db011c5b482d2bef8ba02274657f93b5e0d/library/core/src/panicking.rs:92:14
2: core::panicking::assert_failed_inner
3: core::panicking::assert_failed
at /rustc/4e3e6db011c5b482d2bef8ba02274657f93b5e0d/library/core/src/panicking.rs:117:5
4: playground::main
at ./src/main.rs:9:5
5: core::ops::function::FnOnce::call_once
at /rustc/4e3e6db011c5b482d2bef8ba02274657f93b5e0d/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
The text was updated successfully, but these errors were encountered:
Make StrSearcher behave correctly on empty needle
Fixrust-lang#85462.
This will not affect ABI since the other variant of the enum is bigger.
It may break some code, but that would be very strange: usually people
don't continue after the first `Done` (or `None` for a normal iterator).
`@rustbot` label T-libs A-str A-patterns
I tried this code:
I expected to see this happen:
The searcher should not return matches after
SearchStep::Done
, because the entire haystack has been already covered.To quote from the documentation:
https://doc.rust-lang.org/std/str/pattern/trait.Searcher.html
Instead, this happened:
Meta
rustc --version --verbose
:Backtrace
The text was updated successfully, but these errors were encountered: