✓
Passing Passing: the compiler rejects this program as expected.
Code
// std/rings — a ring slot holds plain values by copy. A borrowed
// element (`*T`) has no slot shape this rung; the declaration refuses.
import std/proto
import std/rings
std/proto(Reading) {
id: u64
}
std/rings:new(q, capacity: 4) { value: *Reading }
Actual compiler output
error[KORU161]: std/rings:new(q): a ring carries plain values — '*Reading' is a borrow, array, or phantom-typed element, and none of those have a slot shape this rung
--> tests/regression/300_ADVANCED_FEATURES/320_STDLIB/320_109_rings_borrow_element/input.k:10:0Compiler must reject:
Compilation must fail with a diagnostic.
Flows
flow ~std/proto click a branch to expand · @labels scroll to their anchor
std/proto (Reading, source: id: u64)
flow ~new click a branch to expand · @labels scroll to their anchor
new (q, capacity: 4, source: value: *Reading)
Test Configuration
MUST_ERROR