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
#691 flip widens the #607 consuming-iteration gate to every Vec — 11 behavior tests red #712
Since #691 made every Vec needs-drop, the #607-era gate ("consuming iteration
of a Vec whose elements need drop is not yet supported") now rejects plain for v in vec for ALL element types, including Vec[i32].
Repro (post-flip compiler, e.g. out/release/bin/with):
./out/release/bin/with run test/behavior/vec_map_basic.w
error: consuming iteration of a Vec whose elements need drop is not yet
supported (#607); iterate by borrow instead: `for w in &vec`
--> test/behavior/vec_map_basic.w:8:14
with build :test fails 11 behavior tests on this (first post-flip run of the
suite with a flip-carrying candidate): issue66_ir_text_only, it_desugar_field,
it_desugar_filter, prelude_core_mode, vec_filter_basic, vec_map_basic,
vec_map_debug, vec_map_it, vec_map_manual, vec_map_type_change_return, and one
more in the tail. The stage-1 -p/-n one-liner driver trips the same gate
(for __line in stdin.lines()).
Fork to decide: implement consuming Vec iteration (move elements out, free the
buffer, reset the source — drop-audit-sensitive lowering work), or migrate the
tests/driver to for v in &vec and accept the ergonomic regression until the
feature lands. The tests pin basic map/filter ergonomics, so migrating them
weakens mission-level pins; the diagnostic's own suggestion conflicts with
"don't make the user write what the compiler could figure out."
Found while closing the D22 Stage 6 gate (2026-07-25); everything else in the
battery is green (fixpoint stage2==stage3, move/drop audits, allocator matrix).
// These are equivalent:
for item in my_vec: // compiler inserts .iter()
for item in my_vec.iter(): // explicit (also valid)
...
for item in my_vec.into_iter(): // consuming (moves elements)
"The implicit `.iter()` insertion means `for x in collection:` borrows
the collection immutably — the collection remains valid after the loop."
So for v in doubled: must borrow, and the #607 gate
(src/SemaCheck.w:9880-9890) should never see the implicit form. The current
for-lowering treats a bare Vec iterable as by-value — a pre-flip copy-world
artifact (the gate's own comment says "POD-element Vecs are untouched", which
was only true while type_needs_drop(Vec[POD]) was 0). The 11 red tests are
implementation non-conformance to the blessed iteration rule, not a feature
gap. Consuming .into_iter() (Rust vec::IntoIter-style remainder-drop) can
land separately; nothing red requires it.
Resolved by evolution — verified on v0.15.1-geb0a0cf31: the #607-era gate no longer fires. All 11 behavior fixtures named in this report pass (issue66_ir_text_only, it_desugar_field, it_desugar_filter, prelude_core_mode, vec_filter_basic, vec_map_basic, vec_map_debug, vec_map_it, vec_map_manual, vec_map_type_change_return), plain 'for j in vec' over a drop-element Vec runs and leaves the source intact, and the -n/-p one-liner driver works. The fork this issue posed (implement consuming iteration vs migrate the tests to 'for v in &vec') never had to be taken: the mission-level ergonomic pins are intact and unmigrated. A separate pre-existing leak found while auditing this — nested Vec element buffers are not freed on drop — is filed as #736.
Activity
ehartford commentedon Jul 25, 2026
Correction after checking the specification: this is not a design fork.
docs/with-specification.md (§13, implicit iteration) already rules it:
So
for v in doubled:must borrow, and the #607 gate(src/SemaCheck.w:9880-9890) should never see the implicit form. The current
for-lowering treats a bare Vec iterable as by-value — a pre-flip copy-world
artifact (the gate's own comment says "POD-element Vecs are untouched", which
was only true while type_needs_drop(Vec[POD]) was 0). The 11 red tests are
implementation non-conformance to the blessed iteration rule, not a feature
gap. Consuming
.into_iter()(Rust vec::IntoIter-style remainder-drop) canland separately; nothing red requires it.
ehartford commentedon Jul 27, 2026
Resolved by evolution — verified on v0.15.1-geb0a0cf31: the #607-era gate no longer fires. All 11 behavior fixtures named in this report pass (issue66_ir_text_only, it_desugar_field, it_desugar_filter, prelude_core_mode, vec_filter_basic, vec_map_basic, vec_map_debug, vec_map_it, vec_map_manual, vec_map_type_change_return), plain 'for j in vec' over a drop-element Vec runs and leaves the source intact, and the -n/-p one-liner driver works. The fork this issue posed (implement consuming iteration vs migrate the tests to 'for v in &vec') never had to be taken: the mission-level ergonomic pins are intact and unmigrated. A separate pre-existing leak found while auditing this — nested Vec element buffers are not freed on drop — is filed as #736.
handoff: record the Stage 6 batch — 19 roots, evidence, and open rulings
test: compile-error lane dispositions per approved rulings
compiler: for-loops over generic iterator values — infer, demand, dis…
test: D33 consuming-iteration acceptance — behavior pins + drop-exact…