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
emit-c: closures are unsupported ("unsupported const kind 7"), so no generator program — push or pulled — goes through the C backend #1766
Spec: §13.4 (D69: generators lower as calls; a for over a generator passes its body as a closure), §12.4 closures. Found on gen-push-pull (#1725) while checking the C backend's coroutine prototypes; the push form reproduces on the gen-push-impl base.
Repro (with build r0.w --emit-c -o r0.c):
gen fn nums(n: i32) -> i32:
for i in 0..n:
yield i * 7
fn main:
for v in nums(3):
print(v)
Expected: C output that compiles and prints 0, 7, 14. Actual:
Const kind 7 is ConstKind.CK_CLOSURE: CCodegen has no lowering for a closure constant, so any closure — including the loop-body closure D69 introduces for every for over a generator, and std.task's gen_pull — fails emit-c loudly. (A program with a collection literal fails earlier: "emit-c does not support generic intrinsic __collection_literal".)
Activity
emit-c: closure and generator fixtures for the C backend (#1766), red…
emit-c: lower closures as the LLVM backend's {fn, ctx} pair (#1766)
emit-c-smoke: link the fiber runtime when the emitted C references it (…
emit-c: name the source site of a closure or async block it cannot lo…
emit-c: closure and generator fixtures for the C backend (#1766), red…
emit-c: lower closures as the LLVM backend's {fn, ctx} pair (#1766)
emit-c-smoke: link the fiber runtime when the emitted C references it (…
emit-c: name the source site of a closure or async block it cannot lo…
emit-c lowers closures: env struct + static fn + the LLVM backend's {…
emit-c resolves a specialization body's type parameters through Sema'…
emit-c resolves a specialization body's type parameters through Sema'…
D70 namespaced types reachable when shadowed (#1757); generator stage…
D65: methods and trait impls of same-named types are their declaratio…