JetBrains Rust Plugin Setup for Axum Development
Learn how to set up Rust development in JetBrains IDEs - RustRover or the Rust plugin for IntelliJ IDEA Ultimate and CLion - to write, run, and debug Rust applications, preparing your environment for Axum development.
JetBrains offers Rust support in two forms: RustRover, a standalone IDE built just for Rust, and the Rust plugin for IntelliJ IDEA Ultimate, CLion, and PyCharm Pro. Both give you first-class Rust language support - code completion, error detection as you type, refactoring, and a built-in debugger - inside a full-featured IDE. If you have been using Visual Studio Code with the rust-analyzer extension, this is the comparable experience inside the JetBrains ecosystem. The plugin maintains feature parity with RustRover, so the workflow on this page is the same either way.
You might choose this setup if you already use a JetBrains IDE for other languages, prefer a more integrated environment, or want advanced features like visual debugging without needing to configure separate tools. The plugin understands Rust syntax, provides intelligent code completion, detects errors as you type, and helps you explore large codebases efficiently.
Do not install the old open-source plugin:
JetBrains used to ship Rust support as an open-source IntelliJ plugin. That plugin is now deprecated - JetBrains only maintains it for compatibility and adds no new features. On the JetBrains Marketplace it is listed as "[Deprecated] Rust". Do not install it. Use RustRover, or the current Rust plugin in IntelliJ IDEA Ultimate or CLion, instead.
This page walks you through choosing an IDE, installing the plugin (if you need it), verifying that it works, creating a small Rust project inside the IDE, and using the most important features. By the end, you will have a JetBrains environment ready for building Axum web applications.
Prerequisites
Before you install the JetBrains Rust plugin, you need two things:
- A JetBrains IDE installed on your computer. You have two options: install RustRover, the standalone IDE for Rust (free for non-commercial use; a commercial licence or the All Products Pack covers commercial work, and students get it free through the JetBrains Student Pack), or use the Rust plugin in IntelliJ IDEA Ultimate, CLion, or PyCharm Pro. The plugin is not available for IntelliJ IDEA Community Edition. RustRover and CLion include native debugging for Rust; IntelliJ IDEA Ultimate needs the free Native Debugging Support plugin for debugging.
- A working Rust installation. The plugin does not install the Rust compiler or Cargo by itself. It detects and uses the Rust toolchain that is already present on your system. If you have not installed Rust yet, you should do that first. The process usually involves running the
rustupinstaller and making surecargo --versionworks in a terminal. (The IDE can also offer to install rustup for you when you create a project.)
Which JetBrains IDE Should You Choose?:
If you only work in Rust, install RustRover - it is the simplest choice, with Rust support and debugging built in, and it is free for non-commercial use. If you already use IntelliJ IDEA Ultimate or CLion for other languages, install the Rust plugin there instead of switching IDEs.
Once you have both of those ready, you can move on to installing the plugin.
Installing the JetBrains Rust Plugin
If you installed RustRover, skip this section: Rust support is built in and there is nothing to install. The steps below are for adding Rust support to IntelliJ IDEA Ultimate or CLion.
The installation process is nearly identical across those IDEs. You use the built-in plugin marketplace to find and enable the Rust plugin. After a restart, the IDE will load the Rust language support.
Step 1: Open the Settings Dialog
Launch your JetBrains IDE. On Windows and Linux, go to File > Settings. On macOS, go to IntelliJ IDEA > Settings (or CLion > Settings). Alternatively, press Ctrl+Alt+S on Windows/Linux or Cmd+, on macOS to open the same dialog.
Step 2: Navigate to the Plugins Section
In the left sidebar of the Settings dialog, click Plugins. This shows a list of installed plugins and gives you access to the marketplace where you can browse new plugins.
Step 3: Search for the Rust Plugin
Click the Marketplace tab at the top of the Plugins window. In the search box, type Rust. The first result should be the official Rust plugin by JetBrains. It might show a small "by JetBrains" label, which confirms it is the official one. Make sure you pick Rust, not the separate "[Deprecated] Rust" listing for the old open-source plugin.
Step 4: Install the Plugin
Click the Install button next to the Rust plugin entry. The IDE downloads the plugin and its dependencies. Depending on your internet speed, this may take a few seconds.
Step 5: Restart the IDE
After installation, a message appears asking you to restart the IDE so the plugin can be activated. Click Restart IDE. The IDE closes and reopens with Rust support enabled.
Installation Complete:
After restarting, you can verify the plugin is active by opening the Settings dialog again and looking at the Installed tab under Plugins. You should see the Rust plugin listed with a checkmark or an enabled status. If you see it there, the installation worked.
If you ever need to disable or remove the plugin later, you can do so from the same Installed tab.
Verifying the Rust Toolchain Detection
The plugin needs to know where your Rust toolchain lives so it can run Cargo commands, analyze your code, and show compiler errors. In most cases, it detects the toolchain automatically because rustup adds the Rust binaries to a standard location on your system.
To check whether the plugin found your toolchain:
- Open any Rust file or create a new empty file with a
.rsextension. - Look at the bottom-right corner of the IDE window. You may see a small label that says Rust or Rust (toolchain).
- If you see a warning icon or a message about missing toolchain, the plugin could not locate Cargo.
Toolchain Not Detected:
If the plugin cannot find your Rust installation, you need to tell it where Cargo lives. Go to Settings > Languages & Frameworks > Rust. Under Toolchain location, you can specify the path to your .cargo/bin folder or to the cargo executable itself. On Windows this might be C:\Users\YourName\.cargo\bin, on macOS/Linux it is usually /Users/YourName/.cargo/bin or /home/yourname/.cargo/bin. After setting the correct path, click OK and the plugin should start using your toolchain.
You can also open the Cargo tool window (usually on the right side) to see if Cargo commands run correctly. If everything works, you are ready to create a project.
Creating a New Rust Project
There are two common ways to start a Rust project inside a JetBrains IDE. You can use the IDE's project creation wizard, or you can create the project from a terminal and then open the folder in the IDE. Both approaches work fine, and I will show you both.
Using the IDE's Project Wizard
In RustRover (or IntelliJ IDEA Ultimate / CLion with the Rust plugin), the New Project dialog includes a Rust template. Here is how to use it:
- Go to File > New > Project.
- In the left panel, select Rust.
- On the right side, choose the project type. For a simple binary (an executable program), choose Binary. For a library that others can use, choose Library.
- Enter a name for your project, for example
my_first_axum_app. - Choose a location on your disk where the project folder will be created.
- Make sure the Toolchain dropdown shows your installed Rust version (usually
Default). If it is empty, the plugin did not detect your toolchain; refer to the previous section. - Click Create.
The IDE will run cargo init in the background and open the generated project. You will see a src folder with a main.rs file, and a Cargo.toml file in the root.
Using the Terminal and Opening the Folder
If you prefer working from the command line, you can create the project with Cargo and then open it in the IDE. Open a terminal (any terminal works; on Windows you can use PowerShell or Command Prompt) and run:
cargo new my_first_axum_app
This creates a new folder named my_first_axum_app with a basic Rust project inside. After the command finishes, go to File > Open in your JetBrains IDE, navigate to that folder, and click Open. The IDE will recognize it as a Rust project and load the plugin features.
Why Two Methods?:
The IDE wizard is convenient because it does everything in one place. The terminal method is useful if you already have a project or if you prefer to use Cargo commands directly. Both end up with the same project structure.
After opening the project, you can inspect the generated main.rs file. It should look like this:
fn main() {
println!("Hello, world!");
}
This is the smallest possible Rust program. It prints a message to the console when you run it. In the next sections, you will see how the plugin helps you work with this code and more complex examples.
Understanding the IDE Features for Rust
The Rust plugin adds many features that make writing Rust code easier. These features are similar to what you get with rust-analyzer in VS Code, but integrated into the JetBrains IDE. Let's explore the most important ones using a small example.
Code Completion
Code completion suggests what you can type next based on the context. Start typing pri inside the main function, and the IDE will show a list of possible completions including println!. You can use the arrow keys to select one and press Enter to insert it. The plugin knows about the Rust standard library, your own types, and the crates you have added to Cargo.toml.
Let's create a slightly more interesting example to see completion in action. Replace the content of main.rs with the following code:
struct Person {
name: String,
age: u32,
}
impl Person {
fn new(name: &str, age: u32) -> Self {
Self {
name: name.to_string(),
age,
}
}
fn greet(&self) -> String {
format!("Hello, my name is {} and I am {} years old.", self.name, self.age)
}
}
fn main() {
let alice = Person::new("Alice", 30);
println!("{}", alice.greet());
}
Now, inside main, if you type alice. (the dot after the variable), a popup appears listing the methods and fields available on alice: greet, name, age. This is code completion. It works because the plugin understands the Person type and its implementation.
On-the-Fly Error Detection
The plugin runs checks as you type and underlines problems with red squiggles. For example, if you write alice.greet without parentheses, the IDE will warn you that you are missing a function call. If you use a variable that does not exist, it will show an error immediately. This is extremely helpful for beginners because you find out about mistakes before you even run the compiler.
Navigation
You can jump to the definition of any symbol by holding Ctrl (or Cmd on macOS) and clicking on it. For example, Ctrl+Click on greet in the line alice.greet() will take you to the greet method definition inside the impl Person block. You can also use the shortcut Ctrl+B (or Cmd+B) when the cursor is on a symbol.
Navigation becomes essential as your Axum projects grow. You can quickly move between handlers, structs, and modules without searching manually.
Refactoring
JetBrains IDEs are famous for their safe refactoring tools. Suppose you want to rename the name field in the Person struct. Right-click on the field name, choose Refactor > Rename, type a new name like full_name, and press Enter. The plugin will update every usage of that field across the entire project automatically. This is much safer than doing a global find-and-replace because it understands the code structure and only renames the intended symbol.
Running the Project
To run your Rust program, look for a green play button next to the main function in the editor gutter (the left margin). Click it, and the IDE will run cargo run in a terminal and show the output in the Run tool window at the bottom. You should see:
Hello, my name is Alice and I am 30 years old.
Alternatively, press Shift+F10 to run the last run configuration, or use the green play button on the main toolbar. (The hammer icon is Build, Ctrl+F9, not Run.)
Debugging (RustRover, CLion, or IntelliJ IDEA Ultimate)
Debugging lets you pause your program at specific lines, inspect the values of variables, and step through the code line by line. This is extremely useful for understanding why something is not working. In IntelliJ IDEA Ultimate, debugging also requires the free Native Debugging Support plugin; RustRover and CLion include debugging support.
To debug the program:
- Click in the left gutter next to a line of code, for example the line
let alice = Person::new("Alice", 30);. A red dot appears, marking a breakpoint. - Click the green bug icon (or press
Shift+F9) to start debugging. - The program starts and pauses when it reaches the breakpoint. You can now hover over variables to see their values, use the Variables panel to inspect the call stack, and use the step buttons (Step Over, Step Into) to move through the code.
- When you are done, click the red stop button.
The current Rust plugin needs Ultimate, CLion, or RustRover:
IntelliJ IDEA Community Edition does not support the current Rust plugin - it is available for IntelliJ IDEA Ultimate, CLion, and PyCharm Pro, or as part of RustRover. If you are on Community Edition, install RustRover (free for non-commercial use) for the full Rust experience including debugging.
Configuring the Rust Plugin
The plugin comes with sensible defaults, but there are a few settings you might want to adjust. Open Settings > Languages & Frameworks > Rust to see the options.
Which engine analyses your code?
JetBrains' Rust support is built on JetBrains' own code-analysis engine - it does not use rust-analyzer. There is no engine setting to switch: the analysis, completion, and refactoring all come from that one engine, and it works out of the box. If you specifically want the rust-analyzer engine, use Visual Studio Code with the rust-analyzer extension instead (covered in the VS Code topic of this chapter).
No engine choice to make:
You do not need to choose or configure an analysis engine. Install RustRover or the Rust plugin, open a Cargo project, and the IDE analyses your code immediately. If completion or error highlighting seems missing, check the troubleshooting section below rather than looking for an engine dropdown.
Setting the Toolchain Location
We already saw this in the verification section. Under the same Rust settings page, you can specify a custom toolchain location if the plugin fails to auto-detect it. This is useful if you installed Rust in a non-standard location or if you use multiple toolchains (for example, stable and nightly). You can also choose which toolchain to use for a specific project from the bottom-right corner of the IDE.
Common Mistakes and Troubleshooting
The Plugin Does Not Show Any Code Completion
If you open a .rs file and nothing happens - no highlighting, no completion, no errors - make sure the file is inside a project that the IDE recognizes as a Rust project. The project should have a Cargo.toml file in its root. If you opened just a single file without a Cargo project, the plugin may not activate fully. Open the folder containing Cargo.toml using File > Open, not just the file.
The Plugin Says "Toolchain Not Found"
This usually means the plugin cannot locate cargo. Follow the steps in the "Verifying the Rust Toolchain Detection" section to set the correct path. Also ensure that cargo is in your system PATH. You can test this by opening a terminal and running cargo --version. If that fails, your Rust installation is incomplete.
Cargo Commands Run but Errors Are Not Shown
If the plugin runs Cargo but does not display compiler errors inline, check that the On-the-fly error highlighting option is enabled. Go to Settings > Languages & Frameworks > Rust > Cargo and make sure Run external linters on the fly or similar options are checked. Also try restarting the IDE, as sometimes the language engine needs a fresh start after a large project import.
Running or Debugging Fails with "Permission Denied" on Linux
On some Linux systems, the IDE may need additional permissions to attach to processes for debugging. This is rare, but if you encounter it, try running the IDE with sudo (not recommended for daily use) or configure your system's ptrace permissions. Most beginners will not hit this issue.
Mixing Toolchains:
If you switch between the stable and nightly Rust toolchains for different projects, make sure the plugin uses the correct toolchain for the current project. The bottom-right corner of the IDE shows the active toolchain. Clicking it lets you choose a different one. Using the wrong toolchain may lead to confusing compiler errors about unstable features.
Summary
You have chosen a JetBrains IDE (RustRover or IntelliJ IDEA Ultimate / CLion with the Rust plugin), verified that it detects your Rust toolchain, created a small project, and explored the core IDE features: code completion, error detection, navigation, refactoring, running, and debugging (if your IDE supports it). This environment is now ready for writing Axum applications. You can create new projects, add dependencies to Cargo.toml, and rely on the plugin to help you write correct code quickly.
The most important takeaway is that the plugin is a bridge between the powerful JetBrains IDE and the Rust ecosystem. It does not replace Rust or Cargo; it enhances your ability to work with them. If you ever get stuck, remember that the plugin's settings page and the bottom-right toolchain selector are your first places to check.
You are now prepared to start building actual Axum web servers. Create a new project, add Axum as a dependency, and begin writing your first HTTP handlers. The plugin will guide you with completions and catch mistakes as you go.