karlseguin / pg.zig

Native PostgreSQL driver / client for Zig
MIT License
250 stars 18 forks source link

error: @intCast must have a known result type #4

Closed kitsuniru closed 10 months ago

kitsuniru commented 10 months ago

branch: zip-0.11

$ zig version
0.11.0

zig build output:

Build Summary: 2/5 steps succeeded; 1 failed (disable with --summary none)

install transitive failure
└─ install zapexample transitive failure
   └─ zig build-exe zapexample Debug native 1 errors
/root/.cache/zig/p/1220104468d980763e5878db../src/proto/StartupMessage.zig:19:24: error: @intCast must have a known result type
 view.writeIntBig(u32, @intCast(payload_len));
                       ^~~~~~~~~~~~~~~~~~~~~
/root/.cache/zig/p/1220104468d980763e5878db.../src/proto/StartupMessage.zig:19:24: note: result type is unknown due to anytype parameter
/root/.cache/zig/p/1220104468d980763e5878db../src/proto/StartupMessage.zig:19:24: note: use @as to provide explicit result type
referenced by:
    auth: /root/.cache/zig/p/1220104468d980763e5878db../src/auth.zig:41:22
    auth: /root/.cache/zig/p/1220104468d980763e5878db../src/conn.zig:143:19
    newConnection: /root/.cache/zig/p/1220104468d980763e5878db../src/pool.zig:214:6
    init: /root/.cache/zig/p/1220104468d980763e5878db../src/pool.zig:55:19
    main: src/main.zig:5:27
    callMain: /root/.asdf/installs/zig/0.11.0/lib/std/start.zig:574:32
    initEventLoopAndCallMain: /root/.asdf/installs/zig/0.11.0/lib/std/start.zig:508:34
    callMainWithArgs: /root/.asdf/installs/zig/0.11.0/lib/std/start.zig:458:12
    posixCallMainAndExit: /root/.asdf/installs/zig/0.11.0/lib/std/start.zig:414:39
    _start: /root/.asdf/installs/zig/0.11.0/lib/std/start.zig:327:40
karlseguin commented 10 months ago

Hmm...the zig-0.11 branch works fine for me with zig 0.11.

The error reports:

StartupMessage.zig:19:24: error: @intCast must have a known result type
 view.writeIntBig(u32, @intCast(payload_len));

But in the zig-0.11 branch, that line of code is on line 20: https://github.com/karlseguin/pg.zig/blob/zig-0.11/src/proto/StartupMessage.zig#L20

On the master branch, it's on line 19: https://github.com/karlseguin/pg.zig/blob/master/src/proto/StartupMessage.zig#L19

Is it possible this was an issue with Zig's over-aggressive caching of dependencies?

kitsuniru commented 10 months ago

issue with Zig's over-aggressive caching of dependencies

Exactly as you said, sorry, I didn't notice it.