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
Diagnostics: coerced-borrow ephemeral return rejected with wrong message (soundness hole verified closed; pin with fixtures) #626
fn f() -> StrView: let owned = ...; return StrView { s: owned } — returning an ephemeral whose &str field borrows an OWNED LOCAL — passes check; the caller dangles. collect_expr_view_deps (SemaCheck.w:7640-7652) records deps only for TY_REF-typed idents and explicit & borrows; the owned-str → &str field coercion produces no dep, so check_returned_ephemeral_value_origins sees zero origins.
Spec
§5.2 ephemerality propagation / §21.1 Rule 6-adjacent: a view's origin set must include owned locals feeding coerced borrows; a returned view whose origin is a dying local is rejected.
Found
During the #600 blast-radius sweep (probe p7), 2026-07-03.
BDFL ruling (2026-07-04): downgraded soundness → diagnostics. Verified on HEAD: the explicit-borrow escape gets the correct 'returned ephemeral value may outlive its origin' error, and the coerced form is rejected (with a wrong 'return type mismatch' message). Remaining work: record view deps for the owned→&str field coercion so the RIGHT error fires, and pin every escape shape with compile-error fixtures so the closure can't silently regress.
changed the title [-]Returned ephemeral wrapping a borrow of an OWNED local escapes view-dep tracking (dangling read)[/-][+]Diagnostics: coerced-borrow ephemeral return rejected with wrong message (soundness hole verified closed; pin with fixtures)[/+]on Jul 4, 2026
Fixed in 5289264. An owned local coerced into a reference field now records a borrow origin on the struct literal, so a returned/stored view over a dying local is rejected (was a silent soundness hole: check passed, caller dangled). Params and static literals stay legal. Fixpoint + full suite green; 3 fixtures pin the escape shapes.
Activity
Fix #600: ephemeral values can no longer escape into heap-owning ctors
ehartford commentedon Jul 4, 2026
BDFL ruling (2026-07-04): downgraded soundness → diagnostics. Verified on HEAD: the explicit-borrow escape gets the correct 'returned ephemeral value may outlive its origin' error, and the coerced form is rejected (with a wrong 'return type mismatch' message). Remaining work: record view deps for the owned→&str field coercion so the RIGHT error fires, and pin every escape shape with compile-error fixtures so the closure can't silently regress.
[-]Returned ephemeral wrapping a borrow of an OWNED local escapes view-dep tracking (dangling read)[/-][+]Diagnostics: coerced-borrow ephemeral return rejected with wrong message (soundness hole verified closed; pin with fixtures)[/+]docs: record BDFL soundness-tier rulings (2026-07-04)
Make friendly aliases (Int/UInt/String/StrView/CStr) user-shadowable (#…
ehartford commentedon Jul 5, 2026
Fixed in 5289264. An owned local coerced into a reference field now records a borrow origin on the struct literal, so a returned/stored view over a dying local is rejected (was a silent soundness hole: check passed, caller dangled). Params and static literals stay legal. Fixpoint + full suite green; 3 fixtures pin the escape shapes.
Fix #626: coerced owned->&T field records a borrow origin (escape now…
D32: implement STRICT field moves — site-local check, tree migration,…