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

// error
// backend=stage2
// target=native
//
// :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'