{
  "schema_version": "1.0",
  "codex": "thecodex.expert/coding",
  "type": "language-reference",
  "slug": "languages/rust",
  "name": "Rust",
  "section": "Languages",
  "canonical_definition": "Rust is a systems programming language that achieves memory safety without a garbage collector through an ownership system enforced at compile time \u2014 eliminating use-after-free, null pointer dereferences, buffer overflows, and data races while compiling to native machine code with no runtime overhead.",
  "confidence": "high",
  "last_verified": "2026-06-01",
  "url": "https://thecodex.expert/coding/languages/rust/",
  "version": "Rust 1.x (stable channel, 6-week release cycle)",
  "released": "May 2015 (1.0)",
  "creator": "Graydon Hoare; developed at Mozilla Research",
  "typing": "static, strong, inferred",
  "execution": "native compiled (LLVM backend)",
  "memory_management": "ownership system \u2014 automatic drop at scope end, no GC, no manual free",
  "paradigms": [
    "systems",
    "procedural",
    "functional",
    "concurrent"
  ],
  "key_concepts": {
    "ownership": "each value has exactly one owner; dropped when owner goes out of scope",
    "borrowing": "references without ownership transfer; one mutable XOR many immutable",
    "lifetimes": "compiler-verified reference validity periods",
    "traits": "shared behaviour definition; like interfaces + typeclasses",
    "enums": "algebraic data types \u2014 variants can carry data; Option<T> and Result<T,E>",
    "pattern_matching": "exhaustive match on enums; compiler forces all cases handled",
    "fearless_concurrency": "Send + Sync traits enforce thread safety at compile time"
  },
  "critical_notes": {
    "no_gc_but_automatic": "No GC but memory freed automatically at scope end via Drop trait \u2014 not manual",
    "borrow_checker_is_protection": "Borrow checker errors prevent real bugs; fighting it usually means latent safety issue in logic",
    "futures_are_lazy": "Rust async/await futures are lazy \u2014 need runtime (Tokio) to execute; unlike JS async",
    "unsafe_five_capabilities": "unsafe only unlocks 5 things: raw pointers, unsafe fn calls, mutable statics, unsafe traits, union fields",
    "copy_vs_move": "Types with Copy trait (integers, bool, char) are copied on assignment; others are moved"
  },
  "notable_deployments": [
    "Linux kernel (since 6.1, Dec 2022)",
    "Windows NT kernel drivers",
    "Firefox",
    "Cloudflare",
    "AWS",
    "Android",
    "Discord",
    "Figma"
  ],
  "sources": [
    {
      "num": 1,
      "citation": "Klabnik, S. & Nichols, C. (2022). The Rust Programming Language (2nd ed.). No Starch Press. doc.rust-lang.org/book/.",
      "tier": 1
    },
    {
      "num": 2,
      "citation": "Jung, R. et al. (2017). RustBelt: Securing the Foundations of the Rust Programming Language. POPL 2018. dl.acm.org/doi/10.1145/3158154.",
      "tier": 1
    },
    {
      "num": 3,
      "citation": "The Rust Reference. doc.rust-lang.org/reference/.",
      "tier": 1
    },
    {
      "num": 4,
      "citation": "The Rustonomicon. doc.rust-lang.org/nomicon/.",
      "tier": 1
    },
    {
      "num": 5,
      "citation": "Rust Foundation. The Rust Programming Language Blog. blog.rust-lang.org.",
      "tier": 1
    }
  ]
}