Owned RawBuf threaded through a loop binder passes check but panics codegen unknown variable #47
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
loopbinder holding an ownedRawBufvalue threaded throughrecurpassesail checkbut fails atail buildwithunknown variable. A plainIntloop binder of the same name buildsand runs fine, so the fault is specific to an owned
RawBufvalue ina loop binder. This breaks check↔codegen agreement: a program that
passes
checkmust be one codegen can lower.Reproduction (verified)
Minimal shape:
The owned-RawBuf loop binder
bis not registered in the codegenscope.
Impact
Filling a buffer whose length is not a fixed number of literal
indices is the natural way to use
RawBuffor runtime-sized data;that path does not build today. Together with the borrow-receiver
reject (#46), the only RawBuf programs that build are straight-line
owned
let-threading with literal indices.Related papercut (not this bug): a
loopbinder rejects anownmode annotation (
own may only appear inside fn-type params or ret),so there is currently no annotated way to thread an owned RawBuf
through a loop either.
Surfaced by the raw-buf fieldtest (finding B2), spec
docs/specs/0058-fieldtest-raw-buf.md. Commit8e9f0f0.Acceptance
unknown variable