Rust Language and Rust for Blockchain
Parent: Programming Languages · Published reference · snapshot 2026-09-08 · skill lang-rust
↓ Facts as markdownall context files
Rust language sub-hub of the programming-languages family. Covers both systems Rust and Rust for blockchain/smart contracts. Load specific references under this hub as needed.
These notes link each claim to its source. Some citations identify archived research reports that are no longer hosted on this site. A published reference means the content is available; it does not certify independent review or accuracy.Read the editorial policy and follow the sources before relying on a claim.
Overview
- Rust language sub-hub of the programming-languages family. Covers both systems Rust and Rust for blockchain/smart contracts. Load specific references under this hub as needed. [archived source: https://llms-explorer.com/sources/mdb-context-hub/lang-rust/#overview]
- Systems Rust: ownership, borrowing, and lifetimes (the borrow checker's rules); move semantics and Copy/Clone; smart pointers (Box, Rc, Arc, RefCell, Cell, Weak) and interior mutability; traits, generics, and the dyn Trait vs impl Trait choice; enums and exhaustive pattern matching; Option and Result with the ? operator, thiserror and anyhow error crates; closures (Fn/FnMut/FnOnce) and iterators (lazy pipelines, collect); concurrency (Send/Sync marker traits, std::thread, Mutex/RwLock, Arc for shared ownership, atomics with orderings, channels, rayon for data parallelism); async/await with tokio (runtimes, spawn, select!, cancellation); macros (macro_rules! declarative macros and proc-macro function/derive/attribute macros); cargo, crates, features, workspaces, editions; no_std and embedded targets; WASM compilation; idioms and anti-patterns; clippy lints. [archived source: https://llms-explorer.com/sources/mdb-context-hub/lang-rust/#overview]
- Rust for blockchain: Solana + Anchor (the Rust surface of Solana programs, account model in Rust); CosmWasm smart contracts; ink! (Substrate contracts); Substrate/FRAME runtime development. [archived source: https://llms-explorer.com/sources/mdb-context-hub/lang-rust/#overview]
Where this helps
- Choosing Rust for a new systems service where memory safety must be guaranteed without a garbage collector, e.g. an async network daemon built on tokio. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
- Writing a Solana program in Rust with Anchor, where the account model and instruction handlers are expressed as Rust structs and functions. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
- Building a CosmWasm smart contract for a Cosmos SDK chain, or an ink! contract for a Substrate-based parachain, where the contract must compile to WASM. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
- Diagnosing a borrow-checker error in a concurrent program that mixes Arc<Mutex<T>> shared state with channel-based message passing. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
Project ideas
- Build a small CLI tool using cargo workspaces and the Result/? error-handling idiom with thiserror or anyhow, exercising ownership and borrowing directly. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
- Write a Solana program with Anchor that defines a custom account struct and an instruction handler, then deploy it to a devnet. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
- Prototype a CosmWasm contract compiled to WASM and exercise it against a local wasmd testnet. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
- Build a concurrent worker pool using rayon for data parallelism and compare it against a hand-rolled std::thread plus channel implementation. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
Antipatterns
- Fighting the borrow checker by littering a codebase with .clone() calls instead of restructuring ownership around Rc/Arc or redesigning the data flow. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
- Reaching for unsafe blocks to route around lifetime errors rather than understanding why the checker is rejecting the code. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
- Holding a std::sync::Mutex guard across an .await point inside an async fn, which can deadlock a tokio runtime. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
- Writing blockchain-program logic that assumes trusted input, when Solana/CosmWasm/ink! programs must validate every account and message field because callers are adversarial by default. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
Known issues
- The borrow checker's rules are notoriously steep for newcomers coming from garbage-collected languages, and lifetime-annotation errors can be hard to interpret at first. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
- Async Rust fragments the ecosystem across runtimes (tokio being dominant); libraries written against one runtime's primitives are not always portable to another. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
- no_std and embedded targets lose access to the standard library's collections and allocator, forcing a smaller-crate ecosystem for embedded/blockchain program code. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
- Procedural macros, heavily used by frameworks like Anchor, add real compile-time cost and can make error messages point at generated code rather than the source the developer wrote. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
Where this helps
- Choosing Rust for a new systems service where memory safety must be guaranteed without a garbage collector, e.g. an async network daemon built on tokio. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
- Writing a Solana program in Rust with Anchor, where the account model and instruction handlers are expressed as Rust structs and functions. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
- Building a CosmWasm smart contract for a Cosmos SDK chain, or an ink! contract for a Substrate-based parachain, where the contract must compile to WASM. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
- Diagnosing a borrow-checker error in a concurrent program that mixes Arc<Mutex<T>> shared state with channel-based message passing. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
Project ideas
- Build a small CLI tool using cargo workspaces and the Result/? error-handling idiom with thiserror or anyhow, exercising ownership and borrowing directly. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
- Write a Solana program with Anchor that defines a custom account struct and an instruction handler, then deploy it to a devnet. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
- Prototype a CosmWasm contract compiled to WASM and exercise it against a local wasmd testnet. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
- Build a concurrent worker pool using rayon for data parallelism and compare it against a hand-rolled std::thread plus channel implementation. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
Antipatterns
- Fighting the borrow checker by littering a codebase with .clone() calls instead of restructuring ownership around Rc/Arc or redesigning the data flow. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
- Reaching for unsafe blocks to route around lifetime errors rather than understanding why the checker is rejecting the code. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
- Holding a std::sync::Mutex guard across an .await point inside an async fn, which can deadlock a tokio runtime. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
- Writing blockchain-program logic that assumes trusted input, when Solana/CosmWasm/ink! programs must validate every account and message field because callers are adversarial by default. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
Known issues
- The borrow checker's rules are notoriously steep for newcomers coming from garbage-collected languages, and lifetime-annotation errors can be hard to interpret at first. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
- Async Rust fragments the ecosystem across runtimes (tokio being dominant); libraries written against one runtime's primitives are not always portable to another. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
- no_std and embedded targets lose access to the standard library's collections and allocator, forcing a smaller-crate ecosystem for embedded/blockchain program code. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
- Procedural macros, heavily used by frameworks like Anchor, add real compile-time cost and can make error messages point at generated code rather than the source the developer wrote. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
Children
- Ownership, borrowing, lifetimes and the borrow checker (move semantics, NLL, Polonius) (frontier)
- Smart pointers and interior mutability (Box/Rc/Arc/RefCell/Weak, Rc<RefCell> pattern, deref coercion) (frontier)
- Traits, generics and dispatch (coherence/orphan rule, associated types, monomorphization, dyn vs impl Trait, dyn-compatibility) (frontier)
- Error handling and the ? operator (Option/Result, thiserror vs anyhow, panic-vs-Result) (frontier)
- Closures and iterators (Fn/FnMut/FnOnce, lazy zero-cost iterator chains, IntoIterator) (frontier)
- Concurrency: Send/Sync, threads, Mutex/RwLock/Arc, atomics, channels, rayon (frontier)
- Async/await and tokio (lazy futures, executors, tokio::sync, select!, spawn_blocking, Pin/Unpin, function coloring) (frontier)
- Macros: declarative (macro_rules!) and procedural (syn/quote/proc-macro2) (frontier)
- Cargo toolchain: manifest, features and unification, profiles, workspaces, editions (2015-2024) (frontier)
- no_std and embedded Rust (core/alloc, embedded-hal, Embassy, RTIC, probe-rs) (frontier)
- The WASM target (wasm-bindgen/wasm-pack, wasm32-wasip1/p2, Component Model/WASI) (frontier)
- Rust idioms and anti-patterns (newtype, builder, typestate, illegal-states-unrepresentable, clippy) (frontier)
- Rust-on-Solana programming surface and the Anchor framework (PDAs, CPI, accounts, Borsh, compute budget) (frontier)
- CosmWasm smart contracts (actor model, instantiate/execute/query, cw-storage-plus) (frontier)
- ink! contracts on Polkadot (pallet-revive/PolkaVM migration, SCALE codec) (frontier)
- Substrate/FRAME: building app-chains/runtimes vs deploying contracts (frontier)
Frontier under this node: Async/await and tokio (lazy futures, executors, tokio::sync, select!, spawn_blocking, Pin/Unpin, function coloring), Cargo toolchain: manifest, features and unification, profiles, workspaces, editions (2015-2024), Closures and iterators (Fn/FnMut/FnOnce, lazy zero-cost iterator chains, IntoIterator), Concurrency: Send/Sync, threads, Mutex/RwLock/Arc, atomics, channels, rayon, CosmWasm smart contracts (actor model, instantiate/execute/query, cw-storage-plus), Error handling and the ? operator (Option/Result, thiserror vs anyhow, panic-vs-Result), Macros: declarative (macro_rules!) and procedural (syn/quote/proc-macro2), Ownership, borrowing, lifetimes and the borrow checker (move semantics, NLL, Polonius), Rust idioms and anti-patterns (newtype, builder, typestate, illegal-states-unrepresentable, clippy), Rust-on-Solana programming surface and the Anchor framework (PDAs, CPI, accounts, Borsh, compute budget), Smart pointers and interior mutability (Box/Rc/Arc/RefCell/Weak, Rc<RefCell> pattern, deref coercion), Substrate/FRAME: building app-chains/runtimes vs deploying contracts, The WASM target (wasm-bindgen/wasm-pack, wasm32-wasip1/p2, Component Model/WASI), Traits, generics and dispatch (coherence/orphan rule, associated types, monomorphization, dyn vs impl Trait, dyn-compatibility), ink! contracts on Polkadot (pallet-revive/PolkaVM migration, SCALE codec), no_std and embedded Rust (core/alloc, embedded-hal, Embassy, RTIC, probe-rs)