aboutsummaryrefslogtreecommitdiff
path: root/test/cases/compile_errors/destructure_error_union.zig
blob: 6e98e0b004bf77c8bc2bc98e5fa9429dce3f2b0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
pub export fn entry() void {
    const Foo = struct { u8, u8 };
    const foo: anyerror!Foo = error.Failure;
    const bar, const baz = foo;
    _ = bar;
    _ = baz;
}

// error
//
// :4:28: error: type 'anyerror!struct { u8, u8 }' cannot be destructured
// :4:26: note: result destructured here
// :4:28: note: consider using 'try', 'catch', or 'if'