Repository navigation
Add reverse substring search - #841
Merged
Merged
Conversation
Member
|
Could you please rebase this PR onto the latest |
KingEmma7
force-pushed
the
fix/reverse-substring-search
branch
from
October 2, 2026 13:46
6ea2610 to
59b2af6
Compare
Signed-off-by: Emmanuel Mawulolo Tagbor <[email protected]>
Member
|
#840 has now been merged into master, which introduced another conflict with this PR. Could you please rebase onto the latest master once more and resolve the new conflicts? Thanks! |
KingEmma7
force-pushed
the
fix/reverse-substring-search
branch
from
October 2, 2026 14:14
59b2af6 to
632983f
Compare
LunaStev
approved these changes
Oct 2, 2026
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add
std::string::find::rfind(s: str, needle: str) -> i32to return the last matching byte offset or-1. For example,rfind("ababa", "aba")returns2. An empty needle matches the end of the string.Motivation
Closes #716. Callers can locate the last multi-byte delimiter with a standard-library helper.
Target and compatibility impact
The helper scans candidate offsets backward after checking the string lengths and stops before decrementing zero. It compares bytes, allocates nothing and leaves both inputs untouched. Existing
find,countandrfind_charbehavior remains unchanged. Includes API contract comments and a string example. Standard-library changes retain Apache-2.0, and the example/test changes retain MPL-2.0.Validation
Revalidated after rebasing onto
masterat555ebf2d5de8bb1eb48a87b6bb3740cf01085282.--test-threads=1).target/main.o, the isolated compiler test and the full serialized Rust suite passed.Checklist
Signed-off-byline.std/.