16 lines
499 B
Rust
16 lines
499 B
Rust
// expect: reject E3002
|
|
// phase: 6
|
|
// spec: docs/spec/06-resources-and-errors.md
|
|
module test.source_enum_match_join
|
|
|
|
enum Choice { Close, Keep }
|
|
fn test(src: cap<fs.read>, condition: Choice) -> void effects [fs.read] {
|
|
let file = fs.open_read(src, b"/input") or trap;
|
|
match condition { // diagnostic here
|
|
Choice::Close => { fs.close(move file) or trap; }
|
|
Choice::Keep => {}
|
|
}
|
|
trap;
|
|
}
|
|
fn main(src: cap<fs.read>) -> void effects [fs.read] { test(src, Choice::Keep); }
|