Repository navigation
spec: six rulings of 2026-09-22 (destructor boundary, facade destroyers, Sender Clone, print over Display, examples policy) — D55 - #1277
Conversation
…e's boundary (§2.5.1, §9.7), facade destroyers (§16.2b.3), Sender is Clone (§14.15), print over Display (§18.2); examples track the spec (D55) Eric's rulings on the open questions from stage 4a, #1272 and the examples survey (#1150), drafted as spec sentences for his blessing of the words; decisions.md D55 records each ruling and its reasoning, including Higher RAII for resources as a named future ruling. CLAUDE.md/AGENTS.md carry the examples policy: a spec change that breaks an example updates the example in the same change; a compiler or stdlib change that does is a defect.
…e last sender's drop (D55 §14.15) (#1283) * rt: with_channel_retain_sender — one more sender holds the channel open Sender.clone() (D55 ruling 5, spec §14.15) needs the runtime refcount to go up as well as down. The release path already closes the channel only when the sender count reaches zero, so with a retain seam the channel closes on the LAST sender's drop, never the first. * std.channel: Sender[T] is Clone, never Copy; the channel closes on the last sender's drop D55 ruling 5 / spec §14.15 (PR #1277): a shared producer is spelled tx.clone(); every clone retains the runtime sender count and holds the channel open; the channel closes when the last sender drops. Sender[T]: Send iff T: Send was already the rule (SemaCheck type_generic_inst_satisfies_thread_trait) and now has a test at the clone-into-fiber boundary. Tests: close-on-last across three fiber producers (original + two clones); a clone outliving the original keeps sends landing on the main thread; Sender[Rc[i32]].clone() into a worker is rejected. Both behavior tests run clean under --debug-alloc (leak count=0). --------- Co-authored-by: Eric Hartford <[email protected]>
|
One-word correction proposed for the §18.2 bullet, from implementing ruling 6: |
…kes &T (§3.8); v: T consumed owned strings and refused globals (D52) (#1326) Implementing D55 ruling 6 (PR #1325) showed the literal v: T consumes its argument: print(s); print(s) on an owned str is a use-after-move and print(GLOBAL) is a move out of a global. §3.8 says an observing function takes &T; the &str instance is byte-identical to the previous print. One word, proposed on #1277 and implemented in #1325; Eric's blessing is the merge. Co-authored-by: Eric Hartford <[email protected]>
Drafted spec words for the six rulings (your blessing of the exact words = merge; edit in place where the register is off):
Drop— error outside the type's ownmove fns with fix-itslet t = r/r.field; inside them the destructure is the disarm and must be total (partialR { fd, .. }errors naming the unstated fields); one rule forlet/match/if let.destroyswithoutdropis a compile error (name the unary destroyer asdrop);void *destroyer accepts object-pointer representations only (no function pointers, no by-value).Sender[T]isClone, neverCopy; the channel closes when the last sender drops;Sender[T]: SendrequiresT: Send.print[T: Display](v: T); a mixed-arm match yields nothing joinable; fix-it isprint(f"{x}").Docs-only:
spec-inventory-checkgreen. Implementation is non-compliant until the follow-ups land: facadevoid */drop(in progress), #1272 Sema rule (in progress),SenderClone,printgeneric, examples update + CI lane (queued).