Skip to content

fix(rust): map a Zig standard-library map to std::collections::HashMap (+5) - #3374

Merged
gHashTag merged 3 commits into
masterfrom
zig-map-to-hashmap
Sep 6, 2026
Merged

fix(rust): map a Zig standard-library map to std::collections::HashMap (+5)#3374
gHashTag merged 3 commits into
masterfrom
zig-map-to-hashmap

Conversation

@gHashTag

@gHashTag gHashTag commented Sep 6, 2026

Copy link
Copy Markdown
Owner

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.

std.StringHashMap(V)  ->  std::collections::HashMap<map([]const u8), map(V)>
std.HashMap(K, V)     ->  std::collections::HashMap<map(K), map(V)>

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.

no arity guard std.StringHashMap(K, V) emitted HashMap<String, K, V> — three type arguments
two spellings disagreed std.StringHashMap(u32) gave a String key while std.HashMap([]const u8, u32) gave &'static str — incompatible types for one intent
empty argument passed the guard std.StringHashMap() split to one empty string, len() == 1 accepted it, and it emitted HashMap<&'static str, >
-> drove depth negative std.HashMap(fn(A) -> B, C) split wrongly, because the > of an arrow counts as a close

The repair for the last two is to make the split partial: split_type_list returns None on 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 u8 to, 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) extra becomes *mut () on the old binary too.

@gHashTag
gHashTag enabled auto-merge (squash) September 6, 2026 07:33
@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-09-06 07:34:14 UTC

Summary

Status Count
Total Open PRs 16
PRs with Failing Checks 10
PRs with All Checks Green 6
READY 4
FAILING 10
PENDING 0
NO CHECKS YET 0

These columns do not partition: 4 + 10 + 0 + 0 = 14, and there are 16 open PRs. A PR is being counted twice or not at all.

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=5b05ef6357a7 != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

📓 NotebookLM Notebook linked to this PR

This notebook contains session context, decisions, and artifacts for this work.

@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-09-06 07:35:31 UTC

Summary

Status Count
Total Open PRs 16
PRs with Failing Checks 10
PRs with All Checks Green 6
READY 4
FAILING 10
PENDING 0
NO CHECKS YET 0

These columns do not partition: 4 + 10 + 0 + 0 = 14, and there are 16 open PRs. A PR is being counted twice or not at all.

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=5b05ef6357a7 != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

📓 NotebookLM Notebook linked to this PR

This notebook contains session context, decisions, and artifacts for this work.

@gHashTag
gHashTag merged commit eed816a into master Sep 6, 2026
30 checks passed
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.

A Zig standard-library map declared as a type reaches rustc verbatim

1 participant