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
checker accepts returned view of a consuming (plain-T) parameter — dangling view, runtime SEGV #718
Repro (was test/behavior/behav_coerced_borrow_param_ok.w before its migration to &str):
type View ephemeral { s: &str }
fn f(src: str) -> View:
View { s: src }
fn main:
let s = "hi"
let v = f(s)
print(v.s ++ "!")
Compiles clean; the binary exits 139. Post-D5 (§3.8) a plain str parameter CONSUMES: src is dropped when f returns, so View { s: src } returns a view of a dying place. The escape checker misses it because view_origin_is_stack_local (src/SemaCheck.w:9263) returns 0 for every parameter — pre-D5 logic from when a read-only plain param was a borrow. A parameter is a non-dying origin only when its declared mode is &T (or another non-consuming mode); a consuming param is a dying local for view-origin purposes.
Expected: error: returned view may outlive its origin 'src' (same diagnostic the checker already emits for locals).
Note: the enforcement-side twin of the #714 family (declared mode is authoritative both for what callers must write and for what escapes).
Fixed: view_origin_is_stack_local now consults the DECLARED mode instead of exempting every parameter (the pre-D5 hole). A &T param and a fn/mut fn receiver borrow a caller place — non-dying origins, unchanged. A plain consuming T param and a move fn receiver die when the callee returns, so an escaping view of them is rejected with the same 'returned view may outlive its origin' diagnostic locals get. The repro errors at the View construction; move fn take_view() -> &str: &self.s errors too; the compiler self-checks clean under the stricter rule.
Note for the record: behav_byvalue_view_escape_tail/nested pinned the RETIRED share-place reading of this exact shape ('by-value param is the caller's place; escaping views valid') and passed only by physical accident of the indirect ABI. Per the D5 supersession (declared signature authoritative; a plain consuming T is owned even when its ABI is indirect) both moved to compile_errors as negative fixtures. Full :test green, evidence recorded.
Activity
analyze: seam-sites — inventory ownership seams before they detonate
handoff: record the Stage 6 batch — 19 roots, evidence, and open rulings
D27 E1+E2 fallout drain: distinct Copy, generic-literal field demands…
ehartford commentedon Sep 1, 2026
Fixed: view_origin_is_stack_local now consults the DECLARED mode instead of exempting every parameter (the pre-D5 hole). A
&Tparam and a fn/mut fn receiver borrow a caller place — non-dying origins, unchanged. A plain consumingTparam and amove fnreceiver die when the callee returns, so an escaping view of them is rejected with the same 'returned view may outlive its origin' diagnostic locals get. The repro errors at the View construction;move fn take_view() -> &str: &self.serrors too; the compiler self-checks clean under the stricter rule.Note for the record: behav_byvalue_view_escape_tail/nested pinned the RETIRED share-place reading of this exact shape ('by-value param is the caller's place; escaping views valid') and passed only by physical accident of the indirect ABI. Per the D5 supersession (declared signature authoritative; a plain consuming T is owned even when its ABI is indirect) both moved to compile_errors as negative fixtures. Full :test green, evidence recorded.
sema: a consuming parameter is a dying view origin (#718)
test: consuming-param view escapes are negative fixtures (#718)
sema: raw-mut of a mut-receiver field does not seed ESCAPE_VALUE (#919 …
test: the D acceptance corpus runs as the std fallback tier will reso…
test: the D acceptance corpus runs as the std fallback tier will reso…
test: the D acceptance corpus runs as the std fallback tier will reso…
Build store, runner, corpora, deps discovery, generic-instance identi…