Skip to content

Commit f3d2d24

Browse files
Merge pull request #6505 from MicrosoftDocs/jken/rust-docs-simplification
Simplify Rust getting started docs: point to rustup, retire tutorial
2 parents e659225 + 6d3caf4 commit f3d2d24

2 files changed

Lines changed: 43 additions & 129 deletions

File tree

hub/dev-environment/rust/overview.md

Lines changed: 12 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,46 +4,24 @@ description: An overview for beginners interested in developing on Windows with
44
ms.topic: concept-article
55
keywords: rust, windows 10, microsoft, learning rust, rust on windows for beginners, rust with vs code
66
ms.localizationpriority: medium
7-
ms.date: 03/04/2021
7+
ms.date: 03/24/2026
88
---
99

1010
# Overview of developing on Windows with Rust
1111

12-
It's not hard to get started with [Rust](https://www.rust-lang.org/). If you're a beginner who's interested in learning Rust using Windows, then we recommend that you follow each detail of this step-by-step guide. It shows you what to install, and how to set up your development environment.
12+
[Rust](https://www.rust-lang.org/) is a systems programming language designed for performance, reliability, and memory safety — without a garbage collector. It is widely used for operating systems, command-line tools, web servers, and anywhere low-level control matters.
1313

14-
> [!TIP]
15-
> If you're already sold on Rust and you have your Rust environment already set up, and you just want to start calling Windows APIs, then feel free to jump forward to the [Rust for Windows, and the windows crate](rust-for-windows.md) topic.
14+
Rust has topped Stack Overflow's [annual developer survey](https://insights.stackoverflow.com/survey) as the most-admired language for many years running, and Microsoft is a founding member of the [Rust Foundation](https://foundation.rust-lang.org/).
1615

17-
## What is Rust?
16+
## Key concepts
1817

19-
Rust is a systems programming language, so it's used for writing systems (such as operating systems). But it can also be used for applications where performance and trustworthiness are important. The Rust language syntax is comparable to that of C++, provides performance on par with modern C++, and for many experienced developers Rust hits all the right notes when it comes to compilation and runtime model, type system, and deterministic finalization.
18+
- **Cargo** — Rust's package manager and build tool. You will use it for almost everything: creating projects, adding dependencies, building, and testing.
19+
- **crate** — the basic unit of compilation in Rust. A crate can be a binary (executable) or a library.
20+
- **rustup** — the official installer and version manager for the Rust toolchain. It keeps your compiler and tools up to date.
21+
- **crates.io** — the community package registry at [crates.io](https://crates.io/).
2022

21-
In addition, Rust is designed around the promise of guaranteed memory safety, without the need for garbage collection.
23+
## Next steps
2224

23-
So why did we choose Rust for the latest language projection for Windows? One factor is that Stack Overflow's [annual developer survey](https://insights.stackoverflow.com/survey) shows Rust to be the best-loved programming language by far, year after year. While you might find that the language has a steep learning curve, once you're over the hump it's hard not to fall in love.
24-
25-
Furthermore, Microsoft is a founding member of the [Rust Foundation](https://foundation.rust-lang.org/). The Foundation is an independent non-profit organization, with a new approach to sustaining and growing a large, participatory, open source ecosystem.
26-
27-
## The pieces of the Rust development toolset/ecosystem
28-
29-
We'll introduce some Rust tools and terms in this section. You can refer back here to refresh yourself on any of the descriptions.
30-
31-
* A *crate* is a Rust unit of compilation and linking. A crate can exist in source code form, and from there it can be processed into a crate in the form of either a binary executable (*binary* for short), or a binary library (*library* for short).
32-
* A Rust project is known as a *package*. A package contains one or more crates, together with a `Cargo.toml` file that describes how to build those crates.
33-
* `rustup` is the installer and updater for the Rust toolchain.
34-
* *Cargo* is the name of Rust's package management tool.
35-
* `rustc` is the compiler for Rust. Most of the time, you won't invoke `rustc` directly; you'll invoke it indirectly via Cargo.
36-
* *crates.io* (`https://crates.io/`) is the Rust community's crate registry.
37-
38-
## Setting up your development environment
39-
40-
In the next topic, we'll see how to [set up your dev environment on Windows for Rust](setup.md).
41-
42-
## Related
43-
44-
* [The Rust website](https://www.rust-lang.org/)
45-
* [Rust for Windows, and the windows crate](rust-for-windows.md)
46-
* [Stack Overflow annual developer survey](https://insights.stackoverflow.com/survey)
47-
* [Rust Foundation](https://foundation.rust-lang.org/)
48-
* [crates.io](https://crates.io/)
49-
* [Set up your dev environment on Windows for Rust](setup.md)
25+
- [Set up your Rust development environment on Windows](setup.md)
26+
- [Rust for Windows, and the windows crate](rust-for-windows.md)
27+
- [Rust in Visual Studio Code](https://code.visualstudio.com/docs/languages/rust)

hub/dev-environment/rust/setup.md

Lines changed: 31 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -4,120 +4,56 @@ description: Setting up your dev environment for beginners interested in develop
44
ms.topic: how-to
55
keywords: rust, windows 10, microsoft, learning rust, rust on windows for beginners, rust with vs code
66
ms.localizationpriority: medium
7-
ms.date: 12/13/2024
7+
ms.date: 03/24/2026
88
---
99

10-
# Set up your dev environment on Windows for Rust
10+
# Set up your Rust development environment on Windows
1111

12-
In the [Overview of developing on Windows with Rust](overview.md) topic, we introduced Rust and talked about what it is and what some of its main moving parts are. In this topic, we'll set up our development environment.
12+
## Step 1: Install the MSVC C++ Build Tools
1313

14-
We recommend that you do your Rust development on Windows. However, if you plan to locally compile and test on Linux, then developing with Rust on the [Windows Subsystem for Linux (WSL)](/windows/wsl/about) is also an option.
14+
Rust on Windows requires Microsoft's C++ build tools as a prerequisite. If you already have [Visual Studio](https://visualstudio.microsoft.com/downloads/) installed with the **Desktop development with C++** workload, you can skip this step.
1515

16-
## Install Visual Studio (recommended) or the Microsoft C++ Build Tools
17-
18-
On Windows, Rust requires certain C++ build tools.
19-
20-
You can either download the [Microsoft C++ Build Tools](https://visualstudio.microsoft.com/visual-cpp-build-tools/), or (recommended) you might prefer just to install [Microsoft Visual Studio](https://visualstudio.microsoft.com/downloads/).
21-
22-
> [!IMPORTANT]
23-
> Use of the Microsoft C++ Build Tools, or Visual Studio Build Tools, requires a valid Visual Studio license (either Community, Pro, or Enterprise).
16+
Otherwise, install the [Microsoft C++ Build Tools](https://visualstudio.microsoft.com/visual-cpp-build-tools/) and select the **Desktop development with C++** workload.
2417

2518
> [!NOTE]
26-
> We'll be using Visual Studio Code as our integrated development environment (IDE) for Rust, and not Visual Studio. But you can still install Visual Studio without expense. A Community edition is available—it's free for students, open-source contributors, and individuals.
27-
28-
While installing Visual Studio, there are several Windows workloads that we recommend you select—**.NET desktop development**, **Desktop development with C++**, and **Universal Windows Platform development**. You might not think that you'll need all three, but it's likely enough that some dependency will arise where they're required that we feel it's just simpler to select all three.
29-
30-
New Rust projects default to using Git. So also add the individual component **Git for Windows** to the mix (use the search box to search for it by name).
31-
32-
![.NET desktop development, Desktop development with C++, and Universal Windows Platform development](../../images/rust-vs-workloads.png)
33-
34-
## Install Rust
35-
36-
Next, [install Rust from the Rust website](https://www.rust-lang.org/tools/install). The website detects that you're running Windows, and it offers you 64- and 32-bit installers of the `rustup` tool for Windows, as well as instructions on installing Rust to the [Windows Subsystem for Linux (WSL)](/windows/wsl/about).
37-
38-
> [!TIP]
39-
> Rust works very well on Windows; so there's no need for you to go the WSL route (unless you plan to locally compile and test on Linux). Since you have Windows, we recommend that you just run the `rustup` installer for 64-bit Windows. Also install the Microsoft C and C++ (MSVC) toolchain by running `rustup default stable-msvc`. You'll then be all set to write apps *for* Windows using Rust.
40-
41-
When the Rust installer is finished, you'll be ready to program with Rust. You won't have a convenient IDE yet (we'll cover that in the next section—[Install Visual Studio Code](#install-visual-studio-code)). And you're not yet set up to call Windows APIs. But you could launch a command prompt (`cmd.exe`), and perhaps issue the command `cargo --version`. If you see a version number printed, then that confirms that Rust installed correctly.
42-
43-
If you're curious about the use of the `cargo` keyword above, *Cargo* is the name of the tool in the Rust development environment that manages and builds your projects (more properly, *packages*) and their dependencies.
44-
45-
And if you really do want to dive in to some programming at this point (even without the convenience of an IDE), then you could read the [Hello, World!](https://doc.rust-lang.org/book/ch01-02-hello-world.html) chapter of The Rust Programming Language book on the Rust website.
46-
47-
## Install Visual Studio Code
19+
> Use of the Microsoft C++ Build Tools requires a valid Visual Studio license (Community, Pro, or Enterprise). The Community edition is free for students, open-source contributors, and individuals.
4820
49-
By using Visual Studio Code (VS Code) as your text editor/integrated development environment (IDE), you can take advantage of language services such as code completion, syntax highlighting, formatting, and debugging.
21+
## Step 2: Install Rust
5022

51-
VS Code also contains a [built-in terminal](https://code.visualstudio.com/docs/editor/integrated-terminal) that enables you to issue command-line arguments (to issue commands to Cargo, for example).
23+
The official Rust installer, `rustup`, handles everything — the compiler, Cargo, and future updates.
5224

53-
1. First, download and install [Visual Studio Code for Windows](https://code.visualstudio.com).
25+
#### [WinGet](#tab/winget)
5426

55-
2. After you've installed VS Code, install the **rust-analyzer** *extension*. You can either install the [rust-analyzer extension from the Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=matklad.rust-analyzer), or you can open VS Code, and search for **rust-analyzer** in the extensions menu (Ctrl+Shift+X).
27+
```powershell
28+
winget install Rustlang.Rustup
29+
```
5630

57-
3. For debugging support, install the **CodeLLDB** extension. You can either install the [CodeLLDB extension from the Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb), or you can open VS Code, and search for **CodeLLDB** in the extensions menu (Ctrl+Shift+X).
31+
#### [rustup.rs](#tab/rustup)
5832

59-
> [!NOTE]
60-
> An alternative to the **CodeLLDB** extension for debugging support is the Microsoft **C/C++** extension. The **C/C++** extension doesn't integrate as well with the IDE as **CodeLLDB** does. But the **C/C++** extension provides superior debugging information. So you might want to have that standing by in case you need it.
61-
>
62-
> You can either install the [C/C++ extension from the Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools), or you can open VS Code, and search for **C/C++** in the extensions menu (Ctrl+Shift+X).
33+
Download and run the installer from [rustup.rs](https://rustup.rs/). Accept the defaults to install the MSVC toolchain, which is recommended for Windows development.
6334

64-
4. If you want to open the terminal in VS Code, select **View** > **Terminal**, or alternatively use the shortcut **Ctrl+`** (using the backtick character). The default terminal is PowerShell.
65-
66-
## Hello, world! tutorial (Rust with VS Code)
67-
68-
Let's take Rust for a spin with a simple "Hello, world!" app.
69-
70-
1. First, launch a command prompt (`cmd.exe`), and `cd` to a folder where you want to keep your Rust projects.
71-
72-
2. Then ask Cargo to create a new Rust project for you with the following command.
73-
74-
```console
75-
cargo new first_rust_project
76-
```
77-
78-
The argument you pass to the `cargo new` command is the name of the project that you want Cargo to create. Here, the project name is *first_rust_project*. The recommendation is that you name your Rust projects using snake case (where words are lower-case, with each space replaced by an underscore).
79-
80-
Cargo creates a project for you with the name that you supply. And in fact Cargo's new projects contain the source code for a very simple app that outputs a *Hello, world!* message, as we'll see. In addition to creating the *first_rust_project* project, Cargo has created a folder named *first_rust_project*, and has put the project's source code files in there.
81-
82-
3. So now `cd` into that folder, and then launch VS Code from within the context of that folder.
83-
84-
```console
85-
cd first_rust_project
86-
code .
87-
```
88-
89-
4. In VS Code's Explorer, open the `src` > `main.rs` file, which is the Rust source code file that contains your app's entry point (a function named **main**). Here's what it looks like.
90-
91-
```rust
92-
// main.rs
93-
fn main() {
94-
println!("Hello, world!");
95-
}
96-
```
97-
98-
> [!NOTE]
99-
> When you open the first `.rs` file in VS Code, you'll get a notification saying that some Rust components aren't installed, and asking whether you want to install them. Click **Yes**, and VS Code will install the Rust language server.
35+
---
10036

101-
You can tell from glancing at the code in `main.rs` that **main** is a function definition, and that it prints the string "Hello, world!". For more details about the syntax, see [Anatomy of a Rust Program](https://doc.rust-lang.org/book/ch01-02-hello-world.html#anatomy-of-a-rust-program) on the Rust website.
37+
After installation, open a new terminal and verify your setup:
10238

103-
5. Now let's try running the app under the debugger. Put a breakpoint on line 2, and click **Run** > **Start Debugging** (or press **F5**). There are also **Debug** and **Run** commands embedded inside the text editor.
39+
```powershell
40+
cargo --version
41+
rustc --version
42+
```
10443

105-
> [!NOTE]
106-
> When you run an app under the **CodeLLDB** extension and debugger for the first time, you'll see a dialog box saying "Cannot start debugging because no launch configuration has been provided". Click **OK** to see a second dialog box saying "Cargo.toml has been detected in this workspace. Would you like to generate launch configurations for its targets?". Click **Yes**. Then close the launch.json file and begin debugging again.
44+
> [!TIP]
45+
> To keep Rust up to date, run `rustup update` periodically.
10746
108-
6. As you can see, the debugger breaks at line 2. Press **F5** to continue, and the app runs to completion. In the **Terminal** pane, you'll see the expected output "Hello, world!".
47+
## Step 3: Install Visual Studio Code and the Rust extension
10948

110-
## Rust for Windows
49+
1. Download and install [Visual Studio Code](https://code.visualstudio.com).
50+
2. Install the [rust-analyzer extension](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer) from the VS Code Marketplace. This adds code completion, inline errors, go-to-definition, and debugging support.
11151

112-
Not only can you use Rust *on* Windows, you can also write apps *for* Windows using Rust. Via the *windows* crate, you can call any Windows API past, present, and future. There are more details about that, and code examples, in the [Rust for Windows, and the windows crate](rust-for-windows.md) topic.
52+
## Next steps
11353

114-
## Related
54+
> [!div class="nextstepaction"]
55+
> [Learn Rust](https://www.rust-lang.org/learn)
11556
116-
* [Rust for Windows, and the windows crate](rust-for-windows.md)
117-
* [Windows Subsystem for Linux (WSL)](/windows/wsl/about)
118-
* [Microsoft C++ Build Tools](https://visualstudio.microsoft.com/visual-cpp-build-tools/)
119-
* [Microsoft Visual Studio](https://visualstudio.microsoft.com/downloads/)
120-
* [Visual Studio Code for Windows](https://code.visualstudio.com)
121-
* [rust-analyzer extension](https://marketplace.visualstudio.com/items?itemName=matklad.rust-analyzer)
122-
* [CodeLLDB extension](https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb)
123-
* [C/C++ extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools)
57+
- [Rust for Windows, and the windows crate](rust-for-windows.md) — call Windows APIs directly from Rust
58+
- [Rust in Visual Studio Code](https://code.visualstudio.com/docs/languages/rust) — detailed VS Code Rust workflow
59+
- [The Rust Programming Language book](https://doc.rust-lang.org/book/) — the official free Rust book

0 commit comments

Comments
 (0)