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
let v = Vec.new(); v.push(StrView{ s: local }); return v compiles and the caller reads FREED memory (verified: prints stale contents). §5.2's virality rule — a container of ephemeral T is itself ephemeral ("If T is ephemeral … any generic F[T] is ephemeral") — is only enforced SYNTACTICALLY for ref-typed args (Vec[&str] via type_expr_is_collection_with_ref, SemaCheck.w:7395), not for named ephemeral structs and not through inference.
Spec
§5.1 (no heap storage of ephemerals), §5.2 (virality through generic args). type_is_ephemeral_value (SemaCheck.w:18710) already recurses through TY_GENERIC_INST args — enforcement should key off the SEMANTIC predicate at container-elem establishment (push/insert/collect inference), making the container binding ephemeral (locals fine, returns need §5.2 propagation, stores rejected).
Note
Sibling of #600 (heap-boxing constructors gated 2026-07-03). Repro from that investigation: scratchpad p600/p4c shape above.
Blocker discovered alongside
Explicit Vec[StrView]/Box[StrView] ANNOTATIONS misresolve the generic arg (push 'expects &str'; as_ref yields str) — an accidental type-arg erasure that any virality fix must not rely on; probably its own bug.
BDFL ruling (2026-07-04): heap containers of ephemeral element types are BANNED outright — §5.1 governs; §5.2 amended to propagate through value constructors only (Option/Result/tuple/ephemeral-marked structs). The idiom for batch references is indices/ranges into the owning collection (the compiler's own pool pattern). Rationale: one sema gate, safe by construction, zero runtime cost, no migrate/c_import impact; static virality is machinery whose every missed gate is a soundness hole (this bug WAS a missed gate); revisit only on demonstrated library need. Implementation: reject ephemeral element types at container-element establishment (type formation, push/insert, collect inference) with a loud error naming the idiom. The generic-arg misresolution noted as this issue's blocker is a separate substrate bug shared with #627 — investigate as one.
Fixed in ea2030d via viral-ESCAPE (not an annotation ban). The original repro (v.push(StrView{s: local}); return v) is now a compile error (returned ephemeral value may outlive its origin), including in tail position and through inference; Box.new(ephemeral) is caught by the #600 gate. Memory-safe batches of owned handles (the stdlib's Vec[Workspace]) and containers that borrow a parameter remain unrestricted — the model of Rust lifetimes / Vale regions. Ruling revised after reference review; full rationale in docs/decisions.md D2. §5.2 restored to full virality; fixpoint + full suite green.
Activity
Fix #600: ephemeral values can no longer escape into heap-owning ctors
ehartford commentedon Jul 4, 2026
BDFL ruling (2026-07-04): heap containers of ephemeral element types are BANNED outright — §5.1 governs; §5.2 amended to propagate through value constructors only (Option/Result/tuple/ephemeral-marked structs). The idiom for batch references is indices/ranges into the owning collection (the compiler's own pool pattern). Rationale: one sema gate, safe by construction, zero runtime cost, no migrate/c_import impact; static virality is machinery whose every missed gate is a soundness hole (this bug WAS a missed gate); revisit only on demonstrated library need. Implementation: reject ephemeral element types at container-element establishment (type formation, push/insert, collect inference) with a loud error naming the idiom. The generic-arg misresolution noted as this issue's blocker is a separate substrate bug shared with #627 — investigate as one.
docs: record BDFL soundness-tier rulings (2026-07-04)
ehartford commentedon Jul 5, 2026
Fixed in ea2030d via viral-ESCAPE (not an annotation ban). The original repro (
v.push(StrView{s: local}); return v) is now a compile error (returned ephemeral value may outlive its origin), including in tail position and through inference;Box.new(ephemeral)is caught by the #600 gate. Memory-safe batches of owned handles (the stdlib'sVec[Workspace]) and containers that borrow a parameter remain unrestricted — the model of Rust lifetimes / Vale regions. Ruling revised after reference review; full rationale in docs/decisions.md D2. §5.2 restored to full virality; fixpoint + full suite green.Fix #625: containers of ephemerals use viral-ESCAPE, not an annotatio…
Make friendly aliases (Int/UInt/String/StrView/CStr) user-shadowable (#…
Closures: every capture is found, a stored view is refused, a call th…
Views: a store records origins only when the stored value can hold a …
Sema: a tuple literal holding an ephemeral value is ephemeral — Box.n…
Views: a store into a place is a store into its root's storage, and a…
Views: a store records origins only when the stored value can hold a …
Modeled-C Amendment 2 (D76): callback argv/user data without unsafe (#…
Closures and views: callable parameters are views; stores into a rece…