You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
validate-ownership: generator next body drops a local on a resume path that never initialized it #1412
Found while sweeping --validate-all for #1394 (origin/main dd786a4 + the #1394 validator commit, which does not change this check).
examples/nebula/src/main.w ownership MIR: fn sym1193 stmt17 span=0: drop of _9 reaches a path that never initialized it (Uninit)
examples/nebula/src/session.w ownership MIR: fn sym1133 stmt17 span=0: drop of _9 reaches a path that never initialized it (Uninit)
sym1193 is __with_generator_next_884. Its entry switches on __with_generator_resume to bb1 (fresh start) or bb11 (resume after a yield); _9 (a str call result inside the loop body) is initialized only on the fresh path, and the resume path reaches its drop. Either the generator state machine must carry _9 across the yield (it is live) or the resume path must not drop it. Check at runtime with run --debug-alloc on a generator whose yielded expression builds a str.
It is wrong code at run time, not only a validator verdict. Stage2 of main f1e3bd2 (and the installed v0.15.2.1):
type Telemetry { device_id: str, temp: f64 }
gen fn extract_packets(count: i32) -> Telemetry:
for i in 0..count:
yield Telemetry {
device_id: f"dev-{i}",
temp: 20.0 + (i as f64) * 0.5,
}
fn main:
var n = 0
for p in extract_packets(3):
n = n + p.device_id.len() as i32
print(f"{n}")
Expected 15; every compiler prints panic: integer overflow: i32 addition out of range — the consumer reads a garbage len(). check --validate-all: fn sym993 stmt16 span=0: drop of _9 reaches a path that never initialized it (Uninit).
(Found again while sweeping for #1411: nebula's two files failed earlier at #1411's "terminator place has no concrete MIR type", which masked this.)
Activity
ehartford commentedon Sep 23, 2026
It is wrong code at run time, not only a validator verdict. Stage2 of main f1e3bd2 (and the installed v0.15.2.1):
Expected
15; every compiler printspanic: integer overflow: i32 addition out of range— the consumer reads a garbagelen().check --validate-all:fn sym993 stmt16 span=0: drop of _9 reaches a path that never initialized it (Uninit).(Found again while sweeping for #1411: nebula's two files failed earlier at #1411's "terminator place has no concrete MIR type", which masked this.)
MIR: a scope's cleanup calls yield their status into an i32 temp; val…
MIR: a scope's cleanup calls yield their status into an i32 temp; val…
MIR: a yield drops its statement temporaries before suspending; the n…
MIR: a yield drops its statement temporaries before suspending; the n…
validate-ownership: a drop of a place moved out and not yet reset is …
Ownership: D72 liveness byte, D73 assignment-as-read, validator leak/…