Repository navigation
t27b port: decl_line and parse_int of lower.rs move to specs/tri/t27b/decl_text.t27 #8590
Copy link
Copy link
Open
Labels
Description
Part of the t27b port (see #6198, epic #8326). t27b must be generated entirely from .t27; this moves one slice of hand-written Rust out of cli/t27b/src/lower.rs.
Problem
These top-level functions of cli/t27b/src/lower.rs are hand-written Rust: decl_line, parse_int. Both read only source text (a declaration's line, an integer literal's value).
How (copy the precedent exactly)
Read #8569, #8350 and #8235 first (gh pr diff 8569 --repo gHashTag/t27). Each one:
- writes the decision in a new spec with
testblocks; - generates
gen/rust/tri/t27b/<name>.rswitht27c gen-rust; - mounts it in lower.rs with
#[path = "../../../gen/rust/tri/t27b/<name>.rs"] mod <alias>;; - calls it from thin glue;
- deletes the hand bodies.
Keep the function names so the callers stay as they are, or rename them at the call sites in the same file.
Boundary
specs/tri/t27b/decl_text.t27gen/rust/tri/t27b/decl_text.rscli/t27b/src/lower.rs
Requirements
- FR-001: The decisions MUST live in
specs/tri/t27b/decl_text.t27with at least onetestblock per moved function. Each test MUST call the function by name. - FR-002:
gen/rust/tri/t27b/decl_text.rsMUST be the unedited output oft27c gen-rust specs/tri/t27b/decl_text.t27(L2). - FR-003: The PR MUST be net <= 0 in hand-written lines across all files (specs/policy/own_language.t27, check_budget, policy: hand-written code in any language but t27 may only shrink (Closes #8227) #8236). The moved bodies are deleted, and glue is thin.
- FR-004:
cargo test -p t27bMUST still pass, and t27b's corpus verdicts MUST NOT change. This is a pure port. - FR-005: The steward adds the new spec's ledger row and seal at merge; do not edit docs/reports/t27b_expectations.json or .trinity/seals/ in this branch.
Success Criteria
grep -c '^fn decl_line' cli/t27b/src/lower.rsprints0grep -c '^fn parse_int' cli/t27b/src/lower.rsprints0grep -c 'decl_text.rs' cli/t27b/src/lower.rsprints1t27c spec-status specs/tri/t27b/decl_text.t27printsIMPLEMENTED
User Scenarios
- Given the t27b compiler's
lower.rscontains hand-writtendecl_lineandparse_intfunctions, when the port is complete, then those functions are implemented inspecs/tri/t27b/decl_text.t27and the generatedgen/rust/tri/t27b/decl_text.rsis mounted inlower.rswith thin glue. - Given the new spec
specs/tri/t27b/decl_text.t27with test blocks for each moved function, whent27c gen-rustruns, thengen/rust/tri/t27b/decl_text.rsis produced as the unedited L2 output andt27c spec-status specs/tri/t27b/decl_text.t27reportsIMPLEMENTED. - Given the PR deletes the hand-written function bodies from
lower.rsand adds the mount + glue, whencargo test -p t27bruns, then all tests pass and t27b's corpus verdicts remain unchanged.
Reactions are currently unavailable
Activity
gHashTag commentedon Oct 11, 2026
Update (2026-10-11, from the t27o measurement in PR #8970): most of this slice's logic is ALREADY in t27. decl_line, parse_int, int_lit_width, zig_renders and is_prose_clause are thin wrappers over the generated modules source_text.t27 / ast_walk.t27, and zig_syntax_defects no longer exists in lower.rs. kind_name and cse_hoist_defect still return String, and zig_mutates returns a tuple.
What is left is glue deletion, not a new spec. Per the DRY rule (AGENTS.md, see #8963), do NOT create a new spec that copies logic already in source_text/ast_walk/ast_scan. Call those modules directly from the call sites, delete the wrappers, and move only the parts that are not yet in t27 into the EXISTING module that fits. The Boundary and criteria above still hold, except that a new spec file is not required when the logic already lives in an existing one.