Rust Tutorial · Rust Basics · Lesson 1 of 29

Rust Introduction

What Rust is, why developers and companies choose it, and what a Rust program looks like.

Create a free account to save this page, take notes and track your progress. Sign in

What is Rust?

Rust is a compiled systems programming language focused on speed, memory safety and fearless concurrency. It gives you control comparable to C and C++, but its compiler rules out whole classes of bugs (null pointer dereferences, use-after-free, data races) before your program runs, without a garbage collector.

Rust is used for command-line tools, web services, databases, browsers, embedded devices, WebAssembly, and parts of the Linux and Windows kernels. It has topped developer surveys as the most admired language for years.

Hello, World!

Hello, World!
fn main() {
    println!("Hello, World!");
    let language = "Rust";
    println!("Welcome to {language}");
}

Output

Hello, World!
Welcome to Rust

Run this on your computer — see “Get Started” for setup.

Every Rust program starts in fn main(). println! ends with ! because it's a macro, not a function. The examples on this site show the program and its output; each was compiled with the Rust compiler (edition 2024) and run.

Test yourself

What does Rust use instead of a garbage collector to manage memory?

  1. Reference counting everywhere
  2. Ownership rules checked at compile time
  3. Manual malloc and free
  4. A virtual machine
Show answer

Answer: Ownership rules checked at compile time

Was this page helpful?