Bind typed source functions with exact effect contracts during deterministic specialization; retain nominal operation identity and ordinary AIR verification. Add spec/RFC/grammar, checked Quick Reference examples, source/AIR conformance, package/hosted CLI tests, scheduler/GC coverage and documentation budgets.
13 lines
500 B
Rust
13 lines
500 B
Rust
// expect: run
|
|
// result: 42
|
|
// phase: 6
|
|
// spec: docs/spec/15-source-language.md §18
|
|
// grant: heap=mem.alloc:8
|
|
module test.static_functions
|
|
fn identity(value: own<u64>) -> own<u64> effects [] { return move value; }
|
|
fn apply<T, F: fn(T) -> T effects []>(value: T) -> T effects [] { return F(move value); }
|
|
fn main(heap: cap<mem.alloc>) -> u64 effects [mem.alloc] {
|
|
let input = own.new(42u64, heap) or trap;
|
|
let output = apply::<own<u64>, fn identity>(move input); return own.take(move output);
|
|
}
|