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

root struct of file 'S' has no member named 'foo' error missing note with link to file #17074

Closed
nektro opened this issue Sep 5, 2023 · 2 comments
Labels
error message This issue points out an error message that is unhelpful and should be improved.
Milestone

Comments

@nektro
Copy link
Contributor

nektro commented Sep 5, 2023

Zig Version

0.11.0

Steps to Reproduce and Observed Behavior

pub fn main() void {
    _ = S.foo;
}

const S = @import("S.zig");
  • S.zig exists but is empty
test2.zig:2:10: error: root struct of file 'S' has no member named 'foo'
    _ = S.foo;
        ~^~~~
referenced by:
    callMain: /home/meghan/.local/share/zig/lib/std/start.zig:564:17
    initEventLoopAndCallMain: /home/meghan/.local/share/zig/lib/std/start.zig:508:34
    callMainWithArgs: /home/meghan/.local/share/zig/lib/std/start.zig:458:12
    posixCallMainAndExit: /home/meghan/.local/share/zig/lib/std/start.zig:414:39
    _start: /home/meghan/.local/share/zig/lib/std/start.zig:327:40

Expected Behavior

an extra note struct defined here note pointing to S.zig:1:1:

@nektro nektro added the bug Observed behavior contradicts documented or intended behavior label Sep 5, 2023
@Vexu Vexu added error message This issue points out an error message that is unhelpful and should be improved. and removed bug Observed behavior contradicts documented or intended behavior labels Sep 7, 2023
@Vexu Vexu added this to the 0.13.0 milestone Sep 7, 2023
curtiswilkinson added a commit to curtiswilkinson/zig that referenced this issue Sep 15, 2023
@WillLillis
Copy link
Sponsor Contributor

This should've been closed as completed when #17163 was merged, no?

@Vexu Vexu closed this as completed Jul 18, 2024
@jonasdiemer
Copy link

Hi,

I have encountered a very similar problem.

Problem occurs here: mattfreire/zig-llm@02836e2

To reproduce, run zig build run in example directory.

Output:

run
└─ run example
   └─ zig build-exe example Debug native 1 errors
/opt/homebrew/Cellar/zig/0.13.0/lib/zig/std/fmt.zig:632:21: error: cannot format slice without a specifier (i.e. {s} or {any})
                    @compileError("cannot format slice without a specifier (i.e. {s} or {any})");
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
referenced by:
    format__anon_9848: /opt/homebrew/Cellar/zig/0.13.0/lib/zig/std/fmt.zig:185:23
    print__anon_5772: /opt/homebrew/Cellar/zig/0.13.0/lib/zig/std/io/Writer.zig:24:26
    remaining reference traces hidden; use '-freference-trace' to see all reference traces

Reverting the latest commit (i.e. switching back to "{any}" fixes the issue) - but the problem is that zig is not pointing to the offending problem in the code.

Please let me know if this should be a new ticket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
error message This issue points out an error message that is unhelpful and should be improved.
Projects
None yet
Development

No branches or pull requests

4 participants