Specialize explicit function, struct and enum templates into deterministic ordinary AIR, with structural constraints and bounded expansion. Preserve source provenance and readable names in specialization diagnostics. Add Copy-only std.option/std.result and vertical specification, grammar, Quick Reference, RFC and source coverage updates. Keep linear aggregates and existing unsupported source from-returns explicit follow-up work. Repair the finite-layout check through arrays under the existing E1003 contract, with positive and rejected source/AIR fixtures. Validation: build, unit tests, 640 conformance cases, 82/82 source constructs, 32-seed generic task stress, agent-reference, formatting, hosted smoke, 20 generic and 36 package CLI checks. Record three-encoding documentation budgets; AIR reference is unchanged.
13 lines
538 B
Rust
13 lines
538 B
Rust
// expect: run
|
|
// result: [20,20,22,22]
|
|
// phase: 6
|
|
// spec: docs/spec/15-source-language.md §15
|
|
// schedules: 8
|
|
module demo.generic
|
|
fn fill<T: Copy + Send>(data: slice_mut<T>, value: T) -> void effects [] { for i in 0..data.len { data[i] = value; } }
|
|
fn main() -> [u64; 4] effects [task.spawn] {
|
|
var data: [u64; 4] = zero;
|
|
{ mut all = data; let (l, r) = all.split_at(2); scope s { let a = task.spawn(s, fill::<u64>, l, 20); let b = task.spawn(s, fill::<u64>, r, 22); task.join(move a); task.join(move b); } }
|
|
return data;
|
|
}
|