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
D69: g.pull() — fiber-backed Iter[T] over a generator #1725
g.pull() returns an owned Iter[T] that runs the generator on its own fiber (§14.18) and resumes it at each next(); dropping the pulled iterator early stops the generator exactly as a consumer's break does. pull() is unavailable in no_runtime builds, and a generator that yields views of its own locals or whose body may suspend cannot be pulled (a compile error naming the yield or the suspension point).
The D69 push lowering (branch gen-push-impl) does not implement it: the runtime has no symmetric caller-driven fiber handoff (resume the producer fiber at next(), park it at each yield, and unwind it on drop), and Sema has no pull-eligibility check yet. Until this lands, g.pull() on a generator value is a compile error citing this issue.
Repro:
gen fn upto(n: i32) -> i32:
for i in 0..n: yield i
fn main:
var steps = upto(3).pull()
print(steps.next().unwrap())
Expected: prints 0. Actual: compile error "g.pull() ... is not implemented yet (#this)".
Also needed for: zip/peekable over generators (they take Iter[T]).
Activity
D69: generators lower as calls — a gen fn calls the consumer's loop b…
D69 tests: push generators — loops in generators, stops, views, pipel…
D69: generators lower as calls — a gen fn calls the consumer's loop b…
D69 tests: push generators — loops in generators, stops, views, pipel…
rt: caller-driven coroutines on pooled fiber stacks (§13.4 g.pull(), #…
Sema: the view-escape judgment is a query; check_view_escape_origins …
D69: g.pull() — a generator stepped by next() on its own fiber (§13.4, …
Sema: a comprehension clause over a suspending generator records its …
D69: generators lower as calls — a gen fn calls the consumer's loop b…
D69 tests: push generators — loops in generators, stops, views, pipel…
rt: caller-driven coroutines on pooled fiber stacks (§13.4 g.pull(), #…
Sema: the view-escape judgment is a query; check_view_escape_origins …
D69: g.pull() — a generator stepped by next() on its own fiber (§13.4, …
Sema: a comprehension clause over a suspending generator records its …
D69: generators lower as calls — a gen fn calls the consumer's loop b…
8 remaining items
Sema: the view-escape judgment is a query; check_view_escape_origins …
D69: g.pull() — a generator stepped by next() on its own fiber (§13.4, …
Sema: a comprehension clause over a suspending generator records its …
D69: generators lower as calls — a gen fn calls the consumer's loop b…
D69 tests: push generators — loops in generators, stops, views, pipel…
rt: caller-driven coroutines on pooled fiber stacks (§13.4 g.pull(), #…
Sema: the view-escape judgment is a query; check_view_escape_origins …
D69: g.pull() — a generator stepped by next() on its own fiber (§13.4, …
Sema: a comprehension clause over a suspending generator records its …
emit-c: the fixed block declares five fiber entry points, not every w…
D69: generators lower as calls — push generators, std.generators pipe…
D69: g.pull() — a generator stepped by next() on its own fiber (#1748)
validate-ownership: a copy of a local the body drops, passed to a par…
Ownership: D72 liveness byte, D73 assignment-as-read, validator leak/…