Skip to content

Add ASCII-insensitive string equality - #840

Merged
LunaStev merged 1 commit into
wavefnd:masterfrom
KingEmma7:fix/ascii-insensitive-equality
Oct 2, 2026
Merged

LunaStev merged 1 commit into
wavefnd:masterfrom
KingEmma7:fix/ascii-insensitive-equality

Conversation

@KingEmma7

@KingEmma7 KingEmma7 commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Add std::string::cmp::eq_ignore_ascii_case(a: str, b: str) -> bool. For example, eq_ignore_ascii_case("Wave", "wAVE") returns true. The helper reuses to_lower, compares other bytes exactly, stops at NUL, and allocates nothing or writes to either input.

Motivation

Closes #715. Callers can compare ASCII names without writing their own folding loop.

Target and compatibility impact

Adds a standard-library function. Existing eq and resolver behavior remain unchanged. Includes a string example and API contract comments. The standard library retains Apache-2.0 licensing, while the example and test changes retain the repository's MPL-2.0 boundary.

Validation

Revalidated after rebasing onto master at 0a970a3853790072b645d535b0f13f0aa7ecdce3.

  • Real shared fixture at O0/O2 covers all 65,025 non-NUL byte pairs, empty strings, unequal lengths, mixed case, punctuation, non-ASCII bytes, embedded NULs, input preservation and unchanged eq behavior.
  • Original module rejects the missing symbol. Four incorrect implementations fail at O0/O2: case-sensitive comparison, non-ASCII folding, punctuation folding and prefix matching.
  • cargo fmt --all --check, standard-library policy, Python syntax/tooling tests (172 run, one skipped), warning-free rustdoc, Clippy with warnings denied, locked release build and locked workspace/all-target tests (358 passed).
  • Corpus check: 292 passed. All 26 standard-library examples ran successfully on macOS arm64 with Rust 1.89.0 and LLVM/LLD 21.1.8. Cross-platform CI results are available in this PR's checks.

Checklist

  • Commits include a DCO Signed-off-by line.
  • Tests cover new behavior or the PR explains why no test is needed.
  • User-facing changes include documentation or diagnostics updates.
  • The change preserves the license boundary between the compiler and std/.

@LunaStev

LunaStev commented Oct 2, 2026

Copy link
Copy Markdown
Member

Could you please rebase this PR onto the latest master and resolve the current conflicts? The implementation itself looks good; it just needs to be brought up to date with the recent changes. Thanks!

Signed-off-by: Emmanuel Mawulolo Tagbor <[email protected]>
@KingEmma7
KingEmma7 force-pushed the fix/ascii-insensitive-equality branch from f23150c to 7249f5e Compare October 2, 2026 13:42

@LunaStev LunaStev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks.

If you liked Wave, please spread the word to your friends.
Haha, just kidding.

@LunaStev
LunaStev merged commit 555ebf2 into wavefnd:master Oct 2, 2026
26 checks passed
This was referenced Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add ASCII-insensitive string equality

2 participants