The Zig 0.16.0 release notes say:
There is no @ErrorSet builtin. To simplify the language, it is no longer possible to reify error sets. Instead, declare your error sets explicitly using error{ … } syntax.
That makes me think I can’t return an error from a function without declaring it in an error set first, e.g. putting return BogusError; in a function without declaring BogusError somewhere should fail. However, that doesn’t appear to be the case…
const std = @import("std");
pub fn main() !void {
return error.MadeUpStuff;
}
quin@Minix~$ zig build-exe test.zig
quin@Minix~$ ./test
error: MadeUpStuff
/home/quin/test.zig:4:2: 0x11d39fc in main (test.zig)
return error.MadeUpStuff;
^
Same behavior with 0.16.0 and 0.17.0-dev.607+456b2ec07. Am I missing something here?