Skip to content

Release v0.2.74

Choose a tag to compare

@github-actions github-actions released this 04 Nov 05:45

Patch release v0.2.74

Changes

Values by default: collections are values

ArrayList, String, HashMap, HashSet, Deque, BTreeMap, OrderedMap, PriorityQueue, StringBuilder, HeaderMap and HttpHeader are no longer hidden handles. Each is a value with a single owner that owns its buffer (VBD decision 46). This is breaking for user code:

  • Assignment and argument passing MOVE a live collection or string: t := s over a live String/ArrayList/HashMap/... is E0901 ("cannot copy"), and the help names the repair. A hidden handle copy that used to alias the storage is gone, so a write through one name can no longer show up under another.
  • An independent copy is spelled .clone(). Sharing is spelled Rc(RefCell(StringBuilder)) (or another cell) explicitly; reading or mutating without taking ownership is spelled with a & / &mut borrow, and a binding that is mutated through is mut(x).
  • xs.get(i) over a non-Copy element is E0901 (it would copy the element out of the buffer). Use xs.get_cloned(i), read in place with xs(i), or xs.with(i, body). The same holds at a counted-handle element (ArrayList(Rc(T)).get), now that std generic bodies are judged at each instantiation like user generics (the std-generic exemption and YO_DEBUG_V2C_JUDGE_STD_GENERIC are deleted); the E0901 is anchored at your call site and the std location becomes a note.
  • Snapshot accessors for the key/value walks that a consuming keys()/values() cannot serve: HashMap.keys_cloned(), HashMap.values_cloned(), HashSet.items_cloned() (each -> ArrayList(_), bucket order, requires Clone).
  • BTreeMap.range now consumes the map (like keys/values); .clone() first if the map is used again. StringBuilder gains into_string(self), which hands its buffer over without a fresh allocation; to_string(&mut Self) keeps its detach-and-continue contract. HeaderMap.entries() used to return a detached snapshot and now borrows the map's own list (writing through it is a compile-time error); the snapshot is entries().clone().
  • Send/Sync of each collection hold exactly when the element types are.
  • Removed because the flips make them pointless: yo fix --migrate explicit-copy, --migrate cloned-accessors, --hot-path, and the YO_AUDIT_IMPLICIT_COPY / YO_AUDIT_COPYING_ACCESSOR listings (last shipped in v0.2.73; after the flip every copy they rewrote is an E0901 whose help names the same rewrite, and evaluation stops there so their recorders see nothing). Upgrading from v0.2.73: run explicit-copy, then cloned-accessors, then rc-clone on v0.2.73, then step to v0.2.74 and follow E0901's help (ERROR_DIAGNOSTICS.md "Retired migrations").
  • Flip PRs: ArrayList/String (#1736), HashMap/HashSet (#1737), Deque/BTreeMap/OrderedMap/PriorityQueue (#1741), StringBuilder/HeaderMap/HttpHeader (#1743), std-generic exemption drop (#1735). The compiler's own TypeValue bound lists moved into Rc(RefCell(...)) cells because their late writes must stay shared (#1736). The 614-site get to get_cloned sweep over src, std and tests rode #1735.
  • Docs (en-US, zh-CN), the instruction files and the bundled skill cheatsheets describe the value model.

Type checking

  • A borrow binding passed bare to a reference parameter now lends its place: f(xs, xs) with xs : &mut T into (&T, &mut T) is E0910, as the local spelling f(&xs, &mut xs) already was; the call was a heap use-after-free when f grew one argument while reading the other (#1745, S1).

  • An impl method that calls itself, or a sibling above it forced early, can now pass &x / &mut x as the first argument of a static call T.m(&x, ...) — while the member is still being evaluated, that call's argument 0 was treated as a receiver and its marker left unpeeled (#1733).

  • Escapable (O10) is derived structurally: an Rc/Arc payload and where(T <: Escapable) reject a value carrying a reference (E0909), and a borrow through a read-only handle (&h.*.x, { x : &h.*.x }) freezes the handle for its extent (#1724, decision 43 N1d).

  • A borrowed for loop through a cell is now checked across an await in its body (E0911) — the macro form had skipped it (#1727, S3).

  • A function's parameter origins are carried, not checked: the Origin kind, generic(p : Origin) and parameters typed &(T, p) / &mut(T, p); an undeclared origin is E0922 (#1698; decision 43 step 2 begins).

  • A function's result is now the Reference slot: -> &(T, o) spells a result origin (E0912/E0922; result_is_ref/result_is_mut_ref deleted) (#1705).

  • ref(...)/atomic(...) type spellings now warn on every use, ahead of their removal in v0.2.75 (#1707).

  • Freeze roots narrow to the spelled result origin; a body returning a spelled origin follows the return rule (E0912/E0923); impl ⊆ trait is enforced; Dyn calls map from the trait; a Dyn over a trait with a projection method no longer emits invalid C (#1711).

  • A loan of the same ref cell as both &mut and & to one call is now rejected at check time, with a diagnostic naming the shared cell; disjoint paths, two shared lends, and distinct cells still pass (#1717).

  • View structs and tuples over &T / &mut T now build, copy and pass by value: a constructor lends each reference field's place, the binding freezes it (E0911), returning a local-rooted one is E0912; &T fields are Copy, &mut T holders are move-only; reference fields lower as const T* / T* (#1720; decision 43 step 3, N2b — the release's references scope is complete).

  • Fn(...) -> &T result slots land with a pointer-returning closure-call ABI: projection calls work through function values (Impl(Fn)/Dyn(Fn)/ctl handlers), and closures and handlers can return references (#1712; decision 43 step 2 complete).

  • &T / &(T, o) can be named in every type position (alias, type argument, field) — the "a borrow mode, not a type" error is gone there; type constructors take comptime(p : Origin) and instances carry the call's origin, erased from type identity; new E0924, and E0909 now fires at extern signatures and module-level bindings whose type carries an origin (#1713; decision 43 step 3, N2a).

  • The element-borrow sibling rule (&mut xs(0) beside another argument) now rejects a sibling only when it reaches the container through a reference-semantic edge (a ref type, Rc/Arc, a cell handle, a Reference field, or the sibling's own borrow mode). grow_beside(&mut xs(0), ArrayList(String).new()) — a value list that cannot alias xs — was a false rejection once lists became values (#1739, S2).

  • A downcast to a move-only type is E0901 unless the Dyn lists Clone (#1695).

  • A generic function's match moves a move-only parameter whose argument folded to a constant — the arm's move was a false E0901 (#1694).

  • A dyn of a type variable no longer fails on a trait default with a parameter (#1699, D10 rider).

Toolchain for agents (CLI, LSP, test runner, diagnostics)

  • yo check --watch no longer reports a false E0612 at an inherent method's call sites after a re-check round (#1732).
  • for(...) is desugared at parse time into the loop the prelude macro expanded to; E0911's help names "the whole for loop" (#1727, macro plan B1).
  • yo fix --migrate mut-bindings decides generic(R) and self : &mut Self methods (entry/with) (#1719).
  • scripts/heavy-lock.sh works when sourced from zsh (#1721).
  • rc(x) / box(x) / arc(x) are deleted from the prelude: E0401 names Rc.new/Box.new/Arc.new, yo fix rewrites the token, and the LSP completion list no longer offers the deleted builtins (#1700; completes #1690's sweep).
  • yo fix --migrate mut-bindings now marks the bodies no evaluation reaches — a generic body past its trial's first untyped construct, a blanket impl's default, another target's cond arm (#1691).
  • tests/arc.test.yo joins the weekly leak-verdict allowlist (#1697).

Compile and codegen

  • A place lent into a reference field (V(l)(xs : &l)) is dropped at its own scope end; since #1720 it was never dropped and leaked unboundedly in a loop — a reference field store no longer records a dup (#1738, S1).
  • An unwind's consumed-variable drop no longer lands on a same-named inner local (a C type error for a value type, a silent double release when the types agree — it also happened inside the compiler) (#1740, S1).
  • A compile-time TypeInfo binding (info :: Type.get_info(T) in a runtime body) no longer ICEs with get_enum_variant_c_name: no C type name found for enum TypeInfo: its scope-end drop now lowers nothing (tests/type_reflection was red on develop since #1736) (#1744, S1).
  • A function whose loop body ends in an early return dropped none of its locals on any exit — the loop body's scope frame leaked onto the caller's environment (#1728, S1).
  • A tuple or array literal copying a field or indexed element ((s.buf, …), [xs(i)]) takes its reference — it was a double free (#1726, S1).
  • A cell-handle view Rc/Arc lowers through dyn's auto-box, dyn's clone and the weak-count header; compiler-side preparation for v0.2.75's std retype (#1725, V5 cells Generation A; one dead assert removed from RawMutex's cell dispose, no other C change).
  • A template string of two or more parts builds ONE String (push_str + the new overridable ToString.append_to); an interpolated String part appends by borrow — interpolation ×200k measured 0.46× instructions (#1699; D10).
  • A consuming match on a task slot reads the slot once before its test chain, so an aborted task no longer drops the payload its arm moved out (#1693, S1).
  • Four codegen bugs the B8 flip exposed: a &mut receiver through a captured ref handle is written in place, an FnOnce parameter's captures are released after the call, a match fused at two awaits gets fresh C labels (#1695, 3×S1 + the E0901 rule above).
  • A closure that consumes an FnOnce capture with consume(x) now releases it (#1697, S2).
  • A bare return; runs drops (#1684, S2); a capture-list _x entry moves once (#1683, S2).

Async runtime

  • An await result read by a while condition or by a field-reading match scrutinee is released — the await's owning temporary was never declared, so its drop was skipped (#1731, S1 leak).

  • A consuming match of a call result before an await no longer runs the payload's Drop twice — a finished fused await site's moved-out field is gated by a per-site live flag (#1729, S1).

  • Windows file times were off by exactly one hour inside a DST fall-back hour (and whenever TZ differed from the system zone): the stat path round-tripped through local time while SystemTime.now() is UTC — timestamps now come straight off the Win32 file times (S2; caught by the windows-11-arm CI leg) (#1716).

  • Every std/sync/std/thread shared type (Mutex, RwLock, Cond, Channel, ThreadPool, the Atomic* set, …) is now a value struct over one atomically counted cell — allocation placement goes through the cell's allocator argument instead of swapping the thread scope, and construction no longer saves/restores the allocator scope; AtomicXxx(v) constructions spell AtomicXxx.new(v) (#1707, V5 Gen A first half).

  • An io.async body's consumed capture runs its Drop exactly once (#1697).

  • A block's result lent to a call after an await no longer leaks (#1699, D10 rider).

Build system and verification

  • The bundled markdown-yo dependency moves to 0.0.25 (compiles under both the pre- and post-flip collections) (#1730), then to 0.0.26, whose Env takes the value HashMaps (#1737).
  • Package names are kebab-case: yo init validates kebab (E1506), the markdown-yo dependency spells markdown-yo (#1686).
  • yo build probes the default C compiler instead of assuming clang — clang-less machines fall back to cc/gcc/zig, and a machine with no C compiler gets a named error (#1701).
  • yo install --locked now verifies a cached dependency's content hash on every reuse and re-fetches on mismatch — a mutated store entry no longer silently changes what every project compiles as the locked content (S1; found via a sweep tool that wrote into the store, itself fixed) (#1710).

Compiler performance and memory

  • Token.value is Rc(String): +0.12% allocations, −0.26% RSS (#1687).
  • Generic-impl method lookup is cached per (receiver type, method name, impl epoch, visibility context) — the scan was ~58% of Rc.new evaluation cost; yo check src/main.yo measured −7.11% instructions, −380M malloc calls (−13.0%), −12.8% allocated bytes (#1702).
  • Regression, accepted during the VBD campaign: the memory-ratchet baselines were re-baselined after the ArrayList/String and HashMap/HashSet flips, because each former handle share is now a move or an explicit clone and each clone copies a buffer the share did not. yo check src/main.yo max RSS 1276488 → 1715360 kB (+34.4%); yo compile src/main.yo peak 3608080 → 4589556 kB (+27.2%); allocation calls 2449599225 → 6176004922 (+152.1%). Per-PR attribution across #1736–#1739 was not done; B10/B11/V2c are not separately measured; reclaiming it belongs to post-flip sharing work (plans/EVALUATOR_MEMORY_REDUCTION.md) (#1742).

Known open issues filed this cycle

  • issues/2026-10-30-a-match-on-a-raw-pointer-in-safe-code-reaches-the-c-compiler.md
  • issues/2026-10-30-an-escape-path-drop-names-a-later-local-that-a-same-named-pattern-binding-shadows-in-c.md
  • issues/2026-10-30-self-in-a-static-methods-signature-resolves-to-the-callers-impl-receiver-under-inference.md
  • issues/2026-10-30-std-io-helpers-unwrap-a-failed-malloc.md
  • issues/2026-10-31-a-borrowed-match-scrutinee-of-a-call-results-move-only-field-is-a-false-e0901.md
  • issues/2026-10-31-a-mut-marked-bare-field-in-a-record-destructure-binds-positionally.md
  • issues/2026-10-31-check-src-main-yo-fails-under-setarch-r-on-wsl2.md
  • issues/2026-11-01-a-sweep-tool-wrote-into-the-content-addressed-store.md
  • issues/2026-11-01-yo-fix-mut-bindings-misses-writes-through-iterator-and-closure-bodies.md
  • issues/2026-11-02-a-retyped-rc-surfaces-cell-handle-view-gaps.md
  • issues/2026-11-03-a-bare-first-argument-of-a-static-call-to-an-in-flight-impl-member-skips-e0914.md
  • issues/2026-11-03-a-copy-type-borrow-parameter-lent-a-temporary-is-emitted-as-a-pointer-its-body-reads-as-a-value.md
  • issues/2026-11-03-an-unwind-out-of-a-later-argument-leaks-an-earlier-moved-argument.md (S2)
  • issues/2026-11-03-option-unwrap-or-over-a-move-only-record-is-e0907.md
  • issues/2026-11-03-two-spellings-of-one-anonymous-record-type-emit-two-c-structs.md
  • issues/2026-11-04-a-move-in-the-right-operand-of-a-short-circuit-operator-leaks-when-the-operand-is-skipped.md (S2)

Native bundles (bootstrap seed chain)

The yo-v*-<os>-<arch>.tar.gz assets attached below are this commit's
self-hosted compiler, built by the PREVIOUS release's compiler — the
seed (bin/yo + std/ + vendor/mimalloc/ + .github/skills +
pack + LICENSE). The
TypeScript compiler that used to build them was retired in P2.5 and
is frozen at the src-attic-final tag. See
plans/archive/SELF_HOSTING_COMPLETION.md Phase 2 for the trust chain and
plans/archive/BOOTSTRAPPING.md for the campaign record.