Repository navigation
Conversation
…owed<R>` renders as `BorrowedR[Origin] ephemeral { origin: &Origin, repr }`, the origin type bound at each call by what the constructing method hands it (self, a parameter, a parent view), so a Node borrowed from a Doc and one from an owned Node are one type; a borrow-returning lend's result type is inferred from its tail so the one text serves the resource's impl and its view's, and the view's impl now carries those lends (a borrow through a borrow views that borrow, D122). Sema no longer refuses two items borrowing R from different resources. User code naming the type spells its origin (`BorrowedDatabase[Statement]`). Test behav_c_facade_borrow_per_value_origin over c_facade_tree.h: root from the document, child from an owned node.
…ll, so the draft states every proven borrow of a representation whatever its origins; the "several origin types" withholding and its report lines go. The selfhost program calls the presented names (Doc.open, Node.new, n.attr, d.root, d.count).
…. A facade declares `text utf8` once and every `text return, owned, freed by F` presents as Option[str]: the bytes are validated at the boundary (CStr.to_str) and copied, F runs on the pointer, and a return that is not UTF-8 panics naming the C function and the byte, nothing repaired; `text return bytes` keeps an item at Option[List[u8]]. `detaches param N` renders as a move method of the borrowed view yielding `DetachedR[Origin]`: owned (its Drop runs the resource's drop operation), carrying the resource's lends, and holding a view of the origin it was taken out of, so it is destroyed before the origin and cannot escape it; the call goes through the view and invalidates the origin's views by the default. Sema accepts both clauses (a detached parameter is a pointer one resource receives). The pin of the old one-origin rule (err_c_facade_borrowed_return_two_origins) goes; two expectation lines follow the new item list and the generic borrowed type. Tests: behav_d134_text_utf8, behav_d134_text_utf8_violation_panics, behav_c_facade_detaches (nd_unlink in c_facade_tree.h).
…acts for them — the call effect that invalidates the origin's views, the view-of-param summary of a borrow taken through the view — are kept by the method's effective name and replayed on each instantiation (facade_note_generic / facade_replay_generic, hooked in check_generic_method_body_concrete); a generic method has no signature until a call instantiates it, and every lookup by `BorrowedR.m` found nothing, so an operation through a view touched nothing (err_c_facade_parent_borrow_invalidates_parent_views stopped failing). Two more generic-instance facts: `BorrowedR[Origin]` names its origin as a type argument and holds a view, not the resource (facade_type_holds_resource); a borrow taken through a view views the view's origin, never the view (a view of a view nested the origin type once per call and instantiation never ended). The renderer spells the origin type on every borrow-returning lend so Sema reads the declared result, and publicizes methods of a generic impl. WITH_DEBUG_FACADE_POISON=1 prints what each modeled-C call could invalidate and which guard kept a binding; both new flags are in deep-debugging-tools.md. The tree fixtures state `preserves param 0` on their reads, as §16.2b.7 asks.
|
Fourth commit, 43ff354: the first battery was red on two invalidation pins (err_1977_borrowed_resource_after_step, err_c_facade_parent_borrow_invalidates_parent_views). Root cause: a borrowed view's methods are now methods of a generic impl, which have no signature until instantiation, so every facade lookup by |
|
Battery on 43ff354 under the pinned seed: GREEN, wall 288 s ( |
…ded go (D111: a str is a value, a push copies it; a consuming List parameter never needs a call-site `move`). Main's ceremony census was red after #2361 merged under #2422: clone-call in src 537 -> 543, move-arg 847 -> 854; this brings both under the bar. (#2423) Co-authored-by: Eric Hartford <[email protected]>
Conformance to D134 (spec v7.34, #2421), three commits:
Borrowed<R>renders asBorrowedR[Origin], the origin bound at each call; the borrowed view's impl carries the borrow-returning lends (a borrow through a borrow views that borrow, D122); Sema no longer refuses two items borrowing R from different resources. User code naming the type spells its origin (BorrowedDatabase[Statement]); the old one-origin error pin is removed.text utf8at the facade level: text returns present asOption[str], validated at the boundary withCStr.to_str; a violation panics naming the C function and the byte;text return byteskeeps an item at bytes.detaches param N: a move method of the borrowed view yieldingDetachedR[Origin], owned (Drop runs the resource's drop), carrying the lends, holding a view of its origin.with migrate --facadenow drafts every proven borrow; the selfhost program uses the presented names.Tests: behav_c_facade_borrow_per_value_origin, behav_c_facade_detaches, behav_d134_text_utf8, behav_d134_text_utf8_violation_panics; every facade behavior and compile-error test green under stage1 except pending_producer_warns, which asserts no warnings and fails only under stage1's two std warnings. Gate green;
:c-migrator-basic-testsgreen with the release binary (the #2420 gate log never ran that target). Battery: pending.