-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Description
Zig Version
0.16.0-dev.1187+1d80c9540
Steps to Reproduce and Observed Behavior
My code that calls std.posix.accept() currently (since std.Io merge) fails to compile due to a mismatch in the error set being used here, vs the switch to using the new AcceptError set from std.Io.net.
zig/lib/std/posix.zig:3501:40: error: expected type 'error{BlockedByFirewall,Canceled,ConnectionAborted,NetworkDown,ProcessFdQuotaExceeded,ProtocolFailure,SystemFdQuotaExceeded,SystemResources,Unexpected,WouldBlock}', found type 'error{SocketNotListening}'
.INVAL => return error.SocketNotListening,
In the new std.Io.Threaded implementation, .INVAL is considered an errnoBug() case, rather than having this specific error in the union.
Similarly, std.posix.getsockoptError() (which uses ConnectError for its set, which similarly moved over to std.Io.net), is still returning errors that don't match the new union for .ISCONN and .ADDRINUSE. This was already addressed for std.posix.connect by turning .ADDRINUSE into an unexpected errno and making .ISCONN issue a panic, so I imagine that getsockoptError() should mirror something similar to those choices?
I've patched these locally and trivially to get my build working for now, but I'm kind of unsure which of several trivial directions maintainers would rather go on these cleanups. There also might be other related cases, these are just the only ones my specific project tripped on.
Expected Behavior
std.posix network functions don't fail to compile due to mismatched error sets.