I recently came across a piece of code in a Ziggit.dev post that gave me pause:
pub fn putOne(q: *@This(), io: Io, item: Elem) Cancelable!void { assert(try q.put(io, &.{item}, 1) == 1); } pub fn getOne(q: *@This(), io: Io) Cancelable!Elem { var buf: [1]Elem = undefined; assert(try q.get(io, &buf, 1) == 1); return buf[0]; } …which led me to ask the following:
Just a quick side quest: Doesn’t the assert here risk put and get calls being optimized away?