Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

weird compilation issue #3

Open
matu3ba opened this issue Jan 31, 2023 · 2 comments
Open

weird compilation issue #3

matu3ba opened this issue Jan 31, 2023 · 2 comments

Comments

@matu3ba
Copy link

matu3ba commented Jan 31, 2023

cd zig/zag
zig test -freference-trace --test-filter fubar arenas.zig

output

arenas.zig:69:26: error: struct 'arenas.Arena' depends on itself
pub const Arena = extern struct {
                  ~~~~~~~^~~~~~
referenced by:
    NurseryArena(509): arenas.zig:121:33
    NurseryArena: arenas.zig:116:19
    nurseryType: thread.zig:22:31
    Thread: thread.zig:18:15
    Self: thread.zig:21:18
    thread_size: thread.zig:23:48
    threadAvail: thread.zig:24:43
    nursery_size: thread.zig:25:31

fails repeatedly for me on linux-x86_64-gnu. Not only spuriously.

Related: #14353 ziglang/zig#14147 ziglang/zig#12325 ziglang/zig#8050

@matu3ba
Copy link
Author

matu3ba commented Feb 8, 2023

At least from my point of view Sema log is very incomplete and gives no further hint, so it looks like debugging would be needed: https://gist.github.com/matu3ba/e0e4817c494dfff1b7dd3ef9a1f241e4

@dvmason
Copy link
Owner

dvmason commented Feb 11, 2023

I realized something today: it works if you zig test thread.zig but gives the recursive type error if you try anything else that loads arena.zig, so I think it's the loading of thread.zig that creates the problem, so if it's the first thing loaded, everything is cool, but if it's indirectly loaded, you get the "depends on itself" loop bug. You can see this by testing almost anything else (because almost everything eventually @imports thread and arena

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants