Repository navigation
t27o: read-only vec![..] literals become array literals (step 1 of #10546) #10643
Description
Goal
Step 1 of #10546 (lane V of epic #10522): a vec![a, b, c] or vec![x; N] (N a constant) that a fn only reads -- a local never pushed to, resized, mutated, moved on or returned -- converts to a typed t27 array, const v : [3]T = [a, b, c]; / const v : [N]T = [x] ** N;, which t27 passes as a slice. Anything the fn changes, hands on or returns, or whose element type t27o cannot tell, stays refused, with a reason that says which.
Boundary
- May touch:
specs/tools/t27o/rust_convert.t27, its regeneratedgen/rust/tools/t27o/rust_convert.rs, its seal. - Must not touch:
cli/tri/src/main.rs,spice_convert.t27,rust_std.t27. - Stacked on the open t27o: a declaration index, a line cache and a bounded for-search make tri t27o linear in the file; compiler.rs finishes in 1.3 s (Closes #10544) #10631 (linear lookups) and t27o: integer ! is a bitwise ~, the oracle spec uses type_text, the harness drops no_std (Closes #10534) #10611, which edit the same spec.
Done when
- Tests per form (a local read by index, a local iterated with
for, a local passed as&v,vec![0u8; 4]) and negative controls (a pushed vec, a returned or moved vec, an unknown element type stay refused) pass undert27b test, 0 vacuous undertest-report. - The
macro vecfirst-refusal count is reported before and after on the same five repositories and commits, and no converted output changes except wherevec!was involved.
User Scenarios
- Given a function contains a local
let v = vec![a, b, c];that is only read by index or iterated withforor passed as&v, and the element type is known, When t27o processes the function, Then the vec literal becomes a typed arrayconst v : [3]T = [a, b, c];passed as a slice. - Given a function contains
let v = vec![x; N];with constantNthat is only read, When t27o processes the function, Then the vec literal becomesconst v : [N]T = [x] ** N;. - Given a function contains a vec literal that is pushed to, returned, moved, resized, or has unknown element type, When t27o processes the function, Then the vec literal stays refused with a reason stating which condition prevented conversion.
Requirements
FR-001: t27o MUST convert a read-only vec![a, b, c] local with known element type to const v : [3]T = [a, b, c]; passed as a slice.
FR-002: t27o MUST convert a read-only vec![x; N] local with constant N and known element type to const v : [N]T = [x] ** N;.
FR-003: t27o MUST refuse conversion when the vec local is pushed to, and the reason MUST state "pushed".
FR-004: t27o MUST refuse conversion when the vec local is returned or moved, and the reason MUST state "returned or moved".
FR-005: t27o MUST refuse conversion when the vec local is resized or mutated, and the reason MUST state "resized or mutated".
FR-006: t27o MUST refuse conversion when the element type cannot be determined, and the reason MUST state "unknown element type".
FR-007: The macro vec first-refusal count MUST be reported before and after on the same five repositories and commits, with no converted output changes except where vec! was involved.
Activity
t27o: vec! tests per form and negative controls; a repeat count is on…
t27o: a call through super::, self:: or crate:: names this file's own…
t27o: re-seal rust_convert.t27 (107 of 107 tests, 0 vacuous) (Closes #…
t27o: a vec! the fn only reads is a typed array, let_vec; site_elem s…
t27o: vec! tests per form and negative controls; a repeat count is on…
t27o: a call through super::, self:: or crate:: names this file's own…
t27o: re-seal rust_convert.t27 (107 of 107 tests, 0 vacuous) (Closes #…
github-actions commentedon Oct 18, 2026
Closed by the issue-shape gate (specs/policy/issue_shape.t27, #7498): an issue must have the template's sections. Edit the body; an edit that passes reopens it.
FR-001: ... MUST ...t27o: a vec! the fn only reads is a typed array, let_vec; site_elem s…
t27o: vec! tests per form and negative controls; a repeat count is on…
t27o: a call through super::, self:: or crate:: names this file's own…
t27o: re-seal rust_convert.t27 (107 of 107 tests, 0 vacuous) (Closes #…
t27o: read-only vec![..] becomes a typed array (step 1 of #10546) (#1…