MCPcopy Index your code
hub / github.com/cordx56/rustowl

github.com/cordx56/rustowl @v0.4.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.4.0 ↗ · + Follow
404 symbols 950 edges 46 files 64 documented · 16%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README
<h1>






    <img alt="RustOwl" src="https://github.com/cordx56/rustowl/raw/v0.4.0/docs/assets/rustowl-logo.svg" width="400">



</h1>



  Visualize ownership and lifetimes in Rust for debugging and optimization






  You can try out RustOwl on <a href="https://play.rustowl.rs/">play.rustowl.rs</a>






  <font size="4">
      <a href="https://crates.io/crates/rustowl">
          <img alt="Crates.io Version" src="https://img.shields.io/crates/v/rustowl?style=for-the-badge">
      </a>
      <a href="https://aur.archlinux.org/packages/rustowl-bin">
          <img alt="AUR Version" src="https://img.shields.io/aur/version/rustowl-bin?style=for-the-badge">
      </a>
      <img alt="WinGet Package Version" src="https://img.shields.io/winget/v/Cordx56.Rustowl?style=for-the-badge">
  </font>






  <font size="4">
      <a href="https://marketplace.visualstudio.com/items?itemName=cordx56.rustowl-vscode">
          <img alt="VS Code Static Badge" src="https://img.shields.io/badge/VS_Code-Marketplace-%234daafc?style=for-the-badge">
      </a>
      <a href="https://open-vsx.org/extension/cordx56/rustowl-vscode">
          <img alt="Open VSX Version" src="https://img.shields.io/open-vsx/v/cordx56/rustowl-vscode?style=for-the-badge">
      </a>
      <a href="https://github.com/siketyan/intellij-rustowl">
          <img alt="JetBrains Plugin Version" src="https://img.shields.io/jetbrains/plugin/v/26504-rustowl?style=for-the-badge">
      </a>
  </font>






  <font size="4">
      <a href="https://discord.gg/XbxN949dpG">
          <img alt="Discord" src="https://img.shields.io/discord/1379759912942436372?style=for-the-badge&logo=discord">
      </a>
  </font>






    <img src="https://github.com/cordx56/rustowl/raw/v0.4.0/docs/assets/readme-screenshot-4.png" />

RustOwl visualizes ownership movement and lifetimes of variables. When you save Rust source code, it is analyzed, and the ownership and lifetimes of variables are visualized when you hover over a variable or function call.

RustOwl visualizes those by using underlines:

  • 🟩 green: variable's lifetime
  • definitely live: the variable is provably initialized on every path reaching this point
  • maybe live (wavy): the variable is initialized on some paths but may have been moved, dropped, or be uninitialized on others
  • 🟦 blue: immutable borrowing
  • 🟪 purple: mutable borrowing
  • 🟧 orange: value moved / function call
  • 🟥 red: lifetime error
  • Diff of lifetime between actual and expected, or
  • Invalid overlapped lifetime of mutable and shared (immutable) references

Detailed usage is described here.

Currently, we offer VSCode extension, Neovim plugin and Emacs package. For these editors, move the text cursor over the variable or function call you want to inspect and wait for 2 seconds to visualize the information. We implemented LSP server with an extended protocol. So, RustOwl can be used easily from other editor.

Table Of Contents

Support

If you're looking for support, please consider checking all issues, existing discussions, and starting a discussion first!

Also, you can reach out to us on the Discord server provided above.

Quick Start

Here we describe how to start using RustOwl.

Prerequisite

  • cargo installed
  • You can install cargo using rustup from this link.
  • Visual Studio Code (VS Code) installed

We tested this guide on macOS Sequoia 15.3.2 on arm64 architecture with VS Code 1.99.3 and cargo 1.90.0.

VS Code

You can install VS Code extension from this link. RustOwl will be installed automatically when the extension is activated.

For more detailed configuration options, see the VS Code Configuration Guide.

Vscodium

You can install Vscodium extension from this link. RustOwl will be installed automatically when the extension is activated.

After installation, the extension will automatically run RustOwl when you save any Rust program in cargo workspace. The initial analysis may take some time, but from the second run onward, compile caching is used to reduce the analysis time.

Same as VS Code, see the VS Code Configuration Guide for more detailed configuration options.

Other editor support

We support Neovim and Emacs. You have to install RustOwl before using RustOwl with other editors.

You can also create your own LSP client. If you would like to implement a client, please refer to the The RustOwl LSP specification.

Neovim

Minimal setup with lazy.nvim:

{
  'cordx56/rustowl',
  version = '*', -- Latest stable version
  build = 'cargo install rustowl',
  lazy = false, -- This plugin is already lazy
  opts = {},
}

For comprehensive configuration options including custom highlight colors, see the Neovim Configuration Guide.

Emacs

Elpaca example:

(elpaca
  (rustowl
    :host github
    :repo "cordx56/rustowl"))

Then use-package:

(use-package rustowl
  :after lsp-mode)

You have to install RustOwl LSP server manually.

For more detailed configuration options, see the Emacs Configuration Guide.

RustRover / IntelliJ IDEs

There is a third-party repository that supports IntelliJ IDEs. You have to install RustOwl LSP server manually.

Sublime Text

There is a third-party repository that supports Sublime Text.

Installation

Please see Installation for detailed installation instructions.

Usage

Please see Usage for detailed usage instructions.

Note

We support the 5 latest versions of Rust (best effort).

In this tool, due to the limitations of VS Code's decoration specifications, characters with descenders, such as g or parentheses, may occasionally not display underlines properly. Additionally, we observed that the println! macro sometimes produces extra output, though this does not affect usability in any significant way.

Extension points exported contracts — how you extend this code

MirVisitor (Interface)
(no doc) [3 implementers]
src/utils.rs
Hasher (Interface)
(no doc) [1 implementers]
src/bin/core/compiler/hash.rs
AsRustc (Interface)
(no doc)
src/bin/core/compiler.rs

Core symbols most depended-on inside this repo

iter
called by 64
src/bin/core/analyze/dataflow_analyzer.rs
push
called by 53
src/models.rs
join
called by 30
src/bin/core/analyze/dataflow_analyzer.rs
get
called by 29
src/bin/core/compiler/hash.rs
until
called by 26
src/models.rs
index_to_line_char
called by 20
src/utils.rs
from
called by 20
src/models.rs
from
called by 13
src/bin/core/compiler/hash.rs

Shape

Method 175
Function 147
Class 58
Enum 21
Interface 3

Languages

Rust93%
TypeScript7%

Modules by API surface

perf-tests/dummy-package/src/lib.rs50 symbols
src/models.rs32 symbols
src/visualize.rs24 symbols
src/lsp/decoration.rs22 symbols
src/bin/core/compiler/transform.rs20 symbols
src/utils.rs19 symbols
src/bin/core/compiler.rs19 symbols
src/lsp/backend.rs18 symbols
src/bin/core/analyze/dataflow_analyzer.rs18 symbols
src/toolchain.rs16 symbols
src/bin/core/compiler/borrowck.rs13 symbols
src/lsp/analyze.rs12 symbols

For agents

$ claude mcp add rustowl \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact