rustviz-plugin 2.0.0

A tool that allows users to generate an interactive timeline depicting ownership and borrowing events for variables in a Rust code example
docs.rs failed to build rustviz-plugin-2.0.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.

rustviz-plugin

The compiler-integrated heart of RustViz. A rustc_private plugin that walks HIR/MIR for a single-file crate and emits a code panel + timeline panel as SVGs on stdout. Built on Will Crichton's rustc_plugin / rustc_utils crates (same family as Flowistry / Aquascope).

End users typically don't touch this crate directly — they use one of:

Each of those routes calls into the binaries this crate produces (cargo-rv-plugin, rv-plugin-driver).

Installing

The standard install path is via the rustviz CLI's bootstrap, which also installs the matching nightly toolchain:

cargo install rustviz-cli
rustviz init

To install from source against a local checkout:

rustup toolchain install nightly-2025-08-20 \
    --profile minimal \
    --component rust-src,rustc-dev,llvm-tools-preview
cargo install --path . --locked

Limitations

RustViz is a teaching tool — it supports a meaningful subset of Rust, not all of it. Currently unsupported (or known to misbehave):

  • For-loops
  • Conditional let bindings
  • Borrows that occur inside conditionals
  • Some borrows over struct members
  • Lifetime annotations beyond what the Excerpt<'a> tutorial example covers

To fix / implement

  • Handle owners that are declared inside conditional blocks
  • Typecheck function ctxt to determine what type of return annotation to make
  • Implement new state calculation system
  • Remove struct members that are not utilized from the timeline
  • Implement hoverable anonymous owner interactions in code panel
  • Weird phantom annotated src bug that seems to appear when there are \t characters
  • Add highlighting for passbyref events
  • Implement For-loops (really just desugared match expr)
  • last (black) data-hash doesn't render properly
  • Fix resource dropping (breaks with conditionals)
  • Reference aliasing
  • Fix annotated source gen to handle < / > characters
  • Let-if / match expressions (new conditional move event)
  • Conditional lifetime logic and visualization
  • Bad stuff happens when you don't put a semi-colon at the end of a void stmt at the end of a block
  • Chained method calls (goes hand in hand with anonymous owner interactions, e.g. .get().get_mut())
  • Lifetimes that are 'captured' by conditional statements (use MIR)
  • Struct box kind of buggy
  • JSONify the output