Repository navigation
t27o: read-only vec![..] becomes a typed array (step 1 of #10546) - #10648
Merged
Merged
Conversation
Owner
Author
|
Review (orchestrator, Opus):
|
gHashTag
enabled auto-merge (squash)
October 18, 2026 20:46
This was referenced Oct 18, 2026
gHashTag
force-pushed
the
t27o/vec-literals-10546
branch
from
October 18, 2026 20:47
b340384 to
097927f
Compare
This was referenced Oct 18, 2026
Contributor
This was referenced Oct 18, 2026
…hared with the empty slice (Closes #10643) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…e number or one const (Closes #10643) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… fn, so a test that reaches a refused fn that way is refused with it (Closes #10643) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…10643) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
gHashTag
force-pushed
the
t27o/vec-literals-10546
branch
from
October 18, 2026 21:16
097927f to
bd7f2c8
Compare
Contributor
PR DashboardGenerated at: 2026-10-18 21:23:05 UTC
Summary
Seal Status
|
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.
Step 1 of #10546 (lane V of epic #10522). Closes #10643.
Stacked on #10631 (linear lookups) and, under it, #10611: all three edit
specs/tools/t27o/rust_convert.t27. Until they land, this diff shows their commits too; the commits of this PR are the last four.What
A
vec![a, b, c]orvec![x; N]that the fn only reads is a typed t27 array:The array literal is the existing one (
array_lit);let_vecadds the type. The type is never guessed, it comes from the source, in this order:Vec<T>annotation;&[T]parameter of the call that takes&v(site_elem, the codeempty_argused for&[], now shared).Nis one number without a suffix or one const of the file (t27b's** ntakes a literal or a name).let mut vthat is never changed is avar.A vec stays refused, with a reason that says which:
a vec! the fn changes (push, resize, assign into, &mut)v.push(..), any method that is not a read,v[i] = ..,v = ..,&mut va vec! the fn hands on or returnsvpassed by value, bound to another name, returned, put in a structa vec! whose element type or length t27o cannot tell&vargument that names a type; a repeat count that is not a number or a constmacro vec(unchanged)let: a struct field, an assignment, an argument, anassert_eq!operandA later
letof the same name ends the scope (its init still counts).array_localknowsv = vec![..], so&vis written&vas for any array.Separate commit:
super::,self::,crate::depsreadsuper::f(..)as a path and never as a use off, so a test that called a refused fn throughsuper::reached its stub. Measured on the baseline binary with a four-line file. With vec! converting, four tests ofcli/tri/src/orphaned.rsconverted that way andtri t27o --checkanswered BLOCKED (expected type '[][]const u8', a stub). The path now counts as a use of the fn of this file. Cost on the baseline: 10 fns that converted by reaching a stub or a name another file declares are refused (gates.rs 7, service.rs 2, trios channel.rs 1), 1 inside the 16,775-fn set.Measure
tri t27oovergit ls-files '*.rs'of the same five repositories at the same commits (t27 7496ed2, trios 483dd9ee, trinity 0770abb9, trinity-fpga 20bf4c418, 999-multibots-telegraf 6e5512881); before = the stack tip (#10631), after = this branch. Files excluded as in the stack-tip baseline: bootstrap/src/compiler.rs, bootstrap/src/service.rs, cli/t27b/src/lower.rs, cli/tri/src/fpga.rs, cli/tri/src/gates.rs.vecVecAll files: macro
vec1,430 to 561; converted 1,841 to 1,831 of 19,402.Of the 1,430 fns whose first refusal was the vec!, 190 are now refused for what the fn does with it (changes 91, unknown type or length 78, hands on 21), 561 stay
macro vec, and 679 are past it. None of the 679 converts: 575 stop atuses refusedof a callee, and the callee's own first refusal istype BTreeSet(223) pluspath BTreeSet::new(53) (the trios guard validators),method to_string(41),method iter(39),type Vec(34); the vec! was hiding that layer. The converted count does not move because the four tests the vec! alone converted were the stub-reaching ones above.Of the 561 that stay
macro vec: 237 struct field labels, 105 assignments, 57assert_eq!operands, 100 lets whose init holds the vec! inside a call or a struct literal, 47 vec! at the start of a line (arguments, fields), 15 call arguments. These are the callee-owns-a-Vec forms (steps 2 and 3).No converted output changed except where a vec! was involved, or by the
super::commit: of 1,388 per-file outputs, 1,125 are byte-identical; the other 263 differ in a vec! reason, in what a fn that passed the vec! reaches next, in the first refusal of a typedVec<T>let, or in auses refusedthat thesuper::commit added.The sample
30 random first refusals
macro vecof the 1,430, read at the source: 19 a local that is only read (18 handed to a callee as&v, 1 through.as_slice(); 2 of them hold Strings), 3 a struct field initialiser, 2 a field assignment, 2 a local handed on whole, 1 a local pushed to, 3 an argument orassert_eq!operand. 28 of 30 sit in#[test]fns. Over all 1,430: 1,280 in tests, 145 not.Tests
t27b test107 of 107 (was 101);t27c test-reportvacuous passes 0 of 107. New: one test per form (read by index, iterated withforand.iter(),let mutnever changed,&vwith a struct, an integer and a repeat), negative controls (pushed, indexed assignment,&mut, moved, rebound, shadowed then pushed, runtime length, expression length, unknown type, an argument), and thesuper::pair.tri t27o --checkon a file with all the forms: 8 of 8 pass under t27b. Sealed.🤖 Generated with Claude Code