Home / Docs / Configure a package
[package] edition
What it does
A package is one program or library: a directory with its source files under src/ and its manifest. edition says which version of the Una language the package is written in. In una.toml it is "0.1", "0.2", or the preview "0.3". From edition 0.4, the manifest is ita.una, and its edition line names 0.4 or 0.5, both previews (ADR 0121, ADR 0139). An edition fixes the language a package sees, so a package keeps compiling the same way when a newer una comes out; a preview may still change, by the terms below. Edition 0.2 adds constructs and keywords to 0.1, and some rules differ between them. The later editions are cumulative: each has every construct, keyword and rule of the edition before it, with the exceptions listed below, and adds its own.
Learn more: An edition is part of the package and Edition 0.3, a preview.
[package]
name = "shop"
version = "0.1.0"
edition = "0.2"module shop
pub price(cents: Int) -> Int = centsForms
[package]
edition = "0.1" | "0.2" | "0.3"From edition 0.4, a package is described by ita.una instead (spec/30):
ita <name>
version <version>
edition 0.4 | 0.5-
Edition
0.1is the v0.1 language. -
Edition
0.2adds the memory model (let edit,editandtakeparameters,for), fixed-width integers,togetherand constraints on generics, and the keywords that go with them. -
Edition
0.3has every construct, keyword and rule of edition0.2, and adds these:- the test declaration is written
test, andexampleis rewritten to it byuna fix(test, ADR 0105); - Conditions on operations. A
usesclause may allow an operation only under a condition, asuses @log: Log[write where not dry_run], which the verifier proves at each use. [contracts]. A table ofuna.tomlthat bounds what theusesclauses of a package's listed public functions may allow, so a header changed to allow more fails the check.[boundaries]. A table ofuna.tomlthat gives a module the most authority it may ever use. See[boundaries].- Refined elements of collections. A refined kind may be a type argument, as
List[Pos], and every value that flows into such a position is checked against its refinement. - Units of measure.
measuredeclares a unit, andInt of Meteris an integer in meters, which never mixes with seconds. - Profiles and memory budgets.
[package] profileis"app"or"systems", and[run] max_memorydeclares a package's memory budget;ita.unawrites them as the linesprofileandmax_memoryin edition0.4. See[package] profileand[run] max_memory.
Edition
0.3is a preview: the rules that target it join it as they land, so a later0.3.xrelease may add obligations or errors to an edition0.3package. It only gets stricter for the programs that edition0.2can express. A construct that a rule targeting edition0.3adds, such as a condition on an operation (uses @log: Log[write where not dry_run]), is a syntax error in earlier releases and may become accepted; it only narrows what a program may do, since erasing it gives a program that edition0.2accepts. Editions0.1and0.2keep their stability promise. - the test declaration is written
-
Edition
0.4has every construct, keyword and rule of edition0.3, and is a preview under the same terms: releasev0.4.0ships it as a preview, and a later release makes it stable (ADR 0121 rule 15; ADR 0139, amendment of 2026-11-10, accepted). One word is the exception:exampleis an ordinary name in edition0.4(spec/01 §5). It is the edition of long-running programs (spec/26):divergesandwithinare reserved in it, and its constructs join it as they land. The test declaration is writtentest, as in edition0.3, andexampleis an ordinary name there, neither a keyword nor reserved (ADR 0105, amendment of 2026-11-05);una fixrewrites anexampledeclaration totestin edition0.3packages only, so migrate a package's tests while it is on0.3. A package of edition0.4is described byita.unaand pinned byita.lock(spec/30);una.tomlnaming edition0.4is U7002, anduna migratemoves a package of an earlier edition to0.4. Collections and the numeric types afterF64are not in edition0.4: they moved to edition0.5(ADR 0139), and a package of edition0.4that uses one, such asimport std.collectionsorF32, gets the error edition0.3gives it. An unknown name,import std.collectionsand the other forms that spec/13 §7 lists also carry the advice to writeedition 0.5. -
Edition
0.5has every construct, keyword and rule of edition0.4, and is a preview under the same terms, until a later release makes it stable. It is the edition of collections (std.collections,spec/28) and of the numeric foundation afterF64(Decimal[s],F32and the finite kinds,Complex,Array,MatrixandTensor, spec/29 §16 to §19), and ofMap.update(spec/21 §2).simdis an ordinary name in it, andwithandandmay label a call's arguments, as ina.dot(with: b). It is named inita.una, as edition0.4is:edition 0.5;una.tomlnaming it is U7002, anduna migratekeeps it. -
A single file, outside a package, has edition
"0.1".
Examples
An edition the compiler does not know is rejected:
[package]
name = "shop"
version = "0.1.0"
edition = "0.6"-- fails with U7002
module shop
pub price(cents: Int) -> Int = centsEdge cases
Edition 0.2 constructs need edition 0.2 or later. In a package of edition 0.1, their keywords are reserved:
[package]
name = "shop"
version = "0.1.0"
edition = "0.1"-- fails with U0103
module shop
pub next_order(last: Int) -> Int
=
let edit order = last
order = order + 1
orderFurther rules:
- Moving to edition
0.2. Changingeditionand checking again shows what changes. See Migrating from edition 0.1. - Some rules differ by edition, such as recursive kinds and the prelude's generic functions. Each construct page has an Edition part.
- A security fix may change an edition.
ParseError, the failure ofparse_int, gained the variantTooLongin editions0.2and0.3(#914). Awhenthat names each of its variants without anelsearm now fails to check, so the change is never silent.
Diagnostics
- U0103: a keyword of edition
0.2, such asedit, in a package of edition0.1. - U7002: an edition in
una.tomlother than"0.1","0.2"and"0.3";"0.4"and"0.5"belong inita.una.
Edition
The stable editions are 0.1 and 0.2; 0.3, 0.4 and 0.5 are previews. una --version lists the editions a release serves, and on its preview: line the ones that are previews.
Normative source
- spec/13 §7: project files and editions.
- spec/01 §5: reserved words.
- spec/17 §1, spec/18 §1, spec/19 §1, spec/20 §2: the constructs of edition
0.2. spec/28 §2and spec/29 §16 to§19: the constructs of edition0.5.- spec/05 §3: conditions on operations; spec/03 §3: refined type arguments in edition
0.3; spec/25 §1: units of measure. - Decision record: ADR 0056, which introduced edition
0.2, and its amendment of 2026-10-13, which introduced edition0.3.