Reject-free borrow (RawBuf a) receiver: a single get/size is misclassified consume-while-borrowed #46
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
A function whose parameter is
borrow (RawBuf a)and which callsRawBuf.getorRawBuf.sizeon that parameter even once is rejectedat
ail checkwithconsume-while-borrowed. Both ops areborrow-receiver ops perdesign/models/0007-kernel-extensions.md(§RawBuf) and
docs/specs/0054-raw-buf.md, so borrowing the receiverto read it is exactly the advertised use. The diagnostic also names
the wrong cause: the receiver is read, not consumed.
Reproduction (verified)
→
error: [consume-while-borrowed] read_one: \buf` is consumed while a borrow of it is still live`Same with
RawBuf.size. An inline ownedlet-bound buffer readsfine (the shipped raw-buf fixtures); the misclassification appears
only when the buffer is behind a
borrow-mode parameter. Fullworked fixture:
examples/fieldtest/rawbuf_1_score_table.ail.Impact
The
borrowsignatures the ledger advertises forget/sizeareunreachable from the natural decomposition — a helper function over a
shared read-only buffer. This blocks the
seriesmilestone, theraw-buf milestone's stated downstream consumer:
Series.at/Series.total_countread through aborrow (Series a)and would hitthe same path.
Surfaced by the raw-buf fieldtest (finding B1), spec
docs/specs/0058-fieldtest-raw-buf.md. Commit8e9f0f0.Acceptance
borrow (RawBuf Int)helper doing oneRawBuf.getchecksok