22 lines
536 B
Rust
22 lines
536 B
Rust
// expect: run
|
|
// result: 42
|
|
// schedules: 8
|
|
// phase: 6
|
|
// spec: docs/spec/15-source-language.md §7
|
|
module scope_cases.nested_same_name
|
|
|
|
fn work(x: u64) -> u64 effects [] { x }
|
|
fn main() -> u64 effects [task.spawn, task.wait] {
|
|
var total: u64 = 0;
|
|
scope s {
|
|
let first = task.spawn(s, work, 20u64);
|
|
scope s {
|
|
let second = task.spawn(s, work, 22u64);
|
|
let s = 0u64;
|
|
total = task.join(move second) + s;
|
|
}
|
|
total = total + task.join(move first);
|
|
}
|
|
total
|
|
}
|