13 lines
503 B
Rust
13 lines
503 B
Rust
// expect: reject E3002
|
|
// phase: 6
|
|
// spec: docs/spec/06-resources-and-errors.md
|
|
module test.source_and_join
|
|
|
|
fn close_file(file: file<read>) -> bool effects [fs.read] { fs.close(move file) or trap; true }
|
|
fn test(src: cap<fs.read>, condition: bool) -> void effects [fs.read] {
|
|
let file = fs.open_read(src, b"/input") or trap;
|
|
let ignored = condition and close_file(move file); // diagnostic here: condition
|
|
trap;
|
|
}
|
|
fn main(src: cap<fs.read>) -> void effects [fs.read] { test(src, true); }
|