Repository navigation
Description
File
src/jsc/event_loop.zig:3,113,716 + src/jsc/Task.zig:4 (union member closure) — observed while fixing #54 on zig-legacy (2c445f0454).
Pattern
dependency-loop — demanding bun.jsc.EventLoop.Task (or bun.MiniEventLoop, or anything pulling the EventLoop struct together with the Task union) fails with:
src/jsc/event_loop.zig:716:5: error: dependency loop detected
pub const Task = @import("./Task.zig").Task;
Shape of the cycle: EventLoop.tasks: Queue (event_loop.zig:3) → Queue = LinearFifo(Task) (:113) → Task union (Task.zig:4, ~100 members) → a member chain leading back into jsc.EventLoop. The main binary never trips it (it only touches EventLoop through pointers/dynamic dispatch, never demanding the struct fields and the full union together).
Upstream relevance
not found— needs re-check againstoven-sh/bunmain (Rust-rewrite era).
Repro
On branch claude/fix-zig-build-test-54 (PR #57, after zig build test itself is fixed), add to the test {} block in src/unit_test.zig:
_ = @import("bun").jsc.EventLoop.Task;then run vendor/zig/zig build test. Bisected: Braces + myers_diff demands are green; any Task/MiniEventLoop demand loops, via both the jsc.EventLoop.* path and a direct bun.zig re-export path.
Suggested next step
Type-layering work in src/jsc/: break the by-value edge between the EventLoop struct and the Task union member closure (e.g. box the back-edge field or reroute the member import so the union can complete with event_loop.zig off-stack). Until then, MiniEventLoop unit tests stay out of the zig build test harness (see src/unit_test.zig comment) and are covered by bun bd test JS-level suites.
Harvest metadata
commit: 2c445f0454pattern: dependency-loopgenerated-by: manual (found while fixing #54)
Activity