You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
migrate: a record assigned from a conditional renders &raw const (if ...), which is not a place (pcre2_substitute warns) #2551
The pcre2 corpus warns when compiled from source (main 603b557, with check lib/std/re/bundle.w --no-prelude --bundle-corpus std/re):
warning: `&raw const` requires a place; this expression is not a place
--> lib/std/re/pcre2_substitute.w:593:82
593 | with_memcpy((&raw mut __local_gcontext__goto_876_25.memctl as *mut u8), (&raw const (if (if __param_mcontext == null: 1 else: 0) != 0: (*(__param_code as *mut pcre2_real_code_8)).memctl else: (*__param_mcontext).memctl) as *const u8), sizeof[pcre2_memctl]())
The C is a struct assignment from a conditional (gcontext.memctl = mcontext == NULL ? code->memctl : mcontext->memctl). The migrator renders the record copy as with_memcpy and takes &raw const of the if expression, which is a value, not a place; the .wo bundle hides the warning from every link, and a :dev stage1 compiling std from source prints it twice per build.
Expected: the conditional selects a place when both arms are places (&raw const of the chosen arm, or a temporary bound first and copied from), never an address of a value. A migrated record assignment from a conditional is the general form (x = c ? a : b for any record x).
Found while bootstrapping the STC corpus (Phase 3 of docs/proposals/stdlib_sourcing_plan.md).
Activity
STC corpus (std.stc) and its test lanes: stdlib_sourcing_plan Phase 3…
Phase 4: BTreeMap and BTreeSet over the M*LIB B+tree (D151); D152; D1…