0.2.0 Preview 1 · Frozen documentation
LanguageVersion
Carries the source-language semantic version as three unsigned fields.
Sn is under heavy development. Reference extracted from this release’s bundled standard library. Public API examples are not an exhaustive compatibility test. Read the matching release guide for tested workflows and limitations. Read the status →
Module std.compiler
import std.compiler;Public declaration contracts and authored examples. A page can document several related symbols. Implementation bodies are excluded.
LanguageVersion
pub struct LanguageVersionCarries the source-language semantic version as three unsigned fields.
The value is deterministic compiler input and is independent of compiler build identity, optimization profile, host state, and wall-clock time.
Example
module example.compiler_facts;
from std.compiler import CurrentLanguageEdition, CurrentLanguageVersion,
CurrentTargetAbi, CurrentTargetArchitecture, CurrentTargetEndianness,
CurrentTargetEnvironment, CurrentTargetObjectFormat,
CurrentTargetOperatingSystem, PointerBitWidth, PointerByteAlignment,
StackByteAlignment;
fn Main() -> i32 {
if CurrentLanguageVersion.Major != 1 ||
CurrentLanguageVersion.Minor != 0 ||
CurrentLanguageVersion.Patch != 0 ||
CurrentLanguageEdition != .V1 ||
CurrentTargetArchitecture != .X86_64 ||
CurrentTargetOperatingSystem != .Linux ||
CurrentTargetEnvironment != .Gnu ||
CurrentTargetObjectFormat != .Elf ||
CurrentTargetEndianness != .Little ||
CurrentTargetAbi != .SysVAMD64 || PointerBitWidth != 64 ||
PointerByteAlignment != 8 || StackByteAlignment != 16 {
return 1;
}
return 0;
}LanguageVersion.Major
pub Major: u32;Stores the compatibility-breaking language generation.
LanguageVersion.Minor
pub Minor: u32;Stores the backward-compatible feature generation.
LanguageVersion.Patch
pub Patch: u32;Stores the backward-compatible correction generation.
CurrentLanguageVersion
pub const CurrentLanguageVersion: LanguageVersion;Exposes the exact language semantic version selected for this compilation. Return: The deterministic three-component version, initially 1.0.0.
Documentation snapshot: October 24, 2026 About versions ↗