Skip to content

spec §12.4 / D63: one callable type — fn(A) -> R carries compiler-tracked environment ownership; not Copy (#1567) - #1595

Merged
ehartford merged 1 commit into
mainfrom
spec-callable-type-d63
Sep 24, 2026
Merged

ehartford merged 1 commit into
mainfrom
spec-callable-type-d63

Conversation

@ehartford

Copy link
Copy Markdown
Contributor

Eric's ruling (A) on the closure-type brief (2026-09-23), landed as §12.4 "The callable type" and decisions.md D63.

  • One type fn(A) -> R for functions, non-move closures and move || closures; the compiler tracks which, as it tracks may_suspend.
  • Not Copy, bare functions included; .clone() free for bare/view, needs every capture Clone for owned; calls through a binding/field don't move; use-after-move fix-its.
  • Call-once crosses a signature: proven from the body in one compilation; rejected across a bundle until a deferred once annotation.
  • Views flow like &T parameters (Rule 8) — closes §13.1's erasure hole.
  • Performance commitment: specialize when a closure literal reaches a parameter in one compilation; only captureless closures coerce to extern "C".
  • Checked: the §11/§13 callback examples (f: fn(StrView)) conform; no spec example holds a callable in a struct field.

Compiler NON-COMPLIANT until the #1567 layer on stack #1585 lands. Docs-only: :spec-inventory-check green.

…cked environment ownership; not Copy; call-once, view-flow and specialization rules (#1567)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant