PyCharm 2026.2 Help

Rust

The Rust plugin equips PyCharm with full-fledged Rust support. This guide overviews the basic procedures to get you started. You can find more information about the supported features in RustRover documentation.

Install Rust plugin

  1. Launch PyCharm. On the Welcome screen, click Plugins.

    If you already have a project opened, go to Settings (Ctrl+Alt+S) | Plugins.

  2. Select the Marketplace tab and search for the Rust plugin.

  3. Click Install and wait for the download to complete.

    Restart the IDE if prompted.

The plugin will be activated automatically. To double-check it is active, navigate to Help | Register and select Rust in the left-hand pane.

Install Rust toolchain

To develop in Rust, you need several basic tools: a compiler, a package manager, a formatter, and so on. This set of tools is referred to as the Rust toolchain. You will also need the Rust Standard Library.

If you have already opened a project and the Rust toolchain is missing, you will see a notification banner right above the editor:

No Rust toolchain configured notification
  1. Click Set up toolchain.

    Alternatively, open IDE settings (Ctrl+Alt+S) and select .

  2. If the Rust toolchain is not detected, Toolchain version will display N/A. To install the Rust toolchain, click the Install Rustup button – PyCharm will attempt to install both the toolchain and the standard library using Rustup.

  3. Once the installation is complete, PyCharm will automatically detect its location, populating the Toolchain version and Standard library paths.

  4. Click OK to apply the settings.

Open or create a Rust project

You have three options to start working on a Rust project.

Create a new Cargo project

  1. Launch PyCharm.

    To start a new project, do one of the following:

    • Click New Project on the Welcome screen.

    • Select File | New | Project from the main menu.

    • Click the Project widget in the main window header and select New Project.

  2. In the left pane, make sure Rust is selected.

  3. Specify the project location and name.

  4. Specify the location of the Rust toolchain and standard library.

    If the toolchain and standard library are installed, PyCharm will detect them automatically. Otherwise, you will be suggested to download Rustup.

    Install Rustup from the New Project wizard
  5. Select the required project template and click Create.

Open a local Cargo project

  1. In the main menu, go to File | Open. In the file chooser, select the directory containing the root Cargo.toml file (or Cargo.toml itself) and click Open:

    Open a project (not as file)
  2. In the dialog that opens, select Open as project.

    Open a project
  3. When opening the project for the first time, PyCharm will prompt you to confirm that you consider it safe.

    Click Trust Project if you are certain the project poses no threats and you would like to enable all IDE features. If you have any doubts, select Preview in Safe Mode. For more information, refer to Project security.

Clone a repository from VCS

  1. In the main menu, go to File | New | Project from Version Control or click Get from VCS on the Welcome screen.

  2. Specify the repository URL and the destination directory. Click Clone:

    Cloning a repo

Explore the workspace and features

The plugin's feature set is designed to simplify the Rust development process. Let's take a closer look at what it has to offer.

Syntax highlighting and code reference

To help you quickly read and understand Rust code, the plugin provides highlighting, Inlay Hints, quick access to documentation, and more.

Interactive inlay hints

Here are some shortcuts you may find useful:

Action

Shortcut

Go to declaration

Ctrl+Click

Get type info

Ctrl+Shift+P

Quick documentation

Ctrl+Q

For more information, refer to RustRover documentation.

Code analysis and error reporting

To help you fight errors and inconsistencies in code, the plugin offers built-in inspections and integrates with external linters.

For a summary of all detected problems, use the Inspections widget in the upper-right corner of the editor. To see the details, click the widget and refer to the Problems tool window (or select View | Tool Windows | Problems):

Code analysis results: Problems tool window and Inspections widget

For more information, refer to Code inspections and External linters in RustRover documentation.

Formatting

You can format your code using either the IDE's built-in formatter or Rustfmt (enabled by default).

Enable (or disable) Rustfmt instead of the built-in formatter

  1. Open settings by pressing Ctrl+Alt+S and navigate to Languages & Frameworks | Rust | Rustfmt.

  2. To enable Rustfmt, set the Use Rustfmt instead of built-in formatter checkbox. To disable Rustfmt, clear the checkbox.

  3. Click OK to apply the changes.

Reformat a file

  1. Open the file you want to reformat in the editor.

  2. Press Ctrl+Alt+Shift+L or select Code | Reformat File.

  3. In the Reformat File dialog, select additional options if necessary and click Run.

    Reformat file dialog

For more information, refer to Reformat and rearrange code and Rustfmt.

The Cargo tool window

The Cargo tool window is designed to help you with Cargo tasks. By default, it is pinned to the tool windows bar. You can show or hide it by clicking the window indicator on the sidebar the Rust icon (alternatively, select View | Tool Windows | Cargo from the main menu).

Cargo tool window

For more information, refer to RustRover documentation.

Sharing code in Playground

You can share your code in Rust Playground without leaving the editor.

Share in Playground

  1. Select the code fragment you'd like to share (otherwise, the IDE will copy the whole file).

  2. Right-click and choose Rust | Share in Playground.

PyCharm will create a GitHub Gist and display a notification popup with a link to the playground.

Sharing code in Playground

Build and run

Use the Build action to compile your code and Run to execute it. There are several ways to perform these actions:

Build/run Rust code

  • To build or run a particular target, open the Cargo tool window (View | Tool Windows | Cargo) and double-click the target.

    Running a target from Cargo tool window
  • To run from a particular entry point, locate it in the editor, click Execute button in the gutter, and select Run:

    Run from the gutter menu
  • To run a particular file or module, open the Project view, right-click the necessary file or module, and select Run:

    Run file from the context menu in Project view
  • If you want to build or run code using a predefined configuration (with custom parameters and settings), select it in the switcher on the main toolbar and:

    • click Build button to build (Ctrl+F9)

    • click Execute button to run (Shift+F10)

    Build icon on the main toolbar
  • You can always build/run .

For more information, refer to RustRover documentation.

Debug

Rust plugin provides a full-fledged debugger – with breakpoints, variable monitoring, stepping, and other handy features.

Start a debug session

  • To start debugging from a particular entry point, locate it in the editor, click Run icon in the gutter, and select Debug:

    Debug gutter option
  • To debug code using a predefined configuration (with custom parameters and settings), select it in the configuration switcher on the main toolbar and click Run icon:

    Initiating debug from the toolbar
  • You can always start a debug session by running a Cargo command.

For more information, refer to Start the debugger session.

Learn how to perform basic debugging actions from these guides:

Debug session

For more information, refer to RustRover documentation.

Debug Python and Rust together

When a project has Rust breakpoints, running a Python run/debug configuration automatically attaches LLDB to the process. If there are no Rust breakpoints, the configuration runs normally, without attaching LLDB.

During the session, you can move between the Python and Rust debugging contexts.

Before a Run or Debug action of a Python configuration, PyCharm automatically rebuilds the Rust components if they have changed.

    Test

    You will likely support your code with tests, doctests, and/or benchmarks. Here are a few quick ways to run them:

    Run test(s), doctest(s), or benchmark(s)

    • To run a single test or doctest, open it in the editor, click Run icon in the gutter, and select Run:

      Running a test using the gutter icon
    • To run a test/benchmark target, open the Cargo tool window (View | Tool Windows | Cargo) and double-click the target:

      Running a target from Cargo tool window
    • You can always run tests using a Cargo command.

    The Run tool window will open, automatically displaying the results:

    Test runner window

    For more information, refer to RustRover documentation.

    Run with code coverage

    The plugin provides code coverage analysis for Rust code.

    Run with Code Coverage

    To get code coverage statistics, do one of the following:

    • Locate the required entry point, click Execute button in the gutter, and select Run with Coverage:

      Running with coverage from Project view
    • Locate the necessary file in Project view, right-click, and select Run with Coverage:

      Running with coverage using gutter menu
    • If you want to run a predefined configuration (with custom parameters and settings), select it in the switcher on the main toolbar, then press Run icon and select Run with Coverage:

      Running a configuration with coverage

    The Coverage tool window (View | Tool Windows | Coverage) will open, automatically displaying the results:

    Coverage tool window

    For more information, refer to Code coverage.

    To learn more about Rust support, refer to RustRover documentation or contact our support team.

    Navigate between Rust and Python stubs

    For pyo3 projects, PyCharm provides bidirectional navigation between Rust items exposed to Python and their declarations in .pyi stub files.

    Gutter icons appear next to Rust items marked with the following pyo3 attributes:

    • #[pyfunction]

    • #[pyclass]

    • #[pymethods] (including #[new], #[getter], #[setter], #[staticmethod], and #[classmethod])

    Click a gutter icon in a Rust file to jump to the matching declaration in the corresponding .pyi stub, or click the icon in the stub to jump back to the Rust source.

    Name and signature matching follows the pyo3 conventions, including:

    • Name overrides via #[pyo3(name = "...")], #[pyfunction(name = "...")], and #[pyclass(name = "...", module = "...")].

    • Getter and setter prefix stripping (get_/set_).

    • Synthetic dunders implied by #[pyclass(eq, hash, ord)].

    • Signatures declared with #[pyo3(signature = (...))], including positional-only (/), keyword-only (*), *args, **kwargs, and default values.

    • Implicit parameters that are ignored for arity — py: Python<'_> and the cls receiver of #[classmethod].

    Navigation is available for project production sources and matches items by the enclosing #[pymodule], the Python-visible name, and arity.

    Rust plugin vs. RustRover

    Differences in the feature set

    RustRover

    CLion+Rust plugin

    IntelliJ IDEA Ultimate+Rust plugin

    PyCharm Pro+Rust plugin

    Debugger

    For Linux, both LLDB and GDB are available. For macOS, only LLDB is available. For Windows, LLDB is supported for MSVC, GDB is supported for GNU. Learn more

    For Windows and Linux, both LLDB and GDB are available. For macOS, only LLDB is available.

    Allows to debug on-chip

    For Windows and Linux, both LLDB and GDB are available (Native Debugging Support free plugin required). For macOS, only LLDB is available.

    For Windows and Linux, both LLDB and GDB are available (Native Debugging Support free plugin required). For macOS, only LLDB is available.

    Profiler

    Available on macOS, Linux, and WSL

    Available on macOS, Linux, and WSL

    Available on macOS, Linux, and WSL

    Valgrind Memcheck

    Available on Linux, WSL, and macOS (10.12 or later)

    Database support

    Language support

    RustRover

    CLion+Rust plugin

    IntelliJ IDEA Ultimate+Rust plugin

    PyCharm Pro+Rust plugin

    Rust

    Java, Groovy, Kotlin

    C/C++, Objective С/С++

    Python

    Via free plugin

    JavaScript, TypeScript

    HTML, CSS

    Sass, SCSS, Less

    XML, JSON, YAML, XSLT, XPath

    Markdown

    19 July 2026