Skip to content

test(gc): temp-root codegen contract lives only in crates/perry-codegen/tests/, which does not run per-PR #6988

Description

@proggeramlug

Split out of #6983, where it was raised in review and explicitly declined rather
than silently skipped.

The gap

All of the temp_root family's codegen coverage lives in
crates/perry-codegen/tests/temp_root_argument_temporaries.rs (#6972) and
temp_root_operand_temporaries.rs (#6983), 10 tests between them. Per CLAUDE.md:

Integration suites under crates/*/tests/*.rs do not run per-PR (nightly/tag
only) — a regression there can land green and sit red for days. Prefer putting
acceptance coverage in cargo-test-visible unit tests (#5960).

So the assertions pinning the rooting emission contract — push → re-read →
consuming call → release, and the interleaving requirement — are CI-invisible on
the PRs most likely to break them. The runtime half (gc::tests::temp_roots,
in src/) does run per-PR; the codegen half does not.

That matters more than usual for this family, because the failure mode is
silent. A lowering path that quietly goes back to threading a value through an
SSA register produces correct output under the default configuration — the
conservative native-stack scan pins it by accident — and only diverges under
PERRY_CONSERVATIVE_STACK_SCAN=off or an evacuating minor. The emission-contract
tests are the fast signal; the corpus arms are the slow one.

Why it was not fixed in #6983

The assertions need a built Module plus compile_module, so moving them into
src/ unit tests means either constructing a FnCtx by hand or duplicating the
~90 lines of entry_opts() / module_with_init() harness. Doing that once for
the whole family is worth it; doing it piecemeal for one PR's three tests is not,
and would leave the two files inconsistent.

Suggested shape

Extract the harness (entry_opts, module_with_init, ir_for, plus the
ir_for_new class builder from #6983) into something both a src/ unit-test
module and the existing integration tests can call — a #[cfg(test)] helper
module in perry-codegen, or a small pub(crate) test-support module — then
move at least the ordering/interleaving assertions across:

The negative gates matter as much as the positive ones — they are what keeps the
fix from silently becoming a cost on hot paths.

Related: #6951, #6972, #6975, #6983, #5960.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions