-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Open
Labels
error messageThis issue points out an error message that is unhelpful and should be improved.This issue points out an error message that is unhelpful and should be improved.
Milestone
Description
Zig Version
0.12.0
Steps to Reproduce and Observed Output
pub fn main() !void {
const bar: error{Foo}!i32 = @errorCast(foo());
_ = &bar;
}
fn foo() anyerror!i32 {
return error.Bar;
}thread 2814343 panic: invalid error code
/test.zig:2:47: 0x10335b4 in main (test)
const bar: error{Foo}!i32 = @errorCast(foo());
^
/home/meghan/.local/share/zig/lib/std/start.zig:511:37: 0x1033504 in posixCallMainAndExit (test)
const result = root.main() catch |err| {
^
/home/meghan/.local/share/zig/lib/std/start.zig:253:5: 0x1033041 in _start (test)
asm volatile (switch (native_arch) {
^
???:?:?: 0x0 in ??? (???)
Aborted (core dumped)
Expected Output
thread 2814343 panic: invalid error cast: expected error{Foo}, found error.Bar
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
error messageThis issue points out an error message that is unhelpful and should be improved.This issue points out an error message that is unhelpful and should be improved.