This binary aims to help new users of Rust struggling with the ownership system.
The editor extensions that use this binary visualize ownership movement and lifetimes with colored underlines. The color mapping is roughly as follows:
- 🟩 Green: variable's actual lifetime
- 🟦 Blue: immutable borrow
- 🟪 Purple: mutable borrow
- 🟧 Orange: value moved / function call
- 🟥 Red: lifetime error (invalid overlap or mismatch)
Exact colors may vary upon editor or chosen color theme. In Helix, for example, less colors are available.
Run this binary (done automatically when editor if an editor extension is configured):
ferrous-owlDon't pass any arguments to the binary like --stdio, it listens to stdin by default.
- Open a Rust file in your editor (must be part of a Cargo workspace).
- Place the cursor on a variable definition or reference.
- Analysis should start automatically (check the extension status) and complete in a few seconds.
- Select a variable definition or reference for which you want to see ownership changes.
- Hover over the underlined lines to check ownership status changes
In some editors, you might need to manually enable ownership diagnostics with a code action.
Install system packages:
- Rust compiler toolchain:
rustup(install) - C compiler (
gcc,clang, or Visual Studio on Windows)
Install required Rust compiler components:
rustup update nightly
rustup toolchain install nightly --component rustc-dev rust-src llvm-toolsThen install ferrous-owl:
cargo +nightly install ferrous-owl --lockedMake sure the ~/.cargo/bin directory is in your path. Then, configure one of the editor extensions that are supported out of the box (see editors/):
- Helix
- VS Code: VS Studio Marketplace
FerrousOwl uses an extended LSP protocol, so it can be integrated with other editors.
println! macro may produce extra output (does not affect usability).