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
Deferred: a once parameter annotation so a consuming closure can cross a bundle boundary (D63 §12.4 call-once) #1604
D63 (§12.4 "The callable type"): "A consuming closure may only be handed to a callee that invokes it at most once. Within one compilation the compiler proves this from the callee's body. Across a bundle boundary (§3.4) a parameter may be invoked any number of times, so a consuming closure passed across a bundle is rejected until a once parameter annotation exists (deferred)."
Stack #1585's D63 layer implements the proof from the body (sig_param_invoke_many: a parameter invoked twice, or once inside a loop) and rejects a consuming closure argument to a callee whose declaration is a bundle interface (no body in this compilation) with:
error: this closure consumes its capture and may be invoked once, but `f` has no body in this compilation (a bundle boundary), so it may invoke its parameter any number of times (§12.4; a `once` parameter annotation is #1604)
Needed: the annotation's spelling (e.g. f: once fn() -> T), its place in the bundle interface (.wi) so the caller's compilation sees it, and the check that the bundle's own body honors it (invokes at most once). Same cross-bundle shape as -> &T in §3.4.
Activity
Closures: a move closure owns its environment (inline when every capt…
Closures: a move closure owns its environment; fn(A) -> R is not Copy…
Spec v7.7 (D75): once parameters, fills, distinct casts, payload disc…
Sema: the D63 call-once proof — a closure's creation moves nothing, f…
Parser/Sema/bundle interface: `f: once fn(A) -> R` — a consuming clos…