RustRover 2024.3 Help

Cargo run/debug configuration

To create a Cargo run/debug configuration, do the following:

Create a Cargo configuration

  1. Go to Run | Edit Configurations.

  2. To create a new configuration, click plus (or press Alt+Insert) and select Cargo:

    Adding a new Cargo configuration
  3. Specify the configuration Name. This name will appear in the list of available run/debug configurations.

  4. Specify the preferred configuration settings:

    Settings field

    Description

    Allow multiple instances

    Enable this option if you want to allow multiple instances of the configuration to run simultaneously. Otherwise, re-running the configuration will terminate the active session.

    Store as project file

    Enable this option to save your configuration as a project file and share it with team members through VCS.

    Command

    Use the following pattern when specifying the command:

    [command] [build options] [--] [program arguments]

    The -- prefix followed by an extra space separates Cargo build options from input arguments.

    Channel

    Optionally, specify the preferred channel. It will only affect the current configuration.

    Automatically add required features if possible

    This option adds --features="feature_name" for all required-features listed in relevant Cargo.toml files. The option is enabled by default.

    Use all features in tests

    This option adds the --all-features flag if you are running a cargo test command. For other commands, this option is ignored.

    Emulate terminal in output console

    This option can be useful for crates like color-backtrace, which behave differently when a process is run under TTY (refer to the feature description). This option is not available on Windows.

    Run with root privileges / Run with Administrator privileges

    Enable this option to debug your application as root.

    For more information, refer to Debug as root.

    Environment variables

    Optionally, specify environment variables (overriding or custom). Format them as key-value pairs separated with semicolons, for example:

    HOME=/home/me.user;MY_APP_DATA=/home/me.user/appdata

    Working directory

    If needed, change the directory used by the running task.

    Redirect input from

    This option allows you to take program input from a file instead of the console.

    Backtrace

    This option sets the RUST_BACKTRACE environment variable, which prints the unwound stack trace into error messages and controls its length.

    For more information, refer to Backtrace

    Before launch

    Here you can specify the steps to execute before launch. By default, the Build step is included, which means the IDE will rebuild your sources on every run.

    Show this page

    Enable this option to always show the run/debug configuration settings prior to actually starting it.

    Activate tool window

    Use this option to specify whether or not the Run/Debug tool window opens when you start the run/debug configuration.

    Cargo configuration settings
  5. Click OK to save the configuration.

Debug as root

You can run and debug Rust applications with root privileges. The option is called Run with root privileges on macOS / Linux and Run with Administrator privileges on Windows.

Debug as root option

Backtrace

Use the Backtrace option to set the RUST_BACKTRACE environment variable, which prints the unwound stack trace into error messages and controls its length.

Backtrace setting

Debuggers don’t suspend Rust programs on fatal errors (panic!-s). In such cases, Backtrace can help you investigate what happened by digging into the printed trace. Here is an example of how it looks when Backtrace is set to Full:

Full backtrace
Last modified: 11 February 2024