Repository navigation
Release v0.2.74
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 := sover a liveString/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 spelledRc(RefCell(StringBuilder))(or another cell) explicitly; reading or mutating without taking ownership is spelled with a&/&mutborrow, and a binding that is mutated through ismut(x). xs.get(i)over a non-Copyelement is E0901 (it would copy the element out of the buffer). Usexs.get_cloned(i), read in place withxs(i), orxs.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 andYO_DEBUG_V2C_JUDGE_STD_GENERICare 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, requiresClone). BTreeMap.rangenow consumes the map (likekeys/values);.clone()first if the map is used again.StringBuildergainsinto_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 isentries().clone().Send/Syncof 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 theYO_AUDIT_IMPLICIT_COPY/YO_AUDIT_COPYING_ACCESSORlistings (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: runexplicit-copy, thencloned-accessors, thenrc-cloneon 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
TypeValuebound lists moved intoRc(RefCell(...))cells because their late writes must stay shared (#1736). The 614-sitegettoget_clonedsweep 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)withxs : &mut Tinto(&T, &mut T)is E0910, as the local spellingf(&xs, &mut xs)already was; the call was a heap use-after-free whenfgrew 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 xas the first argument of a static callT.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: anRc/Arcpayload andwhere(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
forloop through a cell is now checked across anawaitin its body (E0911) — the macro form had skipped it (#1727, S3). -
A function's parameter origins are carried, not checked: the
Originkind,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_refdeleted) (#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;Dyncalls map from the trait; aDynover a trait with a projection method no longer emits invalid C (#1711). -
A loan of the same
refcell as both&mutand&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 Tnow 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;&Tfields areCopy,&mut Tholders are move-only; reference fields lower asconst T*/T*(#1720; decision 43 step 3, N2b — the release's references scope is complete). -
Fn(...) -> &Tresult 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 takecomptime(p : Origin)and instances carry the call's origin, erased from type identity; new E0924, and E0909 now fires atexternsignatures 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 (areftype,Rc/Arc, a cell handle, aReferencefield, or the sibling's own borrow mode).grow_beside(&mut xs(0), ArrayList(String).new())— a value list that cannot aliasxs— was a false rejection once lists became values (#1739, S2). -
A downcast to a move-only type is E0901 unless the
DynlistsClone(#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
dynof 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 --watchno 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 wholeforloop" (#1727, macro plan B1).yo fix --migrate mut-bindingsdecidesgeneric(R)andself : &mut Selfmethods (entry/with) (#1719).scripts/heavy-lock.shworks when sourced from zsh (#1721).rc(x)/box(x)/arc(x)are deleted from the prelude: E0401 namesRc.new/Box.new/Arc.new,yo fixrewrites the token, and the LSP completion list no longer offers the deleted builtins (#1700; completes #1690's sweep).yo fix --migrate mut-bindingsnow 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.yojoins 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
TypeInfobinding (info :: Type.get_info(T)in a runtime body) no longer ICEs withget_enum_variant_c_name: no C type name found for enum TypeInfo: its scope-end drop now lowers nothing (tests/type_reflectionwas red on develop since #1736) (#1744, S1). - A function whose loop body ends in an early
returndropped 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/Arclowers throughdyn'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 fromRawMutex's cell dispose, no other C change). - A template string of two or more parts builds ONE
String(push_str+ the new overridableToString.append_to); an interpolatedStringpart 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
&mutreceiver through a captured ref handle is written in place, anFnOnceparameter'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
FnOncecapture withconsume(x)now releases it (#1697, S2). - A bare
return;runs drops (#1684, S2); a capture-list_xentry moves once (#1683, S2).
Async runtime
-
An
awaitresult read by awhilecondition or by a field-readingmatchscrutinee is released — the await's owning temporary was never declared, so its drop was skipped (#1731, S1 leak). -
A consuming
matchof a call result before anawaitno longer runs the payload'sDroptwice — 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
TZdiffered from the system zone): the stat path round-tripped through local time whileSystemTime.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/threadshared type (Mutex,RwLock,Cond,Channel,ThreadPool, theAtomic*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 spellAtomicXxx.new(v)(#1707, V5 Gen A first half). -
An
io.asyncbody's consumed capture runs itsDropexactly once (#1697). -
A block's result lent to a call after an
awaitno 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
Envtakes the valueHashMaps (#1737). - Package names are kebab-case:
yo initvalidates kebab (E1506), the markdown-yo dependency spellsmarkdown-yo(#1686). yo buildprobes 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 --lockednow 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.valueisRc(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.newevaluation cost;yo check src/main.yomeasured −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.yomax RSS 1276488 → 1715360 kB (+34.4%);yo compile src/main.yopeak 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.mdissues/2026-10-30-an-escape-path-drop-names-a-later-local-that-a-same-named-pattern-binding-shadows-in-c.mdissues/2026-10-30-self-in-a-static-methods-signature-resolves-to-the-callers-impl-receiver-under-inference.mdissues/2026-10-30-std-io-helpers-unwrap-a-failed-malloc.mdissues/2026-10-31-a-borrowed-match-scrutinee-of-a-call-results-move-only-field-is-a-false-e0901.mdissues/2026-10-31-a-mut-marked-bare-field-in-a-record-destructure-binds-positionally.mdissues/2026-10-31-check-src-main-yo-fails-under-setarch-r-on-wsl2.mdissues/2026-11-01-a-sweep-tool-wrote-into-the-content-addressed-store.mdissues/2026-11-01-yo-fix-mut-bindings-misses-writes-through-iterator-and-closure-bodies.mdissues/2026-11-02-a-retyped-rc-surfaces-cell-handle-view-gaps.mdissues/2026-11-03-a-bare-first-argument-of-a-static-call-to-an-in-flight-impl-member-skips-e0914.mdissues/2026-11-03-a-copy-type-borrow-parameter-lent-a-temporary-is-emitted-as-a-pointer-its-body-reads-as-a-value.mdissues/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.mdissues/2026-11-03-two-spellings-of-one-anonymous-record-type-emit-two-c-structs.mdissues/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.