Open In App

How to Setup Rust in VSCode?

Last Updated : 10 Oct, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

Rust is a memory-safe compiled programming language that delivers high-level simplicity with low-level performance. It is popular for Building systems where performance is critical like games engines databases or operating systems and it is an excellent choice when targeting web assembly. It was started as a side project of Graydon Hoare in 2007 and sponsored by Mozilla in 2009 which is syntactically the same as C++ but ensures more memory safety.

Visual Studio Code or VS Code is a source code editor, it is available for Windows, macOS, and Linux operating systems. Or we can say that it is a text editor that supports development operations and version control systems, it also provides different tools to build hassle-free code. It is available with many useful extensions for languages like C++, C#, Java, Python, PHP, Go, etc., and runtimes like .NET and Unity. VS Code provides great support with Rust. In this article, we will see how to install Rust in VS Code. 

Install Rust and Visual Studio Code

To begin working with Rust in Visual Studio Code. First, we install Rust and Visual Studio Code in our system(if you already installed rust and VS Code then you can skip this step).

1. To download Rust visit the official website using any browser and then download the latest version of Rust.

To check if you have installed the right version, go to Command Prompt and type the following command:

rustc –version

2. To download Visual Studio Code in your system go to the official website of VS Code using any browser.

Configure Visual Studio Code

VS Code supports Rust very well. It contains various VS Code extensions that support Rust. To install the Rust extension in VS Code follow the following steps:

Step 1: Open Visual Studio Code. 

Open-visual-studio-code

Step 2: Go to the Extension panel and install the rust-analyzer extension by clicking on the Install button or we can use Ctrl+Shift+X.

Step 3: For Debugging support install the CodeLLdb Extension by extension menu.

Simple Rust Program

Now make a new file for example (main.rs) or any file with .rs at the end and write the first Hello World program in it. Now click on the Run button to run the code 

Rust




fn main(){
 
println!("hello world");
 
}


Output:

hello World


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads