Set Up Your Language · 10 of 14
Setting Up Rust
Rust is a modern language that is as fast as C and C++ but checks your program for many kinds of mistakes, such as memory errors that cause crashes and security holes, before it runs. Its tool rustup installs and updates everything, including cargo, Rust's project and package manager. On Windows, Rust also needs Microsoft's free C++ build tools, which rustup offers to install for you.
New to all this? Read Before you start on the main page first: it shows how to open Terminal, make a folder for your code, and see file name endings. It takes five minutes and prevents most problems.
1 What to download, and from where
Download only from rustup.rs, the official Rust installer site, linked from rust-lang.org. Other download sites can bundle unwanted software.
- Go to rustup.rs (the official page linked from rust-lang.org).
- Click rustup-init.exe for 64-bit Windows (x64).
2 Install it on Windows
- Open the downloaded
rustup-init.exe. A black window opens. - If it says the Visual Studio C++ build tools are missing, it offers choices. Type
1(quick install via the Visual Studio installer) and press Enter. The Visual Studio Installer opens and downloads the parts it needs (several gigabytes, so this can take a while). Click Yes if Windows asks, and close the Visual Studio Installer when it finishes. - Back in the black window, it shows the install options. Type
1(proceed with standard installation) and press Enter. - When it says Rust is installed now. Great!, press Enter to close the window.
3 Check that it worked
Close every Terminal window you have open and open a new one. A Terminal that was already open does not know about programs installed after it started. Then type this and press Enter:
rustc --version
cargo --versionWhat you will see: rustc is the compiler and cargo the project tool; both show a version number.
rustc 1.91.1 (ed61e7d7e 2025-11-07) cargo 1.91.1 (ea2d97820 2025-10-10)
If you see an error such as "is not recognized" instead, look at the common mistakes at the bottom of this page.
4 Write and save your first program
A program is just a text file. You can write it in Notepad, which comes with Windows. (Later you may like the free Visual Studio Code editor from code.visualstudio.com, which colours the code and helps spot mistakes.)
- Open Notepad (press the Windows key, type Notepad, press Enter).
- Type the program below, or click Copy and paste it in with Ctrl + V. Every symbol matters, so copy it exactly.
fn main() { println!("Hello, World!"); } - In Notepad choose File → Save as. Go to your
C:\codefolder. Set Save as type to All files (*.*), type the file namehello.rsexactly as shown, including the dot and the ending, and click Save.
fn main() is where the program starts. println! prints a line; the ! marks it as a macro, a special kind of command in Rust.
Do not use Word. Word saves extra formatting and changes straight quotes " into curly ones “ ”, which no programming language accepts.
5 Run it and see the result
Two steps: compile into an .exe, then run it.
Open File Explorer, go into your C:\code folder, right-click an empty part of the window and choose Open in Terminal. (More ways to open Terminal.) If Terminal was already open from the check above and is in another folder, type cd C:\code and press Enter.
Type these lines one at a time, pressing Enter after each:
rustc hello.rs
.\hello.exeWhat you will see: the words below on a new line. That is your program running.
Hello, World!
For real projects Rust programmers use cargo instead: cargo new hello makes a folder hello with a ready-made Hello, World program in src\main.rs; then cd hello and cargo run builds and runs it in one step.
Congratulations: you have written and run a Rust program.
6 Common beginner mistakes and how to fix them
Error messages look alarming but are usually precise: read the first line, and look for a line number. If you are stuck, copy the whole error message and paste it into an AI assistant along with your code, and ask what it means.
error: linker `link.exe` not found
Why: the Microsoft C++ build tools that Rust uses on Windows are not installed.
Fix: run rustup-init.exe again and choose the Visual Studio option, or install Visual Studio Build Tools from visualstudio.microsoft.com and tick Desktop development with C++. Then reopen Terminal.
error[E0423]: expected function, found macro `println`
Why: the ! is missing: you wrote println("...").
Fix: write println!("Hello, World!");.
error: character literal may only contain one codepoint
Why: you used single quotes around the text, 'Hello, World!'. In Rust single quotes are for one character only.
Fix: use double quotes "..." for text.