Development · Evolving reference
LanguageVersion
Carries the source-language semantic version as three unsigned fields.
Sn is under heavy development. This reference includes the intended 1.0 design; features may be incomplete in the current compiler. 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 ↗