Repository navigation
feat(t27b): std.mem.eql and std.mem.indexOf compared with null, on strings - #6567
Merged
Merged
Conversation
…rings std.mem.eql(u8, a, b) on strings lowers as a == b; std.mem.indexOf(u8, h, n) == / != null calls a second synthesized fn, __t27b_str_contains, with Zig 0.16 std.mem.find semantics. Other shapes stay refused as ExprCall(std.*). Closes #6449 Refs #6063 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…mem-2 # Conflicts: # cli/t27b/src/lower.rs
Contributor
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.
Closes #6449
Refs #6063
What
std.mem.eql(u8, a, b)on two strings is lowered asa == b. Two literals fold; otherwise it calls__t27b_str_eql. This matches t27c's Zig backend, which prints the call verbatim.std.mem.indexOf(u8, h, n) == nulland!= nullcall a second synthesized fn,__t27b_str_contains. It follows Zig 0.16 semantics: a needle longer than the haystack is never found, and an empty needle always is.ExprCall(std.*): the index used any other way, another element type, or an operand that is not a string.cli/t27b/src/lower/stdmem.rs, with small hooks inlower.rs.Owner exception
Allowed by the owner 2026-10-05; debt to be replaced via #6198.
The local only-t27 hook (#6511) read an uncommitted line in
tools/policy/foreign-exceptions.txtthat names this PR's paths. That line is not in this PR, so the exception ends with the PR.Files
cli/t27b/src/lower.rs(hooks)cli/t27b/src/lower/stdmem.rscli/t27b/tests/stdmem.rsdocs/now/2026-10-05-t27b-stdmem.mdTests
cargo test -p t27b: all green.tests/stdmem.rs: each source was run undert27c test-reportfirst. It gives 3 pass and 2 fail there, and the same here.Corpus (
t27b corpus specs --blockers --reference <t27c> --reference-cache, jobs 8)No file loses its pass. Three files newly pass:
specs/automation/browser-pod-restart.t27,specs/port/scripts/git_commands_tasks_1_4.t27, andspecs/port/scripts/tri-search.t27.🤖 Generated with Claude Code