fix(rust): map a Zig standard-library map to std::collections::HashMap (+5) - #3374
Merged
Conversation
added 2 commits
September 6, 2026 14:17
gHashTag
enabled auto-merge (squash)
September 6, 2026 07:33
Contributor
Contributor
|
📓 NotebookLM Notebook linked to this PR
This notebook contains session context, decisions, and artifacts for this work. |
Contributor
PR DashboardGenerated at: 2026-09-06 07:35:31 UTC
Summary
Seal Status
|
Contributor
|
📓 NotebookLM Notebook linked to this PR
This notebook contains session context, decisions, and artifacts for this work. |
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 #3373
Eight corpus fields declare their type as a quoted string holding a Zig map. The compiler strips the quotes and emits the content, so rustc was receiving
std.StringHashMap(...), which is not Rust.Measured: 352 → 357, zero regressions — exactly the five specs priced in #3370 before the work started:
lru,set,html,xml,trie.An adversarial pass over this change found four defects in it. All four were mine, and all four are fixed here.
std.StringHashMap(K, V)emittedHashMap<String, K, V>— three type argumentsstd.StringHashMap(u32)gave aStringkey whilestd.HashMap([]const u8, u32)gave&'static str— incompatible types for one intentstd.StringHashMap()split to one empty string,len() == 1accepted it, and it emittedHashMap<&'static str, >->drove depth negativestd.HashMap(fn(A) -> B, C)split wrongly, because the>of an arrow counts as a closeThe repair for the last two is to make the split partial:
split_type_listreturnsNoneon an unbalanced list or on any empty argument, and every caller then leaves the type exactly as written so rustc complains loudly. A malformed type is better left alone than half-translated.The key type is now whatever this emitter maps
[]const u8to, so both spellings emit the same Rust. Re-measured after every repair: 357 each time, zero regressions.Of ten claims from that pass, four were mine to fix, one was refuted, and one was confirmed pre-existing by running the previous binary on the same input —
std.HashMap(K, V) extrabecomes*mut ()on the old binary too.