Repository navigation
STC corpus (std.stc) and its test lanes: stdlib_sourcing_plan Phase 3, the pipeline half - #2556
Merged
Merged
Conversation
added 19 commits
October 22, 2026 02:20
…; body-local records hoist with C layout; a self-reading initializer is declared first
Found by STC's tests (docs/proposals/stdlib_sourcing_plan.md Phase 3, the
macro-migrator campaign), each a general rule:
- A named field of member-record type takes its brace value as that record's
own initializer (`.u8 = {{s, 0}}` fills `str_iter_u8`); the designator search
matched only fields that were not member records, so the field was "not
found". A positional value lands on an unnamed member's first arm as before.
- A record the declaration index does not name — one declared in a body, a
member record a field holds directly — is initialized against its declaration
cursor (lower_record_init_by_cursor, the cursor twin of lower_record_init_ir),
under the names the renderer gives it (`Parent_field`, `Parent_anon_N`).
- A tagged record defined in a body (`struct roman { .. };`) is hoisted under
its tag, as its uses translate; a second definition under the same tag is
refused. A statement that only declares a record lowers to nothing instead of
reading as a bail. Hoisted and member records carry `@[repr(C)]` as top-level
ones do (§16.1), which also offers them `T.zeroed()`.
- An initializer that reads the variable it initializes (STC's c_each_item:
`.ref = (T*)it._ref`) is declared first and assigned after, so the stores
land in order.
c-migrator-basic-tests gains local_and_member_records: the three programs
migrate, check, build and run.
…an array compound literal is a local; a body-local enum is its constants; a record body's `;` is not a for header's
Three more general rules found by STC's tests:
- An initializer element that carries statements of its own — a comma expression
(`a + ((void)sizeof(..), i)`, cspan_at's static assert), a call whose arguments
do — is computed into a temporary before the initializer, which reads the
temporary (hoist_init_list_element_setups; lower_expr_ir consults the
substitution). A compound literal of array type is an object of the enclosing
block (C11 6.5.2.5), so it is a local of its own and its uses decay to that
local's address; a temporary's storage ended with the statement and the
pointer dangled.
- An enum declared in a body is its constants, each a `let` of the block.
- ci_extract_for_parts counted a `;` inside a record body declared in the for
header (`for (struct { int i; int n; } it = ..; cond; inc)`) as a header
separator: the condition was lost and the loop ran forever, silently.
- A self-reading initializer is declared zeroed first (a plain declaration the
for-init printer never fuses with what follows), then assigned.
Basic tests: forrec (the header), localenum, and the loop program now runs.
…g loops, array sizeof, pointer compares
Migrator (each general, with a basic-test program):
- A _Bool operand promotes to int in arithmetic and bitwise work (6.3.1.1);
`b |= x` on a _Bool computes in int and converts back; a _Bool slot takes an
integer (a literal is the bool literal).
- A `T*` beside a `const T*` compares as one pointer type, in a comparison and
in a condition; the operand types are the body's own (a `const T*` parameter
written through is `*mut T`).
- A comma's left operand is discarded whatever its type (a void conditional).
- An initializer element with no type of its own takes the first typed one down
its last-child chain for its temporary.
- A designator spelled in a macro body (`.Tag = {..}`, c_variant) is read at
the spelling location; a name that is the macro's parameter resolves by the
value's type; a record-typed field left out takes `T.zeroed()`.
- `&((T*)0)->a.b` is D109's symbolic offsetof chain (c_container_of), spelled
by the record's definition cursors.
- A `[T; 1]` is a one-element array; only `[T; 0]` is the flexible member.
- An array value in a pointer slot decays to its address.
- Unions carry `@[repr(C)]` like structs (the parser keeps the attribute on a
union declaration); with_memcpy copies need no `unsafe` of their own (R4c).
Sema:
- A C union (repr(C), c_import) reads any arm without `unsafe`: punning is the
C it mirrors.
- An `unsafe fn` body is read through its block when judging fall-through, so a
body ending in `while true` without a break is not asked for a Default.
- `sizeof[[T; N]]()` resolves the array type, written out or with a count.
- A raw pointer compares by address: the pointee's `eq` is no candidate.
Migrated STC test units compiling: algorithm, cspan, deque, list, smap, utf8,
vec; hmap waits on bitfield records (the brief).
….libc
STC's cstr_vfmt is the vsnprintf-twice idiom: va_copy(args2, args), measure
with one list, format with the other. The migrator bailed on every va_copy
("a With list starts only at va_start"). A c_va_list is a value on every
target (the SysV x86_64 and AArch64 records, the Darwin and Windows
pointer), so va_copy is the copy `var dst = src` at the statement, with
dst's C declaration deferred to it as a started list's is (D75); va_end
stays nothing. A va_copy nested in another statement still bails, naming
the form.
cstr_from_file calls rewind, which std.libc did not model: it is declared
and allowed.
The basic tests gain vacopy: a va_list parameter copied and formatted twice,
and rewind on a stream; the migrated program builds and runs.
std.libc models gettimeofday (STC's coroutine timer) from the runtime's wall clock, which only had seconds. rt_wall_clock_ns is CLOCK_REALTIME on Darwin and Linux, the rebased FILETIME on Windows and the WASI realtime clock, all in nanoseconds since the Unix epoch; rt_core exports it as with_wall_clock_nanos.
…har, rewind STC's library units reach these: cstr_from_file rewinds its stream, fmt's _fmt_time formats a struct tm, its sprint writes putchar, the coroutine timer reads gettimeofday. tm is POSIX's layout, repr(C) so a migrated memset(&t, 0, sizeof t) zeroes it; timeval and gettimeofday are modeled portably over the runtime's wall clock, as mach_absolute_time is, since the C layouts differ per libc and nothing passes a timeval to C.
…member record types, variadic C strings Five rules STC's library units need, each general: - A goto body hoists its locals, and a list is declared only where it starts (Sema refuses `ap = va_start()`): a va_start that is a top-level statement of the body, starting its list once, hoists as `var ap: c_va_list = va_start()`; va_copy assigns a hoisted list declared uninitialized. Any other shape bails, naming it. - A hexadecimal float literal (0x1.0p-52, STC's random) has no With spelling: it is evaluated through the bridge and written as the decimal that reads back to the same binary64. - A C typedef spelling a With builtin type (STC's `typedef ptrdiff_t isize`) is renamed as prelude names are (#749): a std-package module's `pub type isize` shadows the builtin in every module of the package, std.collections included (#2552). - An unnamed member record referenced outside its parent (`sizeof self->sml`) was `c_void` to the bridge; the migrator now spells it as the record translation that embeds it does (`Parent_field`), through a new bridge accessor for a cursor's semantic parent. - A string literal in a variadic argument position is C's const char*, never a With str: `count(3, "ab", "")` read a str as a pointer. The allowlist names rewind, putchar, strftime, mktime, gettimeofday, tm and timeval. The basic tests gain vagoto and memberrec; each migrated program builds and runs.
… names its reason
STC's Unicode group table is `static const UGroup groups[N] = { [U8G_Cc] =
{ .. }, .. }`, through a macro. The migrator lowered array initializers
positionally only, so every `[index] = value` form bailed as an untranslatable
global initializer with no reason given. An array initializer with
designators now places each element (a designator sets the position, the
next element follows it), and the elements no initializer reaches are the
element type's zero: the scalar default, or the record's zeroed value.
The positional form is untouched, so the pinned corpora do not move.
libclang lists a designated init child's index expression first and the
value last; the index is folded. A range designator or one that does not
fold bails, and every bail of the lowering sets the bail message, which
the global-initializer error now prints after the location (it printed only
the name and location, which is how this one was diagnosed under lldb line
breakpoints at -O1 instead of being read off the log).
The basic tests gain arraydesig: designators through a macro, a record
element, an unreached element and an open array.
The ceremony census diff against main flagged what the new rules copied from their neighbours: `let _ =` on a discarded bool or extra-index, `len() as i32` for a count the loop already has, and parameter discards in the weak bridge stubs. Discarding needs no spelling, the counts are counters, and a stub's parameters are unused by nature.
Phase 3 of docs/proposals/stdlib_sourcing_plan.md, the pipeline half. STC (stclib/STC fc5c058, MIT) joins the corpus registry as std.stc: the library units under src/ (cstr, csview, cspan, utf8, random, fmt) migrated whole in STC_HEADER linkage against the header tree, plus a staged ucd unit for the Unicode category tables that upstream compiles only into cregex. cregex (setjmp) and stc_core, the coroutine runtime, stay out: the latter's records carry bitfields, which import opaque until #2553 is ruled; hmap and hset wait on the same. A corpus may now name include directories beside its staged sources (Corpus.include_dirs), which the migration passes as -I. The drift harness is upstream's examples/strings/replace.c. The test lanes mirror c-algorithms': stc-migrate-tests migrates upstream's eight ctest units in STC's default linkage (each unit instantiates the containers it tests) and appends a generated runner that calls every registered test from its `ctest` record, fixtures through setup and teardown; stc-promote-tests checks them in under test/corpora/stc; stc-test and stc-test-fresh assemble each program with the With half of ctest.h (test/corpora/stc_harness: the assertions, exported under their C names, counting failures instead of longjmp) and run it. hmap_test migrates but is not compiled until bitfields land. lib/std/stc is the first migration, promoted by hand from the same command the pipeline runs (the registry makes `build` depend on the bundle root, so the first migration cannot go through :stc-migrate); :stc-check-generated then regenerated it byte-identical.
…'s foreign externs need no wrapper STC's tests and its library both include priv/utf8_prv.c (upstream links the tests against a shared libstc, where the two definitions resolve to one), and the whole-project scan refused the second as a duplicate. A definition at the same real path, line and column as the symbol's owner is the same definition: the first owner publishes it and the later unit imports it. The duplicate error names both locations. A declaration no unit defines (ctest.h's assertions, which the With harness provides) was wrapped in `unsafe` at its call sites; in a corpus migrated into a std package Sema's policy for an extern is the compiler-implementation one (safe to call), and the wrapper was refused as vacuous (R4c). The wrapper stays for a user module's raw externs and for a project function another unit defines unsafe.
…taken (#2551) A struct store through a pointer from a value — a call's result, a compound literal, a cast, a conditional — rendered as with_memcpy from `&raw const <value>`, which is no place: Sema warned and codegen read from nowhere (STC's c_find_if test copied ISpan_begin()'s result into its iterator and crashed on the null it got). The value is bound to a `let` first and copied from there. The basic tests gain recstore.
`sizeof[[c_int; 9]]()` resolved in the check (the `[T; N]` literal forms) but codegen reads the type through the frozen resolver, which did not know them: every such sizeof failed codegen with "type argument did not resolve". The frozen resolver finds the array type the check created (D65: one answer, frozen or not).
…ness, and are checked in A test unit defines its containers under its own names (`Intmap` is an hmap in hmap_test.c and a sorted map in smap_test.c), so the units cannot share one defs.w: each program migrates whole, as c-algorithms' do — the test, ctest.h, the library units upstream links (shared libstc) and the ucd unit — with project-relative paths, since ctest.h bakes __FILE__ into every assertion. The promoted tree keeps one engine/ (the copies are byte-identical) and programs/<name>/ with each program's defs.w and test module. The harness exports ctest.h's assertions under their C names from With functions of their own names (an importer's `extern fn` of the same name drops the export, #2554) and counts failures in std.collections' atomic (an exported function may be entered from any thread; std.sync does not compile without the prelude, #2555). stc-test-fresh and stc-test: 7 programs, 19 tests, all pass (hmap_test waits on bitfields, #2553).
Every corpus migrated afresh (:stc-check-generated and the four others
green) and re-promoted through its pipeline target. What moved, and why:
a record copied from a value is bound before its address is taken (stc,
pcre2); a string literal in a variadic position is a C string (zlib's
fprintf("%s", "inflateInit") passed a With str before); a C identifier
spelling a builtin type name is renamed (tommyds', pcre2's parameters
named str); the STC library and test corpora from the branch's final
migrator. c-algorithms' modules did not move; two of its test programs
did (the rename).
…tifier's; rewind needs no Unit The rename of a C name spelling a With builtin type (#2552) was applied to every identifier, so a field named u8 became u8_ (the member-designator basic test caught it) and parameters named str were renamed for nothing (they carry a __param_ prefix). It applies to type declarations now: typedefs, record and enum names, their opaque forward forms; and the bridge spells a builtin-named record tag the same way at its references. A typedef's references need nothing: the bridge spells those by the underlying type. The ceremony allowance for plain-bits field copies in src rises 413 -> 415: two seed-blocked sites in CImport.w's hoisted initializer-element setups, swept with the others at the next seed. rewind drops its explicit -> Unit (unit-return-review).
A promoted corpus (a directory carrying corpus.stamp) and the checked-in test corpora are the migrator's spelling: an explicit -> Unit there is reviewed once, at the migrator (#1838), never per generated file. The first new corpus since the review existed (std.stc) asked for a hand review of every void function it migrated.
…ne-element trailing array is flexible only in c_import The battery's libc-surface-check lists the C-standard functions std.libc may export; the four this branch added are ISO C (same name and meaning in libSystem, glibc and the UCRT) and join the list. The branch read only a zero-length trailing array as C99's flexible array member, which undid #1915: Windows' ANYSIZE_ARRAY (`long long items[1]` in a packed record) is the same idiom in a program's c_import of a system header. That reading holds in a c_import session; a migrated corpus reads the one-element array it declares (STC's cspan_tuple1 { d[1] } and cspan_iter.pos[1] are real arrays, and the renamed field broke their designated initializers): D37, the migrator is faithful.
ehartford
marked this pull request as ready for review
October 22, 2026 10:51
ehartford
added a commit
that referenced
this pull request
Oct 22, 2026
* migrate: the general typedef path renames a builtin-named type too The type-declaration rename (#2552) reached the builtin-mapped and the anonymous-record typedef paths but not the general one, so STC's `typedef ptrdiff_t isize` came back as `pub type isize` on a fresh migration (the promoted corpus still carried the earlier identifier-wide rename). The opaque forward typedef and the general typedef escape the name as a type now. * The engine corpora live under std.engines (D146, delegated) Eric on #2556: facades are named for their function, not their provenance; the engine corpora are one tier and belong under one namespace; and there is no 1:1 mapping between an engine and a facade. So the migrated libraries move to std.engines.<library>, named for the library each one is: std.engines.c_algorithms, std.engines.tommyds, std.engines.pcre2 (was std.re), std.engines.zlib (was std.zl), std.engines.stc, with the test corpora beside them (std.engines.c_algorithms_testing, std.engines.stc_testing). The facades keep their functional names and compose from whichever engines they need. The change is the registry (package, corpus_rel, corpus_dir in build/*.w), the directory moves, and a mechanical rewrite of every importer: the facades, the tests, the tools, the build layer (the pinned seed still evaluates it, reading std.engines.zlib.deflate from the tree), the compiler's one path rule (the pcre2 exemptions in Sema keep their scope), the specs, CLAUDE.md and the source-sdk cache key. The .wo bundle names and the corpus pins are unchanged. The generated corpora were rewritten the same way and then re-promoted through their pipeline targets, which regenerated them (the rewrite and the migrator agree; the re-promotion also undoes the earlier identifier-wide rename of parameters named str in tommyds and pcre2). docs/with-abi.sha256 is re-recorded for a comment's path in TypeLayout.w; the convention is unchanged. * link: an extracted bundle object is named by the bundle it is; a runtime object by its generation The link stage extracted every embedded bundle object to one shared path, <artifact-root>/tmp/with_runtime/wo_<bundle>.o, with nothing of the bundle's identity in the name, and the runtime objects likewise. Every compiler process shares that directory, two generations included: the drop audit runs the pinned seed beside the candidate, and once the engine corpora moved (D146) the two generations hashed the modules differently, so a cell could link the other generation's object and fail on undefined __with_mod_ symbols (five cells, varying per run; every cell links by hand). On one layout the module hashes agreed and a swapped object still linked, which is how it hid: #761's mixed-generation class. The bundle object is now named by its interface sha and the runtime objects by the compiler generation; the extraction stays idempotent per identity. * link: the fiber assembly joins the identity-named runtime bundle The runtime bundle's extracted object is wo_rt_<interface sha>.o now; the predicate that adds fiber_asm.o beside it still tested for wo_rt.o, so a program whose runtime needed the fiber switch linked without it (three behavior fixtures). --------- Co-authored-by: Eric Hartford <[email protected]>
This was referenced Oct 23, 2026
ehartford
added a commit
that referenced
this pull request
Oct 23, 2026
…s c-migrator-basic-tests (#2576) * std.libc gains C's stdio input and string scanning families: fscanf, ungetc, strcoll, strspn, strcspn, strpbrk, strncat M*LIB's upstream B+tree test (tests/test-mbptree.c with m-string.h and tests/test-obj.h, the Phase 4 gate) parses through `fscanf`/`ungetc` and scans with `strpbrk`/`strspn`/`strcspn`/`strcoll`; the migrator refused each as an "unsupported filtered system variable". All seven are C standard: std.libc declares them, the migrator's libc allowlist and its ownership observer list admit them (none retains a pointer it is handed), and libc-surface-check's standard list names them. * A declaration directly under a case label is the arm's local `default: int d1 = c - '0'; int d2 = ...; return d2 + 1;` (m-string.h's octal escape parser) bailed at the DeclStmt: a switch arm's statements were lowered one by one with the switch's scope, and only a compound block threaded declarations through `lower_decl_stmt_structural`. An arm's statement now lowers through `lower_arm_stmt_ir`: a declaration is the arm's local, scoped to the arm as a block's is to the block, and the arm's scope threads through its later statements. Fixture: switch_arm_decl. * The gate runs c-migrator-basic-tests; macro_body_string_literal expects the C pointer a variadic literal is CLAUDE.md names c-migrator-basic-tests in the gate's fixed list; build.w's list did not have it, so the target ran only under the release tier's c-migrator-tests and a red landed on main unseen: #2556's rule renders a string literal in a variadic position as C's `const char*` (`c"…".ptr`), and the #791 fixture still expected a With `str` there. The rule is right: a `str` in a variadic C slot is read as two words (`fprintf(..., "%s|%d", "compress", 7)` prints `compress|8`, the str's length; filed as #2574 for the compiler). The fixture expects the pointer, and the gate runs the target. * A call through `(1 ? f : g)` calls the chosen arm M*LIB's M_IF selects a function by a literal condition (`(1 ? m_string_cat_printf : m_string_printf)(s, "%s", x)`); lowered as a conditional over two function values it was refused, since a `...` function is called directly, never used as a value. A conditional callee whose condition is an integer literal, or that literal compared with zero, folds to its arm before the call is built. Fixture: ternary_callee. A runtime condition (`(append ? m_string_cat_cstr : m_string_set_cstr)(s, "[")`) lowers as one call per arm under the condition, the arguments lowered once and shared (one arm runs, as in C); the then-arm's declaration coerces them, since C requires the arms' types to agree. --------- Co-authored-by: Eric Hartford <[email protected]>
ehartford
pushed a commit
that referenced
this pull request
Oct 23, 2026
…ine module build/zlib_gunzip.w is compiled by the driver, the pinned seed, against the tree's lib/std. It named `std.engines.zlib.defs` and `.inflate`, the corpus modules, so the zlib re-promotion in #2556 (union `zeroed()` in trees.w) made it uncompilable under the pinned Linux and Windows seeds (local-3 predates union zeroed): corpus-c-model and a fresh host's `:deps` went red on both Linux legs (#2582), while every seed's embedded `std.zlib` compiles. The helper now uses `std.zlib.decompress_gzip_with_limit`, as the corpus-reference helper (lib/std/build.w) always has, and writes the tar through libc without a copy. The whole archive is decompressed in memory (the facade has no streaming inflate); the largest input is the prebuilt SDK archive. Verified under the local-3 seed on eric-5090 and the darwin seed on the laptop.
ehartford
pushed a commit
that referenced
this pull request
Oct 23, 2026
…ine module build/zlib_gunzip.w is compiled by the driver, the pinned seed, against the tree's lib/std. It named `std.engines.zlib.defs` and `.inflate`, the corpus modules, so the zlib re-promotion in #2556 (union `zeroed()` in trees.w) made it uncompilable under the pinned Linux and Windows seeds (local-3 predates union zeroed): corpus-c-model and a fresh host's `:deps` went red on both Linux legs (#2582), while every seed's embedded `std.zlib` compiles. The helper now inflates with `std.zlib.decompress_gzip_with_limit`, as the corpus-reference helper (lib/std/build.w) always has, and keeps its `decompress_gzip_to_file` contract (limits, failures, the output file's existence) that behav_zlib_gunzip_owned pins. The whole archive is decompressed in memory (the facade has no streaming inflate); the largest input is the prebuilt SDK archive. Verified under the local-3 seed on eric-5090 and the darwin seed on the laptop.
ehartford
added a commit
that referenced
this pull request
Oct 23, 2026
…SDK gunzip helper uses std.zlib (#2586) * A pointer to C's char is a pointer to c_char, the target's alias (§16.1, #2176) The clang bridge spelled a char pointee `i8` while the scalar was `c_char` and the per-target alias prelude made `c_char` u8 on AArch64 Linux and wasm: three spellings of one C type. On the unsigned-char target a migrated `*p = *q` narrowed u8 to i8 (c-migrator-core-tests' check-macro-unsigned-minus) and a `*const i8` union field refused `null as *const c_char` with an ICE (c-migrator-basic-tests' build-member), both found by the linux-aarch64 seed leg (#2582). The pointee is now `c_char`, and the bridge's signedness classifiers (is_unsigned_kind, with_ci_type_is_unsigned, the bitfield member rule) treat Char_U as the unsigned it is there, as #2176's alias does. `unsigned char` stays `u8`. A migrator selfhost case pins the spellings. * A va_list never decays: it is the opaque c_va_list value on every target (#1104) On x86_64 Linux `va_list` is `__va_list_tag[1]`, an array to clang, so the migrator's array-to-pointer decay rewrote `vsnprintf(..., args)` as `(&args[0] as *mut __va_list_tag) as c_va_list`, indexing an opaque type and naming a record With never emits (c-migrator-basic-tests' build-vacopy on the linux-x86_64 seed leg, #2582; green on darwin, where va_list is a pointer). The array-type predicate the decay sites share answers false for a va_list, so the argument is the value itself, as on the other targets. Verified on eric-5090 with a patched stage1: the case builds and runs. * The SDK gunzip helper reaches zlib through std's facade, never an engine module build/zlib_gunzip.w is compiled by the driver, the pinned seed, against the tree's lib/std. It named `std.engines.zlib.defs` and `.inflate`, the corpus modules, so the zlib re-promotion in #2556 (union `zeroed()` in trees.w) made it uncompilable under the pinned Linux and Windows seeds (local-3 predates union zeroed): corpus-c-model and a fresh host's `:deps` went red on both Linux legs (#2582), while every seed's embedded `std.zlib` compiles. The helper now inflates with `std.zlib.decompress_gzip_with_limit`, as the corpus-reference helper (lib/std/build.w) always has, and keeps its `decompress_gzip_to_file` contract (limits, failures, the output file's existence) that behav_zlib_gunzip_owned pins. The whole archive is decompressed in memory (the facade has no streaming inflate); the largest input is the prebuilt SDK archive. Verified under the local-3 seed on eric-5090 and the darwin seed on the laptop. --------- Co-authored-by: Eric Hartford <[email protected]>
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.
STC corpus (std.stc) and its test lanes — stdlib_sourcing_plan Phase 3, the pipeline half
STC (stclib/STC fc5c058, MIT) joins the corpus registry as
std.stc: the library units undersrc/(cstr, csview, cspan, utf8, random, fmt) migrated whole in STC_HEADER linkage against the header tree, plus a stageducdunit for the Unicode category tables upstream compiles only into cregex. The.wobundle islib/std/stc; the drift harness is upstream'sexamples/strings/replace.c.Upstream's tests run under With: each of the eight ctest units migrates as its own program (a unit's
#define T Intmap ..is an hmap in one test and a sorted map in another, so no shared defs), with the library units upstream links and a generated runner that calls every registered test from itsctestrecord (fixtures through setup/teardown). The assertions are a With harness (test/corpora/stc_harness) exporting ctest.h's C names; a failed assertion counts instead of longjmp.stc-test-freshandstc-test: 7 programs, 19 tests, all pass; promoted undertest/corpora/stc(one sharedengine/,programs/<name>/).Out, loudly:
cregex(setjmp) andstc_core(the coroutine runtime: its records carry bitfields) stay out of the corpus, andhmap_testis migrated but not compiled, all on the same cause: a record with bitfields imports opaque (§16.9). The brief for Eric is #2553; STC'shmap/hset(the ruled defaultHashMap/HashSetengine) wait on it, so the facade half of Phase 3 is not in this PR.Migrator rules, each general, each with a basic-test case (
bs_check_migrate_stc_expression_forms)va_copyisvar dst = src(ac_va_listis a value on every target); in a goto body a top-levelva_starthoists asvar ap: c_va_list = va_start()andva_copyassigns a hoisted uninitialized list.isize→isize_): a std-packagepub type isizeshadows the builtin in every std module (A std-package module'spub type isizeshadows the builtin in every module of the package (D100), breaking std.collections #2552).sizeof self->sml) is named as its parent's translation names it (Parent_field), through a new bridge accessor for a cursor's semantic parent.count(3, "ab", "")read astras a pointer; zlib'sfprintf("%s", "inflateInit")had the same latent bug).[index] = valuearray designators, through macros, with unreached elements zeroed; a global-initializer bail names its reason.letbefore&raw const(migrate: a record assigned from a conditional renders&raw const (if ...), which is not a place (pcre2_substitute warns) #2551: it compiled to a read from nowhere and crashed STC'sc_find_if).priv/utf8_prv.c); a std corpus's foreign externs get nounsafewrapper (Sema's policy; the wrapper was refused as vacuous).Also
std.libc:rewind,putchar,@[repr(C)] tm,strftime,mktime,timeval/gettimeofdayover a new runtime wall clock in nanoseconds (rt_wall_clock_ns, every platform).[T; N]forms (sizeof[[c_int; 9]]()failed codegen).Corpus.include_dirs: a corpus may name include directories beside its staged sources.strparameter rename (tommyds, pcre2, two c-algorithms test programs).&raw const (if ...), which is not a place (pcre2_substitute warns) #2551, A std-package module'spub type isizeshadows the builtin in every module of the package (D100), breaking std.collections #2552, migrate: bitfield records import opaque; STC's hmap/hset and coroutine runtime need C's bitfield layout (brief) #2553 (bitfields brief), A@[c_export]definition is silently dropped when an importer declares the same nameextern fn; a bare@[c_export]exports nothing #2554 (a@[c_export]definition dropped by a same-namedextern fn; a bare@[c_export]exports nothing), std.sync does not compile in a --no-prelude program: its Result matches read the prelude's Ok/Err #2555 (std.sync under--no-prelude).Evidence
:stc-check-generated, the four other corpora's check-generated lanes,:stc-test-fresh,:stc-test,:c-migrator-basic-tests,:c-migrator-core-tests, the ceremony census diff andsrc/main build :gategreen; the seed-driven battery GREEN on f5e33c8 (with run tools/battery.w, wall 471 s).Closes #2551 (the bound memcpy source).