Home / Docs / Diagnostics
U2024: A together body with a statement other than let, or fewer than two branches
Release v0.4.0
The body of a together block holds its branches: two or more let statements, each run as a concurrent task, whose bindings are in scope after the block (spec/19 §1). Any other statement in the body, or fewer than two branches, is U2024. Put the work of a branch in a function and call it from the branch's let; with one branch, write a plain let.
The repair at a glance
src/demo.una
module demo
- pub one(a: Int) -> Int
+ pub two(a: Int, b: Int) -> Int
=
together
let x = a + 1
- x
+ let y = b + 1
+ x + yFailing example
una.toml
[package]
name = "demo"
version = "0.1.0"
edition = "0.2"src/demo.una
module demo
pub one(a: Int) -> Int
=
together
let x = a + 1
xFixed example
una.toml
[package]
name = "demo"
version = "0.1.0"
edition = "0.2"src/demo.una
module demo
pub two(a: Int, b: Int) -> Int
=
together
let x = a + 1
let y = b + 1
x + y